WCF error while calling a 3rd party service


  • Hi ,

      I've a console application having a reference to a class library dll in which an actual call to a 3rd party service takes place. This is working fine and i'm able to get the output returned by the service.

     Now, my requirement is to convert the console application to a wcf service for it to consume by other applications. I've succesfully created a wcf service using the console application and added class library reference and hosted in IIS. The problem is i'm getting an error in the class library while making a call to the 3rd party service.(which was working with a console application) . I'm debugging the service using wcftestclient.

    The actual error is :

    The content type text/html;charset=utf-8 of the response message does not match the content type of the binding (application/soap+xml; charset=utf-8). If using a custom encoder, be sure that the IsContentTypeSupported method is implemented properly. The first 418 bytes of the response were: 'Error 500: Request processing failed&#59; nested exception is Could not write message to OutputStream: Disallowed element found inside Envelope : {}Header&#59; nested exception is org.apache.axiom.soap.SOAPProcessingException: Disallowed element found inside Envelope : {}Header'.

    I'm using wshttpbinding as mentioned below:

            <binding name="wsHttpBindingConfig" closeTimeout="00:10:00" openTimeout="00:10:00"
              sendTimeout="00:10:00" maxBufferPoolSize="2147483647" maxReceivedMessageSize="2147483647"
              messageEncoding="Text" textEncoding="utf-8" allowCookies="false" >
              <readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647"
                maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647" />
                  <extendedProtectionPolicy policyEnforcement="Never" />

    Please help if someone have any idea on the above error

    martes, 15 de mayo de 2012 7:28


Todas las respuestas

  • The error message means that you are getting back an HTML page instead of the soap response message from the 3rd party service, for example, the 3rd party service uses SOAP 1.1 message version (which expects text/xml), but the client uses SOAP 1.2 (which expects application/soap+xml),WSHttpBinding uses SOAP 1.2, BasicHttpBinding uses SOAP 1.1. you can try changing the wsHttpBinding to basicHttpBinding. Here is a similar post.

    In addition, you can turn on WCF tracing at server and client side to see whether it can capture more detailed error information at underlying channel level.

    #Configuring Tracing

    Please mark the replies as answers if they help or unmark if not. If you have any feedback about my replies, please contact Microsoft One Code Framework

    miércoles, 16 de mayo de 2012 2:24
  • I think the following steps can help you find out root cause

    1. Browser the 3rd party service. You should be able find out whether you need use https or http

    2. Run Fiddler in your local, you should be able to see the real returned html page if service using http. If it is using https, you won't see it.

    The most I can guess is the 3rd party service need https and you are using http. 

    miércoles, 16 de mayo de 2012 15:36