Moving NAV Web Service Code from COM to .NET (using System.Xml in C/AL)

I have a NAV Web Service running on NAV2009R2 using Automation Controls to read the XMLs received.

This service is now going to be transferred to NAV2015 and therefore the COM variables must be changed to .NET variables.

I have managed to do this, but I have a problem reading through a loop of nodes in the XML file.

The file looks like this (simplified example):

Using COM variables we loop through the orderlines using code like this:


please re-add the images. they are not visible.

You are having 2 options:

Create an XMLPort which reflects the stucture of your received XMLDoc and let it process the document for you, or you iterate through the node list

FOR I := 0 TO XMLNodeList.Count-1 DO BEGIN
XmlNode := XmlNodeList.Item(I);
.... // Do something with the XmlNode