basichttpbinding "SOAP-ERROR: Parsing WSDL: Couldn't load from" error [Magento 1.9.3.3]



我正在开发用于将客户数据添加到Magento服务器的C#应用程序。当我尝试发送客户数据时,我收到此错误

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

这是我app.config内容:

<?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>

我想知道它有什么问题。谢谢。

UPDATE1:我将端点地址从https://127.0.0.1/magento/index.php/api/v2_soap?wsdl=1更改为https://127.0.0.1/magento/index.php/api/v2_soap/index,就像姆拉登·伊利奇提到的问题一样。它仍然不起作用,并给了我这个错误:

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"

更多信息:我的本地主机使用自签名SSL证书,但在我的C#代码中,我已经将这些代码放在下面以绕过SSL检查:

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

我认为我的app.config可能有问题,但如果您有兴趣,我可以提供我的 C# 代码。感谢您的提前。

UPDATE2:我将端点地址更改为 https://localhost.localdomain/magento/index.php/api/v2_soap/index,因此不再需要使用 SSL 绕过。经过几个小时的谷歌搜索,我发现使用/api/v2_soap/index而不是api/v2_soap/index/?wsdl=1是正确的事情。我的问题是我仍然遇到与UPDATE1相同的错误。

我和我的同事已经解决了这个问题。它是由我的测试环境使用自签名 SSL 引起的。

我在回答同事的问题时发布了更多详细信息。请点击以下链接

C# 如何在 HTTPS 中使用 SOAP V2 添加客户数据 (Magento 1.9.3.3(

最新更新