0
我解析SOAP Web服务进行身份验证,但它没有返回任何NSData,因此我可以为它编写xml解析器。肥皂web服务
请让我知道我做错了什么。
这里是我的代码:
**
-(void)getAdvertisment
{
NSString* soapMesasge=
[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>"
"<GetAdvertisement xmlns=\"http://tempuri.org/\" />"
"</soap:Body>"
"</soap:Envelope>"];**
NSURL* url=[NSURL URLWithString:@"http://codeexsolutions.com/HosService/ServiceHOSProvider.asmx"];
NSMutableURLRequest* theRequest=[NSMutableURLRequest requestWithURL:url];
NSString* msgLength=[NSString stringWithFormat:@"%d",[soapMesasge length]];
[theRequest addValue:@"text/xml" forHTTPHeaderField:@"Content-Type"];
[theRequest addValue:@"http://tempuri.org/GetAdvertisement" forHTTPHeaderField:@"SOAPAction"];
[theRequest addValue:msgLength forHTTPHeaderField:@"Content-Length"];
[theRequest setHTTPMethod:@"POST"];
[theRequest setHTTPBody:[soapMesasge dataUsingEncoding:NSUTF8StringEncoding]];
NSURLConnection *theConnection=[[NSURLConnection alloc] initWithRequest:theRequest delegate:self];
if (theConnection)
{
webData =[[NSMutableData alloc]retain];
}
else
{
// Inform the user that the connection failed.
}
}
这是上面 – 2011-03-26 06:24:42
的代码,你可以编辑自己的问题,如果你喜欢。 – gideon 2011-03-26 06:27:59
[soap web服务解析]的可能重复(http://stackoverflow.com/questions/5456212/soap-web-service-parsing) – 2011-03-31 20:08:18