2011-06-10 75 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標題。