cancel
Showing results for 
Search instead for 
Did you mean: 

Problem when adding customer data using C# application and SSL

Problem when adding customer data using C# application and SSL

Hello

I'm developing C# application for adding customer data to Magento server. When I try to send customer data, I got this error

System.ServiceModel.CommunicationException: 'Unrecognized message version.'

This is my app.config contents:

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
    <system.serviceModel>
        <bindings>
          <basicHttpBinding>
            <binding name="httpBinding" maxReceivedMessageSize="2147483647">
              <security mode="Transport">
                <transport clientCredentialType="None"></transport>
              </security>   
            </binding>
         </basicHttpBinding>
        </bindings>
        <client>
            <endpoint address="https://127.0.0.1/magento/index.php/api/v2_soap?wsdl=1"
                binding="basicHttpBinding" bindingConfiguration="httpBinding"
                contract="MagentoService.PortType" name="Port"/>
        </client>
    </system.serviceModel>
</configuration>

There is another thread suggests I should change my endpoint address from 

https://127.0.0.1/magento/index.php/api/v2_soap?wsdl=1

 

to 

https://127.0.0.1/magento/index.php/api/v2_soap/index

But this gave me another error below:

System.ServiceModel.FaultException: 'SOAP-ERROR: Parsing WSDL: Couldn't load from 'https://127.0.0.1/magento/index.php/api/v2_soap/index/?wsdl=1' : failed to load external entity "https://127.0.0.1/magento/index.php/api/v2_soap/index/?wsdl=1"

For more info, my localhost uses self-signed SSL certificate but in my C# code, I already put these code below to bypass SSL check:

System.Net.ServicePointManager.ServerCertificateValidationCallback = delegate { return true; };

I think it might be something wrong with my app.config but I can provide my C# code if you interested. Thanks for advance.

 

Stackoverflow Thread