iOS: PHP web service using SOAP returns null when called -


created web service .php extension , passing parameters though soap. returns out of understanding. check on restclient proper input returned actual output. not going on in code. may gone wrong ?

my xml structure input is,

<?xml version="1.0" encoding="utf-8"?> <soap:envelope xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xmlns:xsd="http://www.w3.org/2001/xmlschema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">  <soap:header>  </soap:header>  <soap:body>    <getupdates>   <user_location></user_location>   <application_type>fc</application_type>   <last_updated_date>2014-11-25</last_updated_date>   <platform>android</platform>   </getupdates>  </soap:body> </soap:envelope> 

and web service method is,

-(void) notifydatacalled {      nsstring * post= @"<soap:envelope xmlns:xsi=\"http://www.w3.org/2001/xmlschema-instance\" xmlns:xsd=\"http://www.w3.org/2001/xmlschema\" xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\"><soap:header></soap:header><soap:body><getupdates><user_location>new york</user_location><application_type>free</application_type><last_updated_date>2014-12-12</last_updated_date><platform>ios</platform></getupdates></soap:body></soap:envelope>";       nsurl *url = [nsurl urlwithstring:@"http://game.techone.com/webservices/service.php"];      asihttprequest *request = [asihttprequest requestwithurl:url];     [request settimeoutseconds:30];     [request setdelegate:self];     [request setpostbody:[[post datausingencoding:nsutf8stringencoding] mutablecopy]];     [request addrequestheader:@"content-type" value:@"text/xml"];     [request addrequestheader:@"content-length" value:[nsstring stringwithformat:@"%d",[post length]]];     [request addrequestheader:@"soapaction" value:@"getupdates"];     [request setpostlength:[post length]];     [request setrequestmethod:@"post"];     [request startsynchronous];      nserror *error = [request error];     if (error)     {      }     else     {            nsstring *xmlresult = [nsstring stringwithformat:@"%@",[request responsestring]];             nsdictionary *dictioneryresult = [xmlreader dictionaryforxmlstring:xmlresult error:nil];   } } 

response getting is,

"soap-env:envelope" =     {         "soap-env:body" =         {             "ns1:getupdatesresponse" =             {                 return =                 {                     "soap-enc:arraytype" = "xsd:anytype[0]";                     "xsi:type" = "soap-enc:array";                 };                 "xmlns:ns1" = "http://schemas.xmlsoap.org/soap/envelope/";             };         };         "soap-env:encodingstyle" = "http://schemas.xmlsoap.org/soap/encoding/";         "xmlns:soap-enc" = "http://schemas.xmlsoap.org/soap/encoding/";         "xmlns:soap-env" = "http://schemas.xmlsoap.org/soap/envelope/";         "xmlns:xsd" = "http://www.w3.org/2001/xmlschema";         "xmlns:xsi" = "http://www.w3.org/2001/xmlschema-instance";     }; 

try adding

[request addrequestheader:@"accept" value:@"text/xml"]; 

to webservice request. rest service calling defaulting json. many return xml upon request.


Comments

Popular posts from this blog

c++ - OpenMP unpredictable overhead -

ruby on rails - RuntimeError: Circular dependency detected while autoloading constant - ActiveAdmin.register Role -

javascript - Wordpress slider, not displayed 100% width -