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>
By default, Windows Communication Foundation (WCF) makes endpoints available only to SOAP clients. In How to: Create a Basic WCF Web HTTP Service, an endpoint is made available to non-SOAP clients. There may be times when you want to make the same contract available both ways, as a Web endpoint and as a SOAP endpoint.
In ASP.NET Development services, SOAP messages are exchanged over HTTP, but WCF services can exchange the message using any format over any transport protocol. Though, SOAP is a default format that WCF uses.
Normally, a WCF service will use SOAP, but if you build a REST service, clients will be accessing your service with a different architectural style (calls, serialization like JSON, etc.).
SOAP stands for simple object access protocol. In WCF the main thing is that the communication between the server and client. The communication takes place by messages with some transport layer. The main need of calling a service is to do the data transfer between the server and client.
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!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With