WCF and Soap 1.1

43,640

Solution 1

The basicHttpBinding does use SOAP 1.1 - but in that case, you would have a content type of application/soap+xml.

Since your client is sending text/xml - any chance they're expecting a REST interface? This would be handled by the WCF webHttpBinding.

Read more about REST in WCF on the MSDN WCF REST Developer Center and check out the Pluralsight screencast series on WCF REST - highly recommended!

Solution 2

Generally when we get a message / error in a web service which includes the text:

content type 'text/xml'

It means that the web server returned an error page instead of the expected xml response.

Solution 3

I had the exact same issue - the definition was saying that it was soap 1.2 but expecting 1.1 as the content-type was different.

I found that if i adjusted my server configuration from:

...
<endpoint address="" .../>
    <host>
        <baseAddresses>
            <add baseAddress="http://localhost:8001/services/fooService" />
        </baseAddresses>
    </host>
...

To:

...
<endpoint address="fooService" .../>
    <host>
        <baseAddresses>
            <add baseAddress="http://localhost:8001/services" />
        </baseAddresses>
    </host>
...

The wsdl exposed it as Soap 1.1 this time.

Share:
43,640

Related videos on Youtube

Silas Hansen
Author by

Silas Hansen

Updated on July 09, 2022

Comments

  • Silas Hansen
    Silas Hansen almost 2 years

    I am trying to create a service that a 3rd party should hopefully consume.
    The consumer is compatible with SOAP 1.1, which is why I am using basicHttpBinding for the server. When the actual request is made, something seems to go wrong with the content types expected by the server. Using basicHttpBinding I dont get why the server still expects 'application/soap+xml' which, to my knowledge, is only required by SOAP 1.2.

    I've used wireshark to figure out exactly what those two were communicating about. See tcp stream and setup below.

    Any help is appreciated.

    3rd party app request

    POST / HTTP/1.1

    SOAPAction: http://tempuri.org/ITestService/Hello

    Content-Type: text/xml; charset=utf-8

    Host: shdesktop:8000

    Content-Length: 297

    Expect: 100-continue

    Connection: Close

    WCF Server response

    HTTP/1.1 415 Cannot process the message because the content type 'text/xml; charset=utf-8' was not the expected type 'application/soap+xml; charset=utf-8'.

    Content-Length: 0

    Server: Microsoft-HTTPAPI/2.0

    Date: Tue, 09 Feb 2010 14:03:19 GMT

    Connection: close

    Service configuration

    <system.serviceModel>
        <services>
          <service behaviorConfiguration="behTestService" name="ConsoleApplication1.TestService">
            <endpoint address="" binding="mexHttpBinding" contract="IMetadataExchange" />
            <endpoint address="TestService" binding="basicHttpBinding"
                contract="ConsoleApplication1.ITestService" />
            <host>
              <baseAddresses>
                <add baseAddress="http://localhost:8000" />
              </baseAddresses>
            </host>
          </service>
        </services>
        <behaviors>
          <serviceBehaviors>
            <behavior name="behTestService">
              <serviceMetadata httpGetEnabled="true"/>
              <serviceDebug includeExceptionDetailInFaults="true" />
            </behavior>
          </serviceBehaviors>
        </behaviors>
      </system.serviceModel>
    
  • Silas Hansen
    Silas Hansen over 14 years
    oh, SOAP 1.1 would use 'application/soap+xml'? I will test the webHttpBinding tomorrow, thank you! I know for a fact that it works when I create a simple asmx service, if it makes any difference.
  • marc_s
    marc_s over 14 years
    @Silas: "old-style" ASP.NET webservices (ASMX) and WCF basicHttpBinding use SOAP 1.1 - so that should be ok, really. You need to check whether your client is sending you a SOAP request, or just trying to post an XML to your URL
  • Silas Hansen
    Silas Hansen over 14 years
    I was calling http://<hostname> instead I needed to call http://<hostname>/TestService. Stupid mistake by me. Thanks for all the help though!