I’m using SOAP through Visual Studio 2012 RC with C# to use the Magento API. I did this by adding a service reference pointing to the SOAP WSDL file.
Now, I’m having difficulties getting the shipping address of a SalesOrderEntity. Here’s how I retrieve these entities.
var f = new filters();
f.filter = new associativeEntity[] {
new associativeEntity {
key ="status",
value ="processing"
}
};
var entities = mservice.salesOrderList(mlogin, f);
This works just great, but when I iterate through them and display some of their information, I stumble upon something strange.
foreach (var entity in entities)
{
//the following line crashes for some strange reason.
//the error is SoapHeaderException: Address not exists.
var info = mservice.customerAddressInfo(mlogin, int.Parse(entity.shipping_address_id));
Debug.WriteLine(info.firstname);
}
The shipping address is not 0, has indeed been set to a proper number (and yes, it’s a string for some weird reason although it always represents a number).
What am I doing wrong here?
The address is stored in a
salesOrderAddressEntity, which is inside thesalesOrderEntity.