1

I wrote a program. It is my first program to access to the API when I am done and compiled it, it says the following error in

Error 1 Cannot implicitly convert type 'SOAPTesting.ServiceReference2.salesOrderListEntity[]' to 'SOAPTesting.ServiceReference2.salesOrderEntity[]' G:\VISUAL STUDIO 2013 PROJECT WORKSPACE\HarshiniPROJECT\SOAPTesting\SOAPTesting\Program.cs 29 38 SOAPTesting

So how to fix this error here is my program,

static void Main(string[] args)
    {
        Mage_Api_Model_Server_V2_HandlerPortTypeClient mservice = new Mage_Api_Model_Server_V2_HandlerPortTypeClient();
        string mlogin = mservice.login("dileepa", "takastakas");

        Debug.WriteLine(mlogin);
        filters mf = new filters();
        complexFilter[] cpf = new complexFilter[1];
        complexFilter mcpf = new complexFilter();
        mcpf.key = "increment_id";
        associativeEntity mas = new associativeEntity();
        mas.key = "gt";
        mas.value = "1008001";
        mcpf.value = mas;
        cpf[0] = mcpf;
        mf.complex_filter = cpf;
        salesOrderEntity[] soe = mservice.salesOrderList(mlogin, mf);
        if (soe.Length > 0)
        {

            foreach (salesOrderEntity msoe in soe)
            {
                try
                {
                    Debug.WriteLine("" + msoe.billing_firstname + " " + msoe.subtotal);
                }
                catch (Exception merror)
                {
                  Console.WriteLine("" + msoe.order_id + "" + merror.ToString());
                }
            }
        }



        Console.ReadLine();

    }
0

I think the problem is not with Magento, but it's with your code.
salesOrderList returns an array of objects with type salesOrderListEntity but you declared it as an array of salesOrderEntity.

Change this line

salesOrderEntity[] soe = mservice.salesOrderList(mlogin, mf);

to this:

salesOrderListEntity[] soe = mservice.salesOrderList(mlogin, mf);

You may also need to change

foreach (salesOrderEntity msoe in soe)

to

foreach (salesOrderListEntity msoe in soe)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.