I’m developing a simple wcf service and trying to expose it as Soap for compatibility reasons: the client will be a flash application with its nice actionscript.
I am obviously using basicHttpBinding to generate soap compatible WSDL.
Here follows my configuration (anonymized of sensitive data of course):
<system.serviceModel>
<bindings>
<basicHttpBinding>
<binding name="soapBinding" />
</basicHttpBinding>
</bindings>
<services>
<service behaviorConfiguration="BasicBehavior" name="MyCustomer.MyProject.WebService.MyService">
<endpoint address="mex" binding="mexHttpBinding" name="mex" contract="IMetadataExchange" />
<endpoint binding="basicHttpBinding" bindingConfiguration="soapBinding"
name="Basic" bindingNamespace="http://myurl"
contract="MyCustomer.MyProject.WebService.IMyService">
</endpoint>
<host>
<baseAddresses>
<add baseAddress="http://myurl" />
</baseAddresses>
</host>
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior name="BasicBehavior">
<serviceMetadata httpGetEnabled="true" />
<serviceDebug includeExceptionDetailInFaults="false" />
</behavior>
</serviceBehaviors>
</behaviors>
It’s quite simple really. Now the guy developing the flash application states that he has some troubles, that he sees the only method present (called ValidateForm) but he doesn’t see the parameter list.
I tried the following:
- Calling the webservice using storm (storm.codeplex.com): careful: storm and not wcf storm. Storm only works with normal webservices, it can’t connect in native WCF mode. This works fine. I see parameters, can fill them, invoke and receive the correct response.
- Calling the service with http://soapclient.com/soaptest.html : this reads my wsdl, sees the parameters list, but when invoking an “unexpected error” occurs.
- Calling the webservice with http://www.validwsdl.com/ : this reads the wsdl but it doesn’t see the parameter list at all, and the invoke fails.
There’s obviously something wrong with my service. Here follows the WSDL, maybe someone can tell me what’s wrong (again anonymized):
<wsdl:definitions name="mycustomermyprojectService" targetNamespace="http://www1.myproject.mydomain.com" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/" xmlns:tns="http://www1.myproject.mydomain.com" xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing" xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy" xmlns:wsap="http://schemas.xmlsoap.org/ws/2004/08/addressing/policy" xmlns:wsaw="http://www.w3.org/2006/05/addressing/wsdl" xmlns:msc="http://schemas.microsoft.com/ws/2005/12/wsdl/contract" xmlns:wsa10="http://www.w3.org/2005/08/addressing" xmlns:wsx="http://schemas.xmlsoap.org/ws/2004/09/mex" xmlns:wsam="http://www.w3.org/2007/05/addressing/metadata">
<wsdl:types>
<xsd:schema targetNamespace="http://www1.myproject.mydomain.com/Imports">
<xsd:import schemaLocation="http://www1.myproject.mydomain.com/?xsd=xsd0" namespace="http://www1.myproject.mydomain.com"/>
<xsd:import schemaLocation="http://www1.myproject.mydomain.com/?xsd=xsd1" namespace="http://schemas.microsoft.com/2003/10/Serialization/"/>
<xsd:import schemaLocation="http://www1.myproject.mydomain.com/?xsd=xsd2" namespace="http://schemas.datacontract.org/2004/07/mycustomer.myproject.WebService.Models"/>
</xsd:schema>
</wsdl:types>
<wsdl:message name="ImycustomermyprojectService_ValidateForm_InputMessage">
<wsdl:part name="parameters" element="tns:ValidateForm"/>
</wsdl:message>
<wsdl:message name="ImycustomermyprojectService_ValidateForm_OutputMessage">
<wsdl:part name="parameters" element="tns:ValidateFormResponse"/>
</wsdl:message>
<wsdl:portType name="ImycustomermyprojectService">
<wsdl:operation name="ValidateForm">
<wsdl:input wsaw:Action="http://www1.myproject.mydomain.com/ImycustomermyprojectService/ValidateForm" message="tns:ImycustomermyprojectService_ValidateForm_InputMessage"/>
<wsdl:output wsaw:Action="http://www1.myproject.mydomain.com/ImycustomermyprojectService/ValidateFormResponse" message="tns:ImycustomermyprojectService_ValidateForm_OutputMessage"/>
</wsdl:operation>
</wsdl:portType>
<wsdl:binding name="Basic" type="tns:ImycustomermyprojectService">
<soap:binding transport="http://schemas.xmlsoap.org/soap/http"/>
<wsdl:operation name="ValidateForm">
<soap:operation soapAction="http://www1.myproject.mydomain.com/ImycustomermyprojectService/ValidateForm" style="document"/>
<wsdl:input>
<soap:body use="literal"/>
</wsdl:input>
<wsdl:output>
<soap:body use="literal"/>
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
<wsdl:service name="mycustomermyprojectService">
<wsdl:port name="Basic" binding="tns:Basic">
<soap:address location="http://www1.myproject.mydomain.com/"/>
</wsdl:port>
</wsdl:service>
</wsdl:definitions>
Anyone can shed some light? Thanks.
There are scenarios where other platforms dont understand the import attributes and hence we need to flatten our wsdl.
You can find some information on how to flatten your wsdl at the following link
You need to create your own Service host factory that flattens your wsdl as explained in the link. This would be a inbuilt feature going ahead in .NET 4.5 if i am not wrong. The information for that can be found at this link