Problem with large XML document received from Web Service
Skeeve
Member Posts: 33
Hi All,
I am retrieving an XML document from a web service (which works fine). The XML doc looks something like this:

In NAV, I am using 'Microsoft XML, v6.0'.DOMDocument to retrieve it and save it to disk. So far so good.
What I have to do, however, is access the various elements within <transaction> to create an order in NAV. I cannot for the live of me make that work. Stuff like "SelectSingleNode" fails. So I tried to somehow read the content (or rather the value) of the <transaction> element into a new DOM in order to be able to navigate and process it. I have tried many ways to do it and it all errors out with "The length of the text exceeds the length of the string buffer" - since NAV (still) is limited to 1024 characters for string variables.
So I did:
which actually works. But then I do this:
or
or
or any combination of the above. It all fails due to the string length limitation.
Any idea how I could solve the problem?
I am retrieving an XML document from a web service (which works fine). The XML doc looks something like this:

In NAV, I am using 'Microsoft XML, v6.0'.DOMDocument to retrieve it and save it to disk. So far so good.
What I have to do, however, is access the various elements within <transaction> to create an order in NAV. I cannot for the live of me make that work. Stuff like "SelectSingleNode" fails. So I tried to somehow read the content (or rather the value) of the <transaction> element into a new DOM in order to be able to navigate and process it. I have tried many ways to do it and it all errors out with "The length of the text exceeds the length of the string buffer" - since NAV (still) is limited to 1024 characters for string variables.
So I did:
Node := XMLDoc.selectSingleNode('Envelope/Body/GetTransactionResponse/transaction');
which actually works. But then I do this:
XMLDoc.load(Node.xml);
or
XMLDoc.loadXML(Node.text);
or
XMLDoc.loadXML(Node.nodeValue);
or any combination of the above. It all fails due to the string length limitation.
Any idea how I could solve the problem?
0
Comments
-
Hello.
You need to use
IXMLDOMText interface works also with attributes.msXmlDomText := XMLDoc.selectSingleNode('Envelope/Body/GetTransactionResponse/transaction');msXmlDomText.substringData(startpos,Length);
Remove the <
Not like this:
msXmlDomText.CREATEINSTREAM(TestStream);
Could you give me a simple example how to read text into a stream?0 -
Maybe a namespace problem.
Try to use a sample xml file from msdn or w3c schools and test your code against this "clean" files. If everything works allright you can get back to the real file.
I know this is the slow way, but you get more insights of the problem.
Btw: Can you get the Text from "GetTransactionResult"?
Hope this helps
Thomas0 -
I was able to convince the client to change the web service so the actual < > signs are sent and to remove the CDATA. With these 2 changes, I am now receiving a well-formed document that I can simply process \:D/0
-
That's great news.0
Categories
- All Categories
- 73 General
- 73 Announcements
- 66.7K Microsoft Dynamics NAV
- 18.7K NAV Three Tier
- 38.4K NAV/Navision Classic Client
- 3.6K Navision Attain
- 2.4K Navision Financials
- 116 Navision DOS
- 851 Navision e-Commerce
- 1K NAV Tips & Tricks
- 772 NAV Dutch speaking only
- 617 NAV Courses, Exams & Certification
- 2K Microsoft Dynamics-Other
- 1.5K Dynamics AX
- 325 Dynamics CRM
- 111 Dynamics GP
- 10 Dynamics SL
- 1.5K Other
- 990 SQL General
- 383 SQL Performance
- 34 SQL Tips & Tricks
- 35 Design Patterns (General & Best Practices)
- 1 Architectural Patterns
- 10 Design Patterns
- 5 Implementation Patterns
- 53 3rd Party Products, Services & Events
- 1.6K General
- 1.1K General Chat
- 1.6K Website
- 83 Testing
- 1.2K Download section
- 23 How Tos section
- 252 Feedback
- 12 NAV TechDays 2013 Sessions
- 13 NAV TechDays 2012 Sessions
