Posting in the Magento forums has been disabled pending the implementation of a new and improved forum solution which should better serve the community.

For new questions please post at magento.stackexchange.com, the community-run support site for the Magento community. We will be providing updates on the new forum solution soon. For questions or concerns please email community@magento.com.

Magento Forum

Magento Enterprise API call to catalogProductList() fails in C#
 
yaronl
Jr. Member
 
Total Posts:  1
Joined:  2012-05-14
 

Hi all,
I am trying to make the simplest calls to a Magento Enterprise customer.

I’ve added a Service Reference in VS from the address:
http://www.<customer>.com/api/v2_soap?wsdl=1

I have the following simple c# code:

Mage_Api_Model_Server_V2_HandlerPortTypeClient client = new Mage_Api_Model_Server_V2_HandlerPortTypeClient();
string sessionID client.login(<username>,<key>);
catalogProductEntity[] catalogEntity;
client.salesOrderList(sessionIDnull);       //Success
client.customerCustomerList(sessionIDnull); //Success    
client.catalogProductList(out catalogEntitysessionIDnullnull);//Fails

Thr two first calls run ok.
The problem is with the call to catalogProductList(). I’ve attached the error in a file.
What causing this error ?

Image Attachments
error.JPG
 
Magento Community Magento Community
Magento Community
Magento Community
 
vviorel
Jr. Member
 
Total Posts:  1
Joined:  2013-06-23
 

Here is the code in C# that is working.

You must never pass null references to SOAP methods, because the SOAP serialiser won’t know to get the type of objests.

Mage_Api_Model_Server_Wsi_HandlerPortTypeClient client = new Mage_Api_Model_Server_Wsi_HandlerPortTypeClient();

try
{
string sessionID = client.login("webadmin", “adminkey");
catalogProductEntity[] catalogEntity = new catalogProductEntity[]{};
filters filter = new filters();
client.salesOrderList(sessionID, filter); //Success
client.customerCustomerList(sessionID, filter); //Success
catalogEntity = client.catalogProductList(sessionID, filter, string.Empty);//Success
}
catch (Exception ex)
{
Console.WriteLine(ex.ToString());
}

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