Magento Forum

   
Cannot generate object of MagentoService in .NET
 
akhoje
Jr. Member
 
Total Posts:  1
Joined:  2013-10-22
 

Hi,

This is my first attempt to use Magento. I am trying to connect to my Magento Store using C#.NET. I am using .NET Framework 3.5.
Now the AddServiceReference is already added with 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.

Here is my code

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using MyMagentoService;

namespace Magento_eBay_Console
{
class Program
{
static void Main(string[] args)
{
}

public static void Test()
{
MyMagentoService.  (When pressing . after MyMagentoService, I don’t get any object. I don’t know why.)
}
}
}

Update: 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();
ctx.login("Username", “Password");

But hte 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>’.

Image Attachments
MagentoService.png
 
Magento Community Magento Community
Magento Community
Magento Community
 
sanmic
Member
 
Total Posts:  54
Joined:  2009-12-26
 

Did you ever solve this?

We have had this running until we installed Varnish on our server, after that we cannot connect via SOAP from C# =/

 
Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
    Back to top