这是我第一次尝试使用Magento api。我正在尝试使用C#.NET连接到我的Magento商店。我正在使用.NET Framework 3.5。使用AddServiceReference我在下面添加了链接。
http://www.MyServer.com/index.php/api/v2_soap?wsdl=1
我还在系统中将 WS-I兼容性 设置为“是” - >配置 - > Magento Core API。
但是当我在我的页面中引用该服务时,我无法生成该服务的对象。我正在寻找“Mage_Api_Model_Server_Wsi_HandlerPortType”对象进行连接。
MyMagentoService。
(在MyMagentoService之后按下。我没有得到任何对象。我不知道为什么。)
当我设置系统 - >配置 - > Magento Core API - > WS-I与NO的兼容性,我能够得到如下对象。
MagentoService.Mage_Api_Model_Server_V2_HandlerPortTypeClient ctx = new Mage_Api_Model_Server_V2_HandlerPortTypeClient();
string sessionID = ctx.login("Username", “Password");
但是ctx.login会抛出错误
The content type text/html 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 361 bytes of the response were: ‘<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
<SOAP-ENV:Body>
<SOAP-ENV:Fault>
<faultcode>0</faultcode>
<faultstring>SOAP extension is not loaded.</faultstring>
</SOAP-ENV:Fault>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>'
对于这个错误,当我谷歌时,我得到答案,因为我需要将WS-I兼容性设置为“是”。我不知道该怎么办。 :(
答案 0 :(得分:2)
我遇到了同样的问题并解决了安装PHP SOAP扩展的问题。
浏览此页:{YOUR_MAGENTO_SHOP_URL} / api / v2_soap
它应该为您提供一个XML文档,解释有关SOAP使用的更多信息。如果您看到消息“0无法在服务器上加载Soap扩展”或“未加载0 SOAP扩展”,则Web服务器中缺少SOAP支持。
此处有更多信息:https://storeya.zendesk.com/entries/20405542-Api-Error-0-SOAP-extension-is-not-loaded