XML Editor
Sign up for a WebBoard account Sign Up Keyword Search Search More Options... Options
Chat Rooms Chat Help Help News News Log in to WebBoard Log in Not Logged in
Show tree view Topic
Go to previous topicPrev TopicGo to next topicNext Topic
Postnext
Bruce CantorSubject: Working with result of ddtek:http-post
Author: Bruce Cantor
Date: 28 Jan 2021 12:42 PM
Originally Posted: 28 Jan 2021 11:43 AM
Hi Forum

In Stylus Studio I have made a xquery file that calls a webservice. The service returns a soap response with two different tags I would like to work with, one <outXML> holds the answer from the service if things go right. The other holds the resulting error if things go wrong <raspunsProces>. Both elements hold data in what I would call escaped XML e.g. &lt;?xml version="1.0" encoding....

Like this:
<?xml version="1.0" encoding="utf-8"?>
<response http-version="HTTP/1.1" reason="OK" status-code="200">
<response-header>
<header name="Server" value="Microsoft-HTTPAPI/2.0"/>
<header name="Content-Length" value="612"/>
<header name="Date" value="Tue, 01 Sep 2020 06:43:57 GMT"/>
<header name="Content-Type" value="text/xml; charset=utf-8"/>
</response-header>
<response-body>
<Soap:Envelope xmlns:Soap="http://schemas.xmlsoap.org/soap/envelope/">
<Soap:Body>
<NAVwebfnct_Result xmlns="urn:microsoft-dynamics-schemas/codeunit/Site_webservice">
<outXml/>
<raspunsProces>&lt;?xml version="1.0" encoding="utf-8"?&gt;&lt;Response&gt;&lt;Partner&gt;TEST Products AG TEST&lt;/Partner&gt;&lt;Process&gt;SET_ORDERS&lt;/Process&gt;&lt;Message&gt;&lt;LineMessage&gt;&lt;Cod&gt;01&lt;/Cod&gt;&lt;Message&gt;You must select an existing item. -- Error: Order not created!&lt;/Message&gt;&lt;/LineMessage&gt;&lt;/Message&gt;&lt;/Response&gt;</raspunsProces>
</NAVwebfnct_Result>
</Soap:Body>
</Soap:Envelope>
</response-body>
</response>

I need to extract the XML from the result of the webservice call, how do I do that?
The result then needs to be merged with data from the original data and put into a result document.

I call like this ddtek:http-post($url, $soapRequest, $RequestOptions)

Can I assign the result to a variable? Sorry still new to xquery. :-)

EDIT: just to be precise, problem is I get escaped xml from the result and cannot work with it.

Any suggestions much appreciated.

Posttop
Bruce CantorSubject: Working with result of ddtek:http-post
Author: Bruce Cantor
Date: 28 Jan 2021 01:03 PM
Found a solution:

ddtek:parse(
ddtek:http-post($url, $soapRequest, $RequestOptions)//response/response-body/Soap:Envelope/Soap:Body/ns1:NAVwebfnct_Result/ns1:raspunsProces/text()
)

The parse function could parse the text into valid xml and I can now work with the elements from the result.

 
Go to previous topicPrev TopicGo to next topicNext Topic
Download A Free Trial of Stylus Studio 6 XML Professional Edition Today! Powered by Stylus Studio, the world's leading XML IDE for XML, XSLT, XQuery, XML Schema, DTD, XPath, WSDL, XHTML, SQL/XML, and XML Mapping!  
go

Log In Options

Site Map | Privacy Policy | Terms of Use | Trademarks
Stylus Scoop XML Newsletter:
W3C Member
Stylus Studio® and DataDirect XQuery ™are from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2016 All Rights Reserved.