Search code examples
wcfsoapswagger.net-6.0

.Net 6 with connection to a WCF Soap service by a channelfactory. What works out fine now. Gives an error about the response header not conform


As you can seen in the picture we do get a good request and response from the soap service

enter image description here

But in our rest service where we use Open Api specifications with Swagger, and where we do a call to the soap service, we get a response that the content-type of the response does not match the content-type of the request. What is indeed not the content-type that we need. But how can I change the response header to the same as the request header content-type = "application/soap+xml; charset=UTF-8", so that i can work with it and parse the received soap message to the correct objectType.

enter image description here

enter image description here


Solution

  • According to the exception, you have to make sure both the client and the server use the same bindings and configuration.

    Besides if you use wshttpbinding, the version of the soap needs to be changed to soap 1.2.

    Hope it helps.