简体   繁体   中英

Getting the error Client found response content type of 'text/html; charset=utf-8', but expected 'application/soap+xml'?

in my local machine I turned On IIS, created virtual directories, built the code and tried to launch the web page, but I am getting the following error --

"System.InvalidOperationException: Client found response content type of 'text/html; charset=utf-8', but expected 'application/soap+xml'"

Can anyone kindly let me know how to rectify this. Platform used is Windows 7, working with Visual studio 2005, C#.NET. I am new to this, had never worked on these.

Kindly help me. Thanks In advance.

It's seems you are working with SOAP1.1 (that use de content type text/xml ) instead of SOAP1.2 (that use conte type application/soap+xml).

In your web.config add this:

<system.web>
        <webServices>
        <protocols>
            <add name="HttpSoap"/>
                        <add name="HttpSoap12"/>
        </protocols>
    </webServices>
</system.web>

It makes your web service accept SOAP1.1 and SOAP1.2 request.

If your are working on the client part, you must activate SOAP1.2 protocol for your client application. Can't say anymore without code and explanations.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

Related Question wcf + The content type text/html of the response message does not match the content type of the binding (application/soap+xml; charset=utf-8) WCF ERROR: (415) content type 'application/x-www-form-urlencoded' was not the expected type 'application/soap+xml; charset=utf-8' WCF Membership Provider throws error: content type 'application/json; charset=utf-8' was not the expected type 'application/soap+xml; charset=utf-8' SILVERLIGHT WCF Issue: Content Type application/soap+xml; charset=utf-8 was sent to a service expecting text/xml; Cannot process the message because the content type 'application / xml' was not the expected type 'application / soap + xml; charset = utf-8 ' The content type application/xml;charset=utf-8 of the response message does not match the content type of the binding (text/xml; charset=utf-8) The content type application/xml;charset=utf-8 of the response message does not match the content type of the binding (text/xml; charset=utf-8), WCF 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) HTTP 415 Cannot process the message because the content type 'application/json; charset=utf-8' was not the expected type 'text/xml; charset=utf-8' Cannot process the message because the content type 'application/json; charset=utf-8' was not the expected type 'text/xml; charset=utf-8'
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM