1

This is my first attempt to use Magento api. I am trying to connect to my Magento Store using C#.NET. I am using .NET Framework 3.5. Using AddServiceReference I added below link.

http://www.MyServer.com/index.php/api/v2_soap?wsdl=1

I also set WS-I compatibility to “Yes” in System -> Configuration -> Magento Core API.

But when I refer the service in my page, I cannot generate the object of the service. I am looking for “Mage_Api_Model_Server_Wsi_HandlerPortType” object to connect.

MyMagentoService.

(When pressing . after MyMagentoService, I don’t get any object. I don’t know why.)

When I set System -> Configuration -> Magento Core API -> WS-I compatibility to NO, I am able to get the object as below.

MagentoService.Mage_Api_Model_Server_V2_HandlerPortTypeClient ctx = new         Mage_Api_Model_Server_V2_HandlerPortTypeClient(); 
string sessionID = ctx.login("Username", “Password");

But then ctx.login throws an error

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

For this error, when I google, I get answer as I need to set the WS-I compatibility to "YES". I don't know what to do. :(

Ams
  • 13
  • 6
  • I just found some relative answers at below locations. http://stackoverflow.com/questions/14288247/magento-api-not-working-with-wsdl-exe-but-works-with-soap-ui http://stackoverflow.com/questions/12250037/generate-a-web-service-client-in-ws-i-compliance-mode AND THIS: http://esync.de/magento-wsdl-defect-catalogProductAttributeRemoveResponse According to these links, apparently app\code\core\Mage\Catalog\etc\wsi.xml this file needs to change. But I didn't get the corrections clearly. Also the file shared in one of the locations is not downloadable. – Ams Oct 23 '13 at 01:21

1 Answers1

2

I had the same problem and resolved installing the PHP SOAP extension.

Browse to this page: {YOUR_MAGENTO_SHOP_URL}/api/v2_soap

It should give you an XML-document explaining more about the usage of SOAP. If you see the message "0 Unable to load Soap extension on the server" or "0 SOAP extension is not loaded", SOAP support is missing from the Webserver.

More info here: https://storeya.zendesk.com/entries/20405542-Api-Error-0-SOAP-extension-is-not-loaded

ctaverna
  • 46
  • 6