Note that there are some explanatory texts on larger screens.

plurals
  1. POhow to get the exact value out of the response i am getting from the web service?
    primarykey
    data
    text
    <p>I am trying to use this web service in my app (just to try my hands on web services): <a href="http://www.w3schools.com/webservices/tempconvert.asmx?op=CelsiusToFahrenheit" rel="nofollow">http://www.w3schools.com/webservices/tempconvert.asmx?op=CelsiusToFahrenheit</a> and below is the code i am using:</p> <pre><code>- (void)viewDidLoad { [super viewDidLoad]; // create a soap Message which is given in your required web service // create a url to your asp.net web service. NSURL *tmpURl=[NSURL URLWithString:[NSString stringWithFormat:@"http://www.w3schools.com/webservices/tempconvert.asmx?op=CelsiusToFahrenheit"]]; // create a request to your asp.net web service. NSMutableURLRequest *theRequest=[NSMutableURLRequest requestWithURL:tmpURl]; NSString * params = [[NSString alloc] initWithFormat:@"Celsius = 32"]; myWebData = [[NSMutableData alloc] init]; [theRequest setHTTPMethod:@"POST"]; [theRequest setHTTPBody:[params dataUsingEncoding:NSUTF8StringEncoding]]; connection = [[NSURLConnection alloc] initWithRequest:theRequest delegate:self]; } // a method when connection receives response from asp.net web server -(void)connection:(NSURLConnection *)connection didReceiveResponse:(NSURLResponse *)response { [myWebData setLength: 0]; } // when web-service sends data to iPhone -(void)connection:(NSURLConnection *)connection didReceiveData:(NSData *)data { [myWebData appendData:data]; NSString *receivedDataString = [[NSString alloc] initWithData:myWebData encoding:NSUTF8StringEncoding]; NSLog(@"%@",receivedDataString); } // when there is some error with web service -(void)connection:(NSURLConnection *)connection didFailWithError:(NSError *)error { } // when connection successfully finishes -(void)connectionDidFinishLoading:(NSURLConnection *)connection { // check out your web-service retrieved data on log screen NSString *theXML = [[NSString alloc] initWithBytes: [myWebData mutableBytes] length:[myWebData length] encoding:NSUTF8StringEncoding]; NSLog(@"%@",theXML); [theXML release]; } </code></pre> <p>In the NSString theXML i am getting some response which had some erro too. Below is the response which i am getting in debugger:</p> <blockquote> <p>WebServiceTutorial[474:207] soap:ReceiverServer was unable to process request. ---&gt; Data at the root level is invalid. Line 1, position 1.</p> </blockquote> <p>Thanks,</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload