Web Service - Reading data with XMLPort?

martinjordtmartinjordt Member Posts: 18
edited 2011-03-21 in NAV Three Tier
Hi all,

I’m trying to create a very simple Web Service using an XML port to retrieve a customer list. I can find loads of examples for writing data to NAV using XML ports, but not so many when it comes to reading data from NAV.

I think my problem is the C# code as I don’t have much experience with C# (yet).
Can anyone help me out - or perhaps point me in the direction of an example elsewhere?!

My C# code and XMLPort is attached below.

Cheers
Martin

Comments

  • martinjordtmartinjordt Member Posts: 18
    Sorry to have bothered you guys - just came up with the answer myself :-)

    GetCustomer CustomerRoot = new GetCustomer();
    CustXMLPortWS2.TestCustXMLPort(ref CustomerRoot);
    // List<Customer> Cust = new List<Customer>();
    foreach (Customer c in CustomerRoot.Customer)
    {
    Console.WriteLine("Customer Name: {0}", c.Name);
    }

    And no need to create a new collection either...

    Best regards
    Martin
Sign In or Register to comment.