pass multiple value to webservice in iphone

bokreazotte

New Member
I want to access a webservice, want to pass 2 parameters.When I run the code below, this error is shown:\[code\]@countryname not supplied\[/code\]I already pass 2 parameters as \[code\]txtcity\[/code\] and \[code\]txtcountry\[/code\].\[code\]-(IBAction)FindWords:(id)sender{NSString *soapMsg = [NSString stringWithFormat: @"<?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:Body>" "<GetWeather xmlns=\"http://www.webserviceX.NET/\">" "<CityName>%@</CityName>" "<CountryName>%@</CountryName>" "</GetWeather>" "</soap:Body>" "</soap:Envelope>", txtCity.text,txtCounrty.text];//---print it to the Debugger Console for verification---NSLog(@"%@",soapMsg);NSURL *url = [NSURL URLWithString: @"http://www.webservicex.net/globalweather.asmx"];NSMutableURLRequest *req = [NSMutableURLRequest requestWithURL:url]; //---set the various headers--- NSString *msgLength = [NSString stringWithFormat:@"%d", [soapMsg length]]; NSLog(@"WebData....%@",soapMsg); [req addValue:@"text/xml; charset=utf-8" forHTTPHeaderField:@"Content-Type"]; [req addValue:@"http://www.webserviceX.NET/GetWeather" forHTTPHeaderField:@"SOAPAction"]; [req addValue:msgLength forHTTPHeaderField:@"Content-Length"]; //---set the HTTP method and body--- [req setHTTPMethod:@"POST"]; [req setHTTPBody:[soapMsg dataUsingEncoding:NSUTF8StringEncoding]]; //---start animating-- [activityIndicator startAnimating]; conn = [[NSURLConnection alloc] initWithRequest:req delegate:self]; if(conn) { webData = http://stackoverflow.com/questions/10664599/[[NSMutableData data] retain]; NSLog(@"WebDatanew....%@",webData); }}\[/code\]
 
Back
Top