WCF endpoint binding for SOAP 1.1 - wcf

I am consuming a third party Soap service in a .NET application and I keep getting this error -
The content type text/html; charset=UTF-8 of the response message does
not match the content type of the binding (text/xml; charset=utf-8).
I checked the configuration.svcinfo and the binding seems to be basicHttpBinding. From the soap response it appears to be Soap 1.1. I am able to get this response using a downloaded Soap client but when called from .NET application, I get this error. I have checked many articles and some of them pointed to issues related to Soap 1.2 which I don't think is the case here. The endpoint configuration matches whats in the configuration.svcinfo

Related

WCF, wsHttpBinding and ws-addressing: The field <wsa:From> is missing from the soap messages

I implemented a wcf web service by using wsHttpBinding. The SOAP message perfectly includes some of the important ws-addressing fields inlcuing wsa:MessageID, wsa:ReplyTo, wsa:To and wsa:Action.
The problem is that wsa:From filed is missing from the SOAP messages. Is there any way to have wsa:From in the soap messages when I use wsHttpBinding?
Thank you,

How can I make the generated service wsdl (wcf service) contain soap headers?

I have developed a WCF service which use SOAP headers as part of the validation of the request process.
In my service side I verify that the SOAP headers sent and valid.
I generated WSDL files using SOAPUI in order to send to my costumer.
When testing the generated wsdls, I noticed that SOAPUI does not add SOAP headers to the requests automatically.
Is there any way to mark the service (with attribute or something similar) like a service which needs SOAP headers?
Thanks
If you are only using some interceptors / inspectors to validate that header is present you cannot expect that it will be mentioned in WSDL. Header is mentioned in WSDL only if it is part of message contract used by your operation or if you add them to message description manually.

What is the default WCF Binding?

I've been struggling for a few days with this problem, learning a lot of things on bindings in the process.
One thing puzzles me, though: various links (see this or that for example) explicitly state "By default, WCF project is created using WsHttpBinding", but that's not what I see.
This is what I do:
Open Visual Studio 2010 and choose New Project / Visual C# / WCF Service Application
Don't touch anything inside the code, set a local IIS Url for the service (say http://localhost/WcfService7)
Open soapUI and choose File / New Soap UI Project / enter the url of the newly created wsdl: http://localhost/WcfService7/Service1.svc?wsdl, not touching any other option
Interface properties: SOAP Version = SOAP 1.1, Binding = "BasicHttpBinding_IService1" (even though it's just a name, it's a hell of a hint)
Open Altova XmlSpy and choose SOAP / Create new SOAP Request / enter the url of the wsdl / select any operation
SOAP / Change SOAP Request parameters / Ensure that "Send as SOAP+XML (SOAP 1.2)" is checked
SOAP / Send request to server: i get the errors
HTTP error: could not POST file ‘/WcfService7/Service1.svc’ on server ’localhost’ (415)
Error sending the soap data to ‘http://localhost/WcfService7/Service1.svc’ HTTP error: could not POST file ‘/WcfService7/Service1.svc’ on server ’10.51.0.108’ (415)
Any explanations? Thanks
When hosting WCF service in IIS (using WCF Service application project template) with default .svc file (without changing its service host factory) the default binding is basicHttpBinding. If you want to change default binding to wsHttpBinding you must use:
<protocolMapping>
<add scheme="http" binding="wsHttpBinding"/>
</protocolMapping>
In your service's configuration file but it will not solve your problem because you don't need wsHttpBinding and as I remember Altova XmlSpy is not able to send valid request for wsHttpBinding because it supports only basic SOAP stack without WS-* protocols.
The default is basichttpbinding using SOAP 1.1.
That is why you get an error sending it as SOAP 1.2.

The request failed with HTTP status 415

I am getting an exception when I try to call method from WCF...I am consuming WCF in windows application using framework 2.0 and my WCF uses the BasicHttpBinding option...
The request failed with HTTP status
415: Cannot process the message
because the content type 'text/xml;
charset=utf-8' was not the expected
type 'multipart/related;
type="application/xop+xml"'
The client application is failing as it sends data on an Endpoint which is expecting MTOM messages. However, the client application just sends plain Soap messages (Soap1.1). If you can't upgrade your client application to use .Net Framework 3.5, you can use WSE 3.0 which allows to use MTOM with .net framework 2.0.
If you can upgrade application to 3.5, you can use WCF to communicate to service.
Regards,
Amit Bhatia

content type issue with SOAP::Lite

When I'm trying connect to server I got below error msg:
Cannot process the message because the
content type 'text/xml' was not the
expected type 'application/soap+xml;
charset=utf-8'
I read it connect to server (implemented in WCF), but can I fix it also with my side (the client) implemented in Perl using the SOAP::Lite module?
The exception means that client expects the response from Webservice using message version Soap 1.1 and thus, expecting content-type of the message to be 'text/xml'. However, it's sending the messages to the service endpoint using Soap 1.2 message version.
If perl/Soap Lite supports Soap 1.2, it can communicate with WCF on this endpoint.
HTH,
Amit
I am still struggling to get my perl application to consume a WCF based web service but I was able to get past the error you are referrign to in your post.
To change the content type use this command.
$SOAP::Constants::DEFAULT_HTTP_CONTENT_TYPE = 'application/soap+xml';