WCF MustUnderstand headers are not understood

Posted by raghur on Stack Overflow See other posts from Stack Overflow or by raghur
Published on 2010-05-18T01:38:53Z Indexed on 2010/05/20 3:30 UTC
Read the original article Hit count: 1039

Filed under:
|
|
|

Hello everyone,
I am using a Java Web Service which is developed by one of our vendor which I really do not have any control over it. I have written a WCF router which the client application calls it and the router sends the message to the Java Web Service and returns the data back to the client.

The issue what I am encountering is, I am successfully able to call the Java web service from the WCF router, but, I am getting the following exceptions back.

Router config file is as follows:

<customBinding>
    <binding name="SimpleWSPortBinding">
      <!--<reliableSession maxPendingChannels="4" maxRetryCount="8" ordered="true" />-->
      <!--<mtomMessageEncoding messageVersion ="Soap12WSAddressing10" ></mtomMessageEncoding>-->
      <textMessageEncoding maxReadPoolSize="64" maxWritePoolSize="16"
      messageVersion="Soap12WSAddressing10" writeEncoding="utf-8" />

      <httpTransport manualAddressing="false" maxBufferPoolSize="524288" maxReceivedMessageSize="65536"
                                      allowCookies="false" authenticationScheme="Anonymous" bypassProxyOnLocal="true" keepAliveEnabled="true"
                                      maxBufferSize="65536" transferMode="Buffered" unsafeConnectionNtlmAuthentication="false"/>
    </binding>
  </customBinding>

Test client config file

<customBinding>
            <binding name="DocumentRepository_Binding_Soap12">
              <!--<reliableSession maxPendingChannels="4" maxRetryCount="8" ordered="true" />-->
              <!--<mtomMessageEncoding messageVersion ="Soap12WSAddressing10" ></mtomMessageEncoding>-->

              <textMessageEncoding maxReadPoolSize="64" maxWritePoolSize="16"
                    messageVersion="Soap12WSAddressing10" writeEncoding="utf-8">
                    <readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384"
                        maxBytesPerRead="4096" maxNameTableCharCount="16384" />
                </textMessageEncoding>

                <httpTransport manualAddressing="false" maxBufferPoolSize="524288"
                    maxReceivedMessageSize="65536" allowCookies="false" authenticationScheme="Anonymous"
                    bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard"
                    keepAliveEnabled="true" maxBufferSize="65536" proxyAuthenticationScheme="Anonymous"
                    realm="" transferMode="Buffered" unsafeConnectionNtlmAuthentication="false"
                    useDefaultWebProxy="true" />
            </binding>
        </customBinding>

If I use the textMessageEncoding I am getting

<soap:Text xml:lang="en">MustUnderstand headers: [{http://www.w3.org/2005/08/addressing}To, {http://www.w3.org/2005/08/addressing}Action] are not understood.</soap:Text>     

If I use mtomMessageEncoding I am getting

The server did not provide a meaningful reply; this might be caused by a contract mismatch, a premature session shutdown or an internal server error.

My Router class is as follows:

 [ServiceBehavior(InstanceContextMode = InstanceContextMode.Single, ConcurrencyMode = ConcurrencyMode.Multiple, AddressFilterMode = AddressFilterMode.Any, ValidateMustUnderstand = false)]
public class EmployeeService : IEmployeeService
{
    public System.ServiceModel.Channels.Message ProcessMessage(System.ServiceModel.Channels.Message requestMessage)
    {

        ChannelFactory<IEmployeeService> factory = new ChannelFactory<IEmployeeService>("client");

        factory.Endpoint.Behaviors.Add(new MustUnderstandBehavior(false));

        IEmployeeService proxy = factory.CreateChannel();

        Message responseMessage = proxy.ProcessMessage(requestMessage);

        return responseMessage;
    }
}

The "client" in the above code under ChannelFactory is defined in the config file as:

 <client>
  <endpoint address="http://JavaWS/EmployeeService" binding="wsHttpBinding"
      bindingConfiguration="wsHttp" contract="EmployeeService.IEmployeeService"
      name="client" behaviorConfiguration="clientBehavior">
    <headers>          
    </headers>
  </endpoint>
</client>

Really appreciate your kind help.

Thanks in advance, Raghu

© Stack Overflow or respective owner

Related posts about c#3.0

Related posts about wcf