我谦卑地请求你在这个问题上的帮助,因为我总是得到0字节。
这些是我遇到的产出:
TestWCFCalls[94830:f803] didReceiveResponse
2011-12-14 17:11:37.054 TestWCFCalls[94830:f803] connectionDidFinishLoading
2011-1214 17:11:37.055 TestWCFCalls[94830:f803] DONE. Received Bytes: 0//变量使用NSMutableData *webData;NSString *soapMessage = NSString stringWithFormat:@"\n“http://www.w3.org/2001/XMLSchema-instance\“xmlns:xsd=\”http://www.w3.org/2001/XMLSchema\ \n“xmlns:soap12=\"">http://www.w3.org/2003/05/soap-envelope\"> \n” \n“">http://tempuri.org/\"> \n”"testtest \n“” \n“”“;NSLog(soapMessage);NSURL *url = NSURL URLWithString:@"http://10.10.10.75:8731/Design_Time_Addresses/MobileWCFService.WCFServices/UserLogOnServ/";NSMutableURLRequest *theRequest = NSMutableURLRequest requestWithURL:url;NSString *msgLength = [NSString stringWithFormat:@"%d",soapMessage length];theRequest addValue:@"text/xml;charset=utf-8“forHTTPHeaderField:@"Content-Type";@"http://tempuri.org/iUserLogOnServ/MobileLogOn“theRequest addValue: theRequest addValue: msgLength forHTTPHeaderField:@"Soapaction";theRequest addValue:msgLength forHTTPHeaderField:@”Content“;theRequest setHTTPMethod:@"POST";[theRequest setHTTPBody: soapMessage dataUsingEncoding:NSUTF8StringEncoding];NSURLConnection *theConnection = [NSURLConnection alloc initWithRequest:theRequest委托:self];if(theConnection) { NSLog(@"test");webData = [NSMutableData数据保留];}NSLog{ NSLog(@"theConnection is”);}NSLog
}
-Web配置-
<service behaviorConfiguration="MobileWCFService.WCFServices.MobileUserLogOnServBehavior"
name="MobileWCFService.WCFServices.MobileUserLogOnServ">
<endpoint address="" binding="wsHttpBinding" bindingName="MobileLogOnBinding"
contract="MobileWCFService.WCFServices.IMobileUserLogOnServ">
<identity>
<dns value="localhost" />
</identity>
</endpoint>
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
<host>
<baseAddresses>
<add baseAddress="http://10.10.10.75:8731/Design_Time_Addresses/MobileWCFService.WCFServices/MobileUserLogOnServ/" />
</baseAddresses>
</host>
</service>我不知道我错过了什么部分,但我很确定我错过了一点,虽然我可以打电话给服务部分,但我没有收到任何数据。
谢谢你,塞尔
发布于 2011-12-14 12:20:28
对于从iOS消费,WCF绑定应该是BasicHttpBinding。在你的例子中,它是wsHttpBinding。这可能就是原因。
https://stackoverflow.com/questions/8502256
复制相似问题