WSDL2OBJC issue with Address Mismatch
I have created a Windows WCF service and generated WSDL for it. I am using basic http binding. When I try to call this from IOS (using the generated basicHttpBinding wsdl2objc class) I get an error when calling one of the WCF method. The error (from the logXMLInOut) states the problem is due to an address mismatch, however I have no clue about how to debug this and\or what I am doing wrong.
Here is the full error message:
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;开发者_JAVA百科 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>
Here is the hosts 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>
The WCF service is receiving your soap but it can't correctly parse the soap headers generated by the wsdl2objc proxy. This post has a good description of the actual problem you are encountering. To determine what are the required headers, start by creating a .NET WCF client that successfully invokes the service. See what the expected headers should be by capturing the soap it sends. Modify your proxy code to produce the exact soap headers as the .NET client.
精彩评论