2011-06-10 74 views
1

我已经创建了Windows WCF服务并为其生成了WSDL。我正在使用基本的http绑定。当我尝试从IOS调用它(使用生成的basicHttpBinding wsdl2objc类)时,在调用其中一个WCF方法时出现错误。该错误(来自logXMLInOut)声明问题是由于地址不匹配造成的,但是我不知道如何调试这个和\或我做错了什么。与地址不匹配的WSDL2OBJC问题


以下是完整的错误消息:

2011-06-10 11:54:05.534 IpadWebServiceTest[10149:207] OutputHeaders: 
{ 
    "Content-Length" = 462; 
    "Content-Type" = "application/soap+xml; charset=utf-8"; 
    Host = "192.168.1.69"; 
    Soapaction = "FredIannon.TestService/IHelloIndigoService/FredContractNoParm"; 
    "User-Agent" = wsdl2objc; 
} 
2011-06-10 11:54:05.536 IpadWebServiceTest[10149:207] OutputBody: 
<?xml version="1.0"?> 
<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:HelloIndigoService="FredIannon.TestService" xmlns:tns1="http://schemas.microsoft.com/2003/10/Serialization/" xsl:version="1.0"> 
    <soap:Body> 
    <HelloIndigoService:FredContractNoParm/> 
    </soap:Body> 
</soap:Envelope> 
2011-06-10 11:54:05.589 IpadWebServiceTest[10149:207] ResponseStatus: 500 
2011-06-10 11:54:05.590 IpadWebServiceTest[10149:207] ResponseHeaders: 
{ 
    "Content-Length" = 615; 
    "Content-Type" = "application/soap+xml; charset=utf-8"; 
    Date = "Fri, 10 Jun 2011 16:54:05 GMT"; 
    Server = "Microsoft-HTTPAPI/2.0"; 
} 
2011-06-10 11:54:05.591 IpadWebServiceTest[10149:207] ResponseBody: 
<s:Envelope xmlns:s="http://www.w3.org/2003/05/soap-envelope" xmlns:a="http://www.w3.org/2005/08/addressing"><s:Header><a:Action s:mustUnderstand="1">http://www.w3.org/2005/08/addressing/soap/fault</a:Action></s:Header><s:Body><s:Fault><s:Code><s:Value>s:Sender</s:Value><s:Subcode><s:Value>a:DestinationUnreachable</s:Value></s:Subcode></s:Code><s:Reason><s:Text xml:lang="en-US">The message with To '' cannot be processed at the receiver, due to an AddressFilter mismatch at the EndpointDispatcher. Check that the sender and receiver's EndpointAddresses agree.</s:Text></s:Reason></s:Fault></s:Body></s:Envelope> 

这里是主机的App.config

<services> 
     <service 
      behaviorConfiguration="serviceBehavior" 
       name="HelloIndigo.HelloIndigoService"> 

      <endpoint address="HelloIndigoService" 
         binding="basicHttpBinding" 
         bindingNamespace="FredIannon.TestService" 
         name="basicHttp" 
         contract="HelloIndigo.IHelloIndigoService" /> 

      <endpoint binding="mexHttpBinding" 
         name="mex" 
         contract="IMetadataExchange" /> 

      <host> 
       <baseAddresses> 
        <add baseAddress="http://192.168.1.69:8000/HelloIndigo/HelloIndigoService" /> 
<!--      <add baseAddress="http://localhost:8000/HelloIndigo/HelloIndigoService" /> --> 
       </baseAddresses> 
      </host> 
     </service> 
    </services> 

回答

2

WCF服务正在接收你的肥皂,但它不能正确解析由wsdl2objc代理生成的soap头文件。这篇文章有你遇到的good description of the actual problem。要确定需要的头文件,首先创建一个成功调用该服务的.NET WCF客户端。通过捕获它发送的肥皂来查看预期的标题应该是什么。修改您的代理代码以生成与.NET客户端完全相同的SOAP标题。