New salesorder from webservice.

gmorkengmorken Member Posts: 38
edited 2012-05-12 in NAV Three Tier
Hello,
I am testing a webservice to insert new salesorder into nav 2009 r2 build 32982
Inserting the order with service.create(ref order) works ok but when I try to set customer no and updates the order with service.update(ref order) I get a null reference exception.
Error from Visual Studio is
"Soapexception was caught" - "Object reference not set to an instance of an object."

Anyone?
        Order.Order_Service service = new Order.Order_Service();
        service.UseDefaultCredentials = true;

        Order.Order order = new Order.Order();
        order.No = "WEB023";

        service.Create(ref order);

        order.Sell_to_Customer_No = "09864534";
       //order.SalesLines = new Order.Sales_Order_Line[5];
        //for (int i = 0; i < 5; i++)
        //    order.SalesLines[i] = new Order.Sales_Order_Line();
        try
        {
            service.Update(ref order);
        }
        catch (Exception ex)
        {
            
        }

Comments

Sign In or Register to comment.