ios - What is mistake in below code in iphone -
i new phone programming.i have created web service , function in should return records retreived pervasive database. not getting output. showing exception this.can body tell me mistake.
2013-05-20 18:54:36.502 newc newcafezee[1743:11303] <?xml version="1.0" encoding="utf-8"?><soap:envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xmlns:xsd="http://www.w3.org/2001/xmlschema"><soap:body><soap:fault><faultcode>soap:client</faultcode><faultstring>system.web.services.protocols.soapexception: server unable read request. ---> system.invalidoperationexception: there error in xml document (7, 109). ---> system.formatexception: string '3/1/2013' not valid allxsd value. @ system.xml.schema.xsddatetime..ctor(string text, xsddatetimeflags kinds) @ system.xml.xmlconvert.todatetime(string s, xmldatetimeserializationmode datetimeoption) @ system.xml.serialization.xmlcustomformatter.todatetime(string value) @ system.xml.serialization.xmlserializationreader.todatetime(string value) @ microsoft.xml.serialization.generatedassembly.xmlserializationreader1.read1_onlinestatus() @ microsoft.xml.serialization.generatedassembly.arrayofobjectserializer.deserialize(xmlserializationreader reader) @ system.xml.serialization.xmlserializer.deserialize(xmlreader xmlreader, string encodingstyle, xmldeserializationevents events) --- end of inner exception stack trace --- @ system.xml.serialization.xmlserializer.deserialize(xmlreader xmlreader, string encodingstyle, xmldeserializationevents events) @ system.xml.serialization.xmlserializer.deserialize(xmlreader xmlreader, string encodingstyle) @ system.web.services.protocols.soapserverprotocol.readparameters() --- end of inner exception stack trace --- @ system.web.services.protocols.soapserverprotocol.readparameters() @ system.web.services.protocols.webservicehandler.coreprocessrequest()</faultstring><detail /></soap:fault></soap:body></soap:envelope> is there mistake in code
nsstring *soapmessage=[nsstring stringwithformat: @"<?xml version=\"1.0\" encoding=\"utf-8\"?>\n" "<soap:envelope \n" "xmlns:xsi=\"http://www.w3.org/2001/xmlschema-instance\" \n" "xmlns:xsd=\"http://www.w3.org/2001/xmlschema\"\n" "xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\">\n" "<soap:body>\n" "<onlinestatus xmlns=\"http://tempuri.org/\"><cafename>cyber cafe name</cafename><fromdate>3/1/2013</fromdate><todate>5/6/2013</todate></onlinestatus>\n" "</soap:body>\n" "</soap:envelope>"]; nslog(@"%@",soapmessage); nsurl *url = [nsurl urlwithstring:@"http://www.ebidmanagerdemo.com/gjhouseonline/xml/xmldataservice.asmx"]; nsmutableurlrequest *therequest = [nsmutableurlrequest requestwithurl:url]; nsstring *msglength = [nsstring stringwithformat:@"%d", [soapmessage length]]; [therequest addvalue: @"text/xml; charset=utf-8" forhttpheaderfield:@"content-type"]; [therequest addvalue: @"http://tempuri.org/onlinestatus" forhttpheaderfield:@"soapaction"]; [therequest addvalue: msglength forhttpheaderfield:@"content-length"]; [therequest sethttpmethod:@"post"]; [therequest sethttpbody: [soapmessage datausingencoding:nsutf8stringencoding]]; nsurlconnection *theconnection = [[nsurlconnection alloc] initwithrequest:therequest delegate:self]; if(theconnection) { webdata = [nsmutabledata data]; } else { nslog(@"theconnection null"); nsstring *msglength = [nsstring stringwithformat:@"%d", [soapmessage length]]; nslog(@"%@",msglength);
system.formatexception: string '3/1/2013' not valid allxsd value.
according xml schema specification, date time values should in iso8601 format,
for eg :
2013-01-03t22:16:00
Comments
Post a Comment