ContractFilter mismatch

Apr 19, 2011 at 1:11 PM

Hi.

Using WSCF.blue and the contract-first-approach I have been struggling to get through to my service.

I'm hosting the service at IIS 7.5.

Like the walkthrough suggests  (http://wscfblue.codeplex.com/) i have created two documents a employee.xsd and a employeemessages.xsd from which i have created my wsdl file by using the wscf.blue tool (--> Create WSDL interface description).

To be able to use the WSDL file that comes from the WSCF.blue tool i have modified the web.config file:

 

<serviceBehaviors>
  <behavior name="metadataServiceExtension">
   <!-- <metadataService metadataUrl="wsdl" rootMetadataFileLocation="C:\Users\steff\documents\visual studio 2010\Projects\DONG\WebServices\Messages\DongEmployeeService.wsdl" /> -->
    <serviceMetadata httpGetEnabled="True" externalMetadataLocation="..\Contracts\EmployeeService.wsdl"  />
    <serviceDebug includeExceptionDetailInFaults="true"/>
   </behavior>
</serviceBehaviors>
Notice that i use the Microsoft serviceMetadata - externalMetadatalocation. Which is suggested various places e.g. http://wscfblue.codeplex.com/discussions/239089.
The only change i make to the WSDL file is to change the soap:adress line so i match the actual path of the service
<service name="EmployeeServicePort">
   <port name="EmployeeServicePort" binding="import0:BasicHttpBinding_EmployeeServiceInterface">
     <soap:address location="http://XXX.YYY.143.253/DongWebServices/EmployeeService.svc" />
     <!--<soap:address location="http://localhost/EmployeeService" />-->
   </port>
 </service>

The rest of the WSDL file is exactly like the WSCF.blue left it for me:
<!--WSDL generated by thinktecture WSCF; version 1.0.11.0-->
<!--Tuesday, 19-04-2011 - 01:56 PM-->
<definitions xmlns:import0="http://www.sdu.dk/EmployeeService" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/" name="EmployeeService" targetNamespace="http://www.sdu.dk/EmployeeService" xmlns="http://schemas.xmlsoap.org/wsdl/">
  <wsdl:documentation xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" />
  <types>
    <xsd:schema>
      <xsd:import schemaLocation="http://XXX.YYY.143.253/DongWebServices/Messages/EmployeeMessages.xsd" namespace="http://www.sdu.dk/EmployeeService" />
      <xsd:import schemaLocation="http://XXX.YYY.143.253/DongWebServices/Data_types/Employee.xsd" namespace="http://www.sdu.dk/EmployeeService" />
    </xsd:schema>
  </types>
  <message name="getEmployeeIn">
    <wsdl:documentation xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" />
    <part name="parameters" element="import0:GetEmployee" />
  </message>
  <message name="getEmployeeOut">
    <wsdl:documentation xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" />
    <part name="parameters" element="import0:GetEmployeeResponse" />
  </message>
  <portType name="EmployeeServiceInterface">
    <wsdl:documentation xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" />
    <operation name="GetEmployee">
      <wsdl:documentation xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" />
      <input message="import0:getEmployeeIn" />
      <output message="import0:getEmployeeOut" />
    </operation>
  </portType>
  <binding name="BasicHttpBinding_EmployeeServiceInterface" type="import0:EmployeeServiceInterface">
    <soap:binding transport="http://schemas.xmlsoap.org/soap/http" />
    <operation name="GetEmployee">
      <soap:operation soapAction="http://www.sdu.dk/EmployeeService:getEmployeeIn" style="document" />
      <input>
        <soap:body use="literal" />
      </input>
      <output>
        <soap:body use="literal" />
      </output>
    </operation>
  </binding>
  <service name="EmployeeServicePort">
    <port name="EmployeeServicePort" binding="import0:BasicHttpBinding_EmployeeServiceInterface">
      <soap:address location="http://XXX.YYY.143.253/DongWebServices/EmployeeService.svc" />
      <!--<soap:address location="http://localhost/EmployeeService" />-->
    </port>
  </service>
</definitions>

However.. When i try to call the GetEmployee i get the following error:

The message with Action 'http://www.sdu.dk/EmployeeService:getEmployeeIn' cannot be processed at the receiver, due to a ContractFilter mismatch at the EndpointDispatcher. This may be because of either a contract mismatch (mismatched Actions between sender and receiver) or a binding/security mismatch between the sender and the receiver.  Check that sender and receiver have the same contract and the same binding (including security requirements, e.g. Message, Transport, None).

There is nothing to find in the traces... 

Could you guys give me some advice?

Thanks in advance..

Steffan 

May 13, 2011 at 5:30 PM

Hi Steffan,

I am having this same issue. Have you found a resolution?

Thanks. John

May 14, 2011 at 3:45 PM

Hi John.

Actually i ended up writing my WSDL files by hand...

However with the benefit of hindsight, i now see that the <soap:operation soapAction="XXXX" did not correspond to my code behind Action attribute.

More specifically if the Service interface that implements the contract wsdl file above have the following operationcontractattribute (copy from my IEmployeeService.CS):

[System.ServiceModel.OperationContractAttribute(Action="http://xxx.com/res/employee.wsdl/IEmployeeService/GetEmployee"....

Then the soap operation should be: <soap:operation soapAction="http://xxx.com/res/employee.wsdl/IEmployeeService/GetEmployee".

Hope this will allow you to move on...

Cheers,

Steffan Johansen