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. :(