How to extract xml-content from the soap-answer
Rotbaerchi
Member Posts: 8
Hi,
I search for a solution for the following problem.
I consume a webservices via SOAP with the xmlhttprequest ('Microsoft XML, v6.0'.XMLHTTP60). The output, the answer of the webservice, of the responseXML-function is a complete SOAP-Message with the xml-message inside the body.
But, how can I extract this body from the hole SOAP to work with the xml-answer itselfs? I have the problem, that I cannot separate the xml from the soap with the MSXMLDom to have this xml in a node... So it is not possible to get the values of the other nodes...
Does anyone did somethink like that?
Thank´s
Mathias
I search for a solution for the following problem.
I consume a webservices via SOAP with the xmlhttprequest ('Microsoft XML, v6.0'.XMLHTTP60). The output, the answer of the webservice, of the responseXML-function is a complete SOAP-Message with the xml-message inside the body.
But, how can I extract this body from the hole SOAP to work with the xml-answer itselfs? I have the problem, that I cannot separate the xml from the soap with the MSXMLDom to have this xml in a node... So it is not possible to get the values of the other nodes...
Does anyone did somethink like that?
Thank´s
Mathias
0
Comments
-
I'm doing something similar... using the soaprequest to send the message, but i'm having the same problem of trying to use the results that are wrapped in the soap response.
Here is what i'm trying:XmlDoc.load(SoapHttpconn.OutputStream); CurrNode := XmlDoc.selectSingleNode('//GetOrdResponse/GetOrdResult'); XmlDoc2.loadXML(CurrNode.text);
In my case the result from the webservice is a full xml document, and when i try to call the [CurrNode.text] I get the error 'The length of the string exceeds the size of the string buffer.'
And as I just found that this error can be solved using this http://www.mibuso.com/forum/viewtopic.php?t=13161
This should work for you as it does for me.
/dog0 -
Yes, the node.text has a max. length about 250 signs, I think...
The answers from the webservices are much longer...
I hoped, that there is a possibility like a function in the msxmldom, which can separate the content from the soap-information automaticly, as you tried it.
Otherwise it has do be possible to get the node <content>xml-message</content> within the xml-data. And here I have the problem, that there is a namespace prefix for the hole document like:
<nsprefix:nodename>
So you have do call the function selectsinglenode with a prefix to get the node like:
xmldomnode1 := xmldomenode.selectsinglenode('nodename'), but right is something like that
xmldomnode1 := xmldomenode.selectsinglenode('prefix:nodename'), but this doesn´t work too, because of the missing prefix. So I tried to set a prefix to the xmldomdoc, from which the node is a child with:
XMLDomDoc.setProperty('',''); but this doesn´t work too...
Any ideas?
Thank´s
Mathias0 -
Have you tried using the Load method (as opposed to the LoadXML method)? You should be able to load a node object into another DOM object.0
-
Yes, I did, but this method returns also a string. And this is to long to work with it, like the currnode.text...
Mathias...0 -
Rotbaerchi. The 250 char limit is a horrible horrrible limitation of navision. They haven't fixed for years. Two solutions.
Write a wrapper dll file.
Write the xml doc into file and read the file.
xmldom.save('c:\temp.xml');0 -
here's a thought.. try loading the value into an instream, save that to a BLOB field, then load it into an outstream and use the Load method of the MSDOM object. I have no idea if it'll work, but it's worth a shot..0
-
Navision Streams are not compatible with xmldom streams. So it won't compile.0
-
Thanks to all,
that are good ideas, and I tried all these before, but nothing works correct. Interesting is the "saving to file" - method. If you save the domdoc.element to a file and this as the textformat, than you are able to get the content from the soap. With the saving and the loading into the domdoc after that, it is possible to read the content and this as literal, and it works for short texts, but not for documents ...
But this is not a solution for the using of a webservice, because the idea is, to go away from the saving and work with the domdoc anytime in the navisionobjects. So I tried the streammethod, which doesn´t work (as ara3n mentioned) because the known problem.
Now I go from node to node to get the content, but at the end I´ll have the encoding problem. Do anyone have a new Idea?
I think that the import is possible, because the "dirty" way
with the saving works...
Mathias0 -
Did you find the solution?Rallnus (Yamaha FJ1200 - '89 / 25th anniversary was great!)0
-
Hi Rotbaerchi,
Not too sure if you still have interest with the matter but you can visit my blog article below:
http://mibuso.com/blogs/mandyk/2009/06/ ... xml-format
In short, I have developed COM wrapper dll to extract and upload big value of XML node to the Stream data type.
Cheers0 -
Hi.Rotbaerchi wrote:Hi,
But, how can I extract this body from the hole SOAP to work with the xml-answer itselfs? I have the problem, that I cannot separate the xml from the soap with the MSXMLDom to have this xml in a node... So it is not possible to get the values of the other nodes...
You should use xmlTextNode to read embedded data.
Look at this How to read XML data where all fields in single string ?, Error while sending URL via HTTP POST using XMLHTTP and this Error When Create & Load MSXML DOM Document. topics.Looking for part-time work.
Nav, T-SQL.0
Categories
- All Categories
- 73 General
- 73 Announcements
- 66.7K Microsoft Dynamics NAV
- 18.8K 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
- 328 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

