简体   繁体   中英

Cannot add service reference: the content type text/html [..] does not match the content type of the binding

I have a Web API and i want to call an online web service that uses SOAP.

I tried to add it as "service reference" however when I call it am getting the below summarized error

The content type text/html of the response message does not match the content type of the binding (text/xml; charset=utf-8). If using a custom encoder, be sure that the IsContentTypeSupported method is implemented properly. The first 13 bytes of the response were: <HTML></HTML>

The binding in my web.config is basicHttpBinding and I checked if the binding configuration matched the WSDL configuration and it does.

This is the URL am trying to consume: http://ec.europa.eu/taxation_customs/vies/checkVatService.wsdl

Is it possible to consume SOAP from Web API ?

I though I had some experience with the service VIES. I can confirm that you can consume SOAP service with C# .NET. I posted the solution on my blog and find on GitHub repository VIESCheckVatService the whole project.

I hope you can help.

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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM