XMLPort export problem

marvinqmarvinq Member Posts: 69
Hi experts,

I am having a problem handling a XMLPort published as a Webservice via a Codeunit. Actually it works just fine, but I want to "log" the input XML but it doesn't work 100% correctly if there is an unbound element in the XMLPort. If there is an unbound element only the last occurrence is saved in the "log" file.

Code is quite simple...

XMLOutputFile File
OStream OutStream

ImportXML(VAR XMLImport : XMLport XMLImport)



Also see attached screendumps:
  • Codeunit ("Codeunit_90000.PNG").
  • XMLPort ("XMLPort_90000.PNG").
  • XMLPort properties ("XMLPort_90000_Properties.PNG").

All elements in XMLPort are set to "MinOccurs=Once" and "MaxOccurs=Once" except the element "Item" which has "MaxOccurs=Unbounded", so that OrderLines is a set of "Item" elements and exactly one "Freight" element.

I created objects as mentioned above and exposed Codeunit 90000 via page 810 as servicename "XMLImport". Then I called Webservice from a Visual Studio console application. Please see: "WS_TestApplication.PNG".

In my Visual Studio input example there is clearly 3 items, and when running code all 3 items are received and handled within NAV. However when saving to file "output.xml" it only shows the last item. See attached: "output_xml.PNG"

Everything works fine except when there are more items in the input XML (unbound size).

Really hope anyone has an idea of how to fix this issue so I can see all items in output.xml. I've been struggling with this for a while now. Currently i am stuck.

Sign In or Register to comment.