2014-01-14 57 views
0

在局域網asihttprequest,有一個與URI "http://172.10.50.232:18090/HB/LocateOnRoadService.svc"WCF服務(不通過IIS發佈)沒有給出迴應在iOS應用

我的應用程序的WCF服務使用ASIFormDataRequest發送請求。

NSURL *url = [NSURL URLWithString:@"http://172.10.50.232:18090/HB/LocateOnRoadService.svc"]; 
self.locationRequest = [ASIFormDataRequest requestWithURL:url]; 

NSString *soapMessage = [NSString stringWithFormat:@"<s:Envelope xmlns:s=\"http://schemas.xmlsoap.org/soap/envelope/\">\ 
         <s:Body>\ 
         <LocateOnRoadWithResolution xmlns=\"http://tempuri.org/\">\ 
         <mapX>12313</mapX>\ 
         <mapY>1321</mapY>\ 
         <resolution>5</resolution>\ 
         </LocateOnRoadWithResolution>\ 
         </s:Envelope>"]; 
NSLog(@"%@",soapMessage); 
NSString *strLength = [NSString stringWithFormat:@"%d",[soapMessage length]]; 

[self.locationRequest setRequestMethod:@"POST"]; 

//[self.locationRequest addRequestHeader:@"Host" value:@"172.10.50.232:18090"]; 

[self.locationRequest addRequestHeader:@"Content-Type" value:@"text/xml;charset=utf-8"]; 
[self.locationRequest addRequestHeader:@"Content-Length" value:strLength]; 
[self.locationRequest addRequestHeader:@"SOAPAction" value:@"http://tempuri.org/ILocateOnRoadService/LocateOnRoadWithResolution"]; 

[self.locationRequest appendPostData:[soapMessage dataUsingEncoding:NSUTF8StringEncoding]]; 

[self.locationRequest setDelegate:self]; 
[self.locationRequest setPersistentConnectionTimeoutSeconds:5.0]; 
[self.locationRequest startAsynchronous]; 

委託方法- (void)requestFinished:(ASIHTTPRequest *)request

可以調用,但[request responseData]總是給NULL。

什麼問題,期待一些幫助,謝謝!

回答

0
NSString *soapMessage = [NSString stringWithFormat:@"<s:Envelope xmlns:s=\"http://schemas.xmlsoap.org/soap/envelope/\">\ 
        <s:Body>\ 
        <LocateOnRoadWithResolution xmlns=\"http://tempuri.org/\">\ 
        <mapX>12313</mapX>\ 
        <mapY>1321</mapY>\ 
        <resolution>5</resolution>\ 
        </LocateOnRoadWithResolution>\ 
        </s:Body>\ 
        </s:Envelope>"]; 

soap消息應該是完整的。 由wsdl聲明的任務地址是http://172.10.50.232:18090/,而不是http://172.10.50.232:18090/HB/LocateOnRoadService.svc

相關問題