MarkusBreker-0095 avatar image
0 Votes"
MarkusBreker-0095 asked JiayaoWu-MSFT commented

WCF Accept Response without content type


I have the following problem: I am sending a SOAP Message to a webservice. I have added it via a WSDL file as a connected service to my project.

Now I am creating a client object with binding, endpointadress etc. and call the method to send the message.

I have looked at it with fiddler, my message is going out correctly and I am getting back a response.

The content of the response is like I expect it. It´s a xml string and it´s like I expect it (it says that they got my message and accepted it).

But my program throws the following exception:

"An HTTP Content-Type header is required for SOAP messaging and none was found."

I can see in fiddler that there is no content-type defined in the response header.

My problem is that the webservice on the other side is not mine and I can´t change the header information.
Is there a way to ignore this exception and process the response? Because the content is correct and I can work with it.

Thanks for your help!

· 3
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Hi @MarkusBreker-0095 ,
You can try to increase WCF service server CloseTimeout Binding property to 5 minutes from default 1. Since you didn't post the specific code, I suggest you try it out, and it solves someone's problems.

0 Votes 0 ·

this didn´t help and I think it´s far away from my problem.

The problem is that I am getting a response without content type in the header from the webservice. So C#/WCF throws the exception from my first post because the WCF definition says that there has to be a content-type in the header.

So I have to get access to the message before this exception is thrown. I tried the IMessageInspector but it is too late. I found out that this exception is thrown very early at the transporrt layer.

So my question is whether there is a chance to get access to the message at a point before this exception is thrown.

0 Votes 0 ·

Hi @MarkusBreker-0095 ,
As far as I know this doesn't work, I recommend adding content-Type and then running the program.

0 Votes 0 ·

0 Answers