cancel
Showing results for 
Search instead for 
Did you mean: 

SOAP Response Wrong Content Type

SOAP Response Wrong Content Type

Hello,

 

I am having an issue with a SOAP call. I am trying to communicate with a local instance of Magento 2.0.5. I am trying to pull back a list of product data from my Magento 2 Website. Unfortunately I am getting an exception for which I am unable to find a solution.

 

Development is in C# and I have created a Service Reference in Visual Studio directed towards the list of Services I intend to use. 

 

public void GetProductList()
        {

            try
            {
                catalogProductRepositoryV1PortTypeClient client = new catalogProductRepositoryV1PortTypeClient();
                CatalogProductRepositoryV1GetListRequest r = new CatalogProductRepositoryV1GetListRequest();
                r.searchCriteria = new FrameworkSearchCriteriaInterface();                
                CatalogProductRepositoryV1GetListResponse response = client.catalogProductRepositoryV1GetList(r);
            }
            catch(Exception e)
            {
                Console.WriteLine(e.Message);
                
            }
            Console.In.Read();
        }

When I run this code, the following exception is thrown:

 

{"The content type text/xml; charset=utf-8 of the response message does not match the content type of the binding (application/soap+xml; charset=utf-8). If using a custom encoder, be sure that the IsContentTypeSupported method is implemented properly. The first 1024 bytes of the response were: '<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<SOAP-ENV:Envelope xmlnsSmiley FrustratedOAP-ENV=\"http://schemas.xmlsoap.org/soap/envelope/\"><SOAP-ENV:Body><SOAP-ENV:Fault><faultcode>WSDL</faultcod... Parsing WSDL: Couldn't load from 'http://192.168.1.9/magento/index.php/soap/default?services=backendModuleServiceV1%2CbundleProductLin...

 

 

Does anyone know how to change the content type for soap to match?

 

 

1 REPLY

Re: SOAP Response Wrong Content Type

The content type application/soap+xml; charset=UTF-8 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 434 bytes of the response were: '<?xml version="1.0" encoding="UTF-8"?>
<env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope" >.........

 

I actually have the inverse of your issue - I seem to be sending txt/xml and c# is moaning about a application/soap+xml response....

 

I presume both should be application/soap+xml.