【发布时间】:2018-08-27 17:17:44
【问题描述】:
我正在开发用于将客户数据添加到 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>
我想知道它有什么问题。谢谢。
更新 1: 我将端点地址从 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,就像 Mladen Ilić 提到的问题一样。它仍然不起作用并给了我这个错误:
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 中相同的错误。
【问题讨论】:
标签: wcf magento magento-1.9 wcf-binding basichttpbinding