0
我遇到問題連接到此webservice,有什麼想法我做錯了什麼?如何讓iOS與.NET網絡服務交談
- (void)startRetrievingHotels
{
//Create the web service URL
NSURL *url = [NSURL URLWithString:@"https://www.stratexlive.com/tenants/commercialbank/_vti_bin/stratexws.asmx"];
//Create the web service request
ASIHTTPRequest *request = [ASIHTTPRequest requestWithURL:url];
NSString *requestString = [self buildHotelListRequest];
NSLog(@"%@", requestString);
[request setDelegate:self];
[request setUsername:@"[email protected]"];
[request setPassword:@"asdfasdfasdfasdf$"];
[request appendPostData:[[self buildHotelListRequest] dataUsingEncoding:NSUTF8StringEncoding]]; //Set the xml request
[request startAsynchronous];
}
- (NSString *)buildHotelListRequest
{
NSString *result = [NSString stringWithFormat: @"<?xml version=\"1.0\"?>"
@"<GetUserName xmlns=\"https://www.sdf.com/\" />"];
NSLog(@"HOTEL LIST REQUEST: %@", result);
return result;
}
這是我得到的迴應:
> <?xml version="1.0" encoding="utf-8"?><soap:Envelope
> xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> xmlns:xsd="http://www.w3.org/2001/XMLSchema"><soap:Header><soap12:Upgrade
> xmlns:soap12="http://www.w3.org/2003/05/soap-envelope"><soap12:SupportedEnvelope
> qname="soap:Envelope"
> xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" />
>
> <soap12:SupportedEnvelope qname="soap12:Envelope"
> xmlns:soap12="http://www.w3.org/2003/05/soap-envelope" />
>
> </soap12:Upgrade></soap:Header><soap:Body><soap:Fault>
>
> <faultcode>soap:VersionMismatch</faultcode><faultstring>Possible SOAP
> version mismatch: Envelope namespace https://www.stratexsystems.com/
> was unexpected. Expecting
> http://schemas.xmlsoap.org/soap/envelope/.</faultstring>
>
> <detail /></soap:Fault></soap:Body>
>
> </soap:Envelope>
什麼'問題'?... – 2012-07-12 15:42:19
你不能使用NSURLConnection? – 2012-07-12 15:44:28
@ H2CO3已更新問題。 Inder - 我的請求將變得更加複雜,所以我更熟悉ASIHTTREQUEST – TheLearner 2012-07-12 15:46:35