2011-12-14 35 views
0

我虚心请教你的帮助,在这个主题为始终接收0字节iPhone和SOAP 1.2(.NET WCF)

这是我遇到的输出:buttonClicked

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 
  • (IBAction为) :(ID)发送方{

    //Variables used 
    NSMutableData *webData; 
    NSString *soapMessage = NSString stringWithFormat: 
    
    @"<?xml version=\"1.0\" encoding=\"utf-8\"?>\n" 
    "<soap12:Envelope \n" 
    "xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" \n" 
    "xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" \n" 
    "xmlns:soap12=\"http://www.w3.org/2003/05/soap-envelope\"> \n" 
    "<soap12:Body> \n" 
    "<MobileLogOn xmlns=\"http://tempuri.org/\"> \n" 
    "<userID>test</userID><PWD>test</PWD></MobileLogOn> \n" 
    "</soap12:Body> \n" 
    "</soap12:Envelope>"]; 
    
    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"];  
    [theRequest addValue: @"http://tempuri.org/iUserLogOnServ/MobileLogOn" forHTTPHeaderField:@"Soapaction"]; 
    [theRequest addValue: msgLength forHTTPHeaderField:@"Content-Length"]; 
    [theRequest setHTTPMethod:@"POST"];  
    [theRequest setHTTPBody: [soapMessage dataUsingEncoding:NSUTF8StringEncoding]]; 
    NSURLConnection *theConnection = [[NSURLConnection alloc] initWithRequest:theRequest delegate:self]; 
    
    if(theConnection) { 
        NSLog(@"test"); 
        webData = [[NSMutableData data] retain]; 
    } 
    else { 
        NSLog(@"theConnection is NULL"); 
    } 
    

}

织网配置 -

<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> 

我不知道我错过了一部分,但我敢肯定,我错过了一些问题,但我可以调用服务的一部分,但我还没有收到任何数据。

类感谢, SEL

+0

出于好奇,你有没有尝试用http://sudzc.com/自动创建你的SOAP客户端? – Mat 2011-12-14 09:51:16

+0

我曾尝试sudzc.com,但无法生成,该网站表示无法连接到我的本地服务文件。 – 2011-12-15 09:03:36

回答

0

对于从iOS上,WCF结合应该是basicHttpBinding的消耗。在你的情况下,它是wsHttpBinding。这可能是原因。