How can I (from SalesOrderEntity) get the delivery address?

I am using SOAP through Visual Studio 2012 RC with C # to use the Magento API. I did this by adding a service link pointing to a WSDL SOAP file.

Now I am having difficulty delivering the SalesOrderEntity address. This is how I retrieve these objects.

var f = new filters();
f.filter = new associativeEntity[] { 
    new associativeEntity {
        key ="status", 
        value ="processing"
    }
};
var entities = mservice.salesOrderList(mlogin, f);

It works just fine, but when I repeat them and show some of their information, I come across 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 sending address was not 0really set to the correct number (and yes, this is a string for some strange reason, although it always represents a number).

What am I doing wrong here?

+5
source share
1 answer

salesOrderAddressEntity, salesOrderEntity.

var magento = new MagentoService();
var session = magento.login("LOGIN", "APIKEY");

var order = magento.salesOrderInfo(session, "100029631");

var address = order.shipping_address;

Console.WriteLine(address.firstname + " " + address.lastname);
Console.WriteLine(address.street);
Console.WriteLine(address.postcode + " " + address.city);
+5

All Articles