Я реализовал SOAP-сервис в iOS. Я использую следующий код для отправки запроса.Проблема в SOAP XML
NSString *sSOAPMessage = @"<?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>"
"<CelsiusToFahrenheit xmlns=\"http://www.w3schools.com/webservices/\">"
"<Celsius>50</Celsius>"
"</CelsiusToFahrenheit>"
"</soap:Body>"
"</soap:Envelope>";
NSURL *sRequestURL = [NSURL URLWithString:@"http://w3schools.com/webservices/tempconvert.asmx"];
NSMutableURLRequest *myRequest = [NSMutableURLRequest requestWithURL:sRequestURL];
NSString *sMessageLength = [NSString stringWithFormat:@"%d", [sSOAPMessage length]];
[myRequest addValue: @"text/xml; charset=utf-8" forHTTPHeaderField:@"Content-Type"];
[myRequest addValue: @"http://www.w3schools.com/webservices/CelsiusToFahrenheit" forHTTPHeaderField:@"SOAPAction"];
[myRequest addValue: sMessageLength forHTTPHeaderField:@"Content-Length"];
[myRequest setHTTPMethod:@"POST"];
[myRequest setHTTPBody: [sSOAPMessage dataUsingEncoding:NSUTF8StringEncoding]];
NSURLConnection *theConnection = [[NSURLConnection alloc] initWithRequest:myRequest delegate:self];
if(theConnection) {
webData = [[NSMutableData data] retain];
}else {
NSLog(@"Some error occurred in Connection");
}
И я получаю следующий ответ. Не получая никакой ценности, то есть значения Цельсия или Фаренгейта в ответ.
где ответ? – preetam
Он вернет веб-страницу. С некоторыми тегами HTML & spanans – Apoorv