Subject: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. <?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><?xml version="1.0" encoding="utf-8"?><Response><Partner>TEST Products AG TEST</Partner><Process>SET_ORDERS</Process><Message><LineMessage><Cod>01</Cod><Message>You must select an existing item. -- Error: Order not created!</Message></LineMessage></Message></Response></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.