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
Conferences Close Tree View
+ Stylus Studio Feature Requests (1192)
+ Stylus Studio Technical Forum (14621)
+ Website Feedback (249)
+ XSLT Help and Discussion (7625)
- XQuery Help and Discussion (2017)
-> + Issue with Processing Instruct... (2)
-> + problem converting json to XML... (2)
-> + Problem base64 decoding string... (3)
-> + Problems posting multipart for... (5)
-> + trouble with download of price... (2)
-> + Problem with http-post not bei... (3)
-> + path problem, xps_file:writeAl... (9)
-> + Xquery update support? (2)
-> + problem with Stylus studio try... (5)
-> + adding dtd reference to xml ou... (4)
-> + xquery escaping ambarsand when... (3)
-> + Whitespace problem when return... (5)
-> + Problem with namespace prefix ... (5)
-> - Sending via SFTP returns unexp... (1)
-> + Query and Sftp clent (4)
-> + xquery and try - catch (3)
-> + Query + ddtek:http-post optio... (5)
-> + Example files referenced in do... (3)
-> + Automatic Error Detection and ... (3)
-> - Working with result of ddtek:h... (2)
-> ->Working with result of dd...
-- [1-20] [21-40] [41-60] Next
+ Stylus Studio FAQs (159)
+ Stylus Studio Code Samples & Utilities (364)
+ Stylus Studio Announcements (113)
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">
<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"/>
<Soap:Envelope xmlns:Soap="http://schemas.xmlsoap.org/soap/envelope/">
<NAVwebfnct_Result xmlns="urn:microsoft-dynamics-schemas/codeunit/Site_webservice">
<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>

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.

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

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.

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!  

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.