1

I am using Magento EE 2.1.1 version.

While using web service salesOrderRepositoryV1 to get the order details. I'm getting error as below:

System.ServiceModel.ProtocolException was unhandled
  HResult=-2146233087
  Message=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 1024 bytes of the response were: '<?xml version="1.0" encoding="UTF-8"?>
<env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope" xmlns:m="https%3A%2F%2Fint-en.ctv-it.net%2Fsoap%2Fen%3Fservices%3DsalesOrderRepositoryV1%26wsdl%3D1">
   <env:Body>
      <env:Fault>
         <env:Code>
            <env:Value>env:Receiver</env:Value>
         </env:Code>
         <env:Reason>
            <env:Text xml:lang="en">Invalid XML</env:Text>
         </env:Reason>
         <env:Detail><m:GenericFault><m:Trace>&lt;![CDATA[#0 /var/www/magento2-fastest/vendor/magento/module-webapi/Model/Soap/Server.php(121): Magento\Webapi\Model\Soap\Server-&gt;_checkRequest('')
#1 /var/www/magento2-fastest/var/generation/Magento/Webapi/Model/Soap/Server/Proxy.php(95): Magento\Webapi\Model\Soap\Server-&gt;handle()
#2 /var/www/magento2-fastest/vendor/magento/module-webapi/Controller/Soap.php(145): Magento\Webapi\Model\Soap\Server\Proxy-&gt;handle()
#3 /var/www/magento2-fastest/vendor/magento/framework/Interception/Interceptor.php(146): Magento\Webapi\Controller\Soap'.
  Source=mscorlib
  StackTrace:

Below is the C# code:

private void GetSalesorderId()
        {
            var salesOrderRepositoryV1GetRequest = new SalesOrderRepositoryV1GetRequest()
            {
                id = "5066613153"
            };
            var client = new salesOrderRepositoryV1PortTypeClient();
            var response = client.salesOrderRepositoryV1Get(salesOrderRepositoryV1GetRequest);

        }

Code in Web.Config

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
    <startup> 
        <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" />
    </startup>
    <system.serviceModel>
        <bindings>
            <customBinding>
                <binding name="salesOrderRepositoryV1Binding">
                    <textMessageEncoding messageVersion="Soap12" />
                    <httpTransport />
                </binding>
            </customBinding>
        </bindings>
        <client>
            <endpoint address="http://baseurl/soap/ar?services=salesOrderRepositoryV1"
                binding="customBinding" bindingConfiguration="salesOrderRepositoryV1Binding"
                contract="ServiceReference1.salesOrderRepositoryV1PortType"
                name="salesOrderRepositoryV1Port" />
        </client>
    </system.serviceModel>
</configuration>

Please someone help in resolving this. I have tried multiple solutions from forums, but nothing is working for me.

Any help is appreciated?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.