-1

I have a B1IF package which call a webservice to export some data from B1

When I call this webservices I get an XML as response, but I can't read it.

This is what I get from the webservice

<Payload Role="C" id="atom24" statusNo="0" statusMsg="success" reference="atom25" payload="atom25" calltype="solicit response (call/reply)" adapter="WSAS">
<http.header>
<http.header.info id="Cache-Control" value="private, max-age=0"/>
<http.header.info id="X-Content-Type-Options" value="nosniff"/>
<http.header.info id="x-frame-options" value="sameorigin"/>
<http.header.info id="Content-Length" value="367"/>
<http.header.info id="X-XSS-Protections" value="1"/>
<http.header.info id="Date" value="Thu, 03 Dec 2020 17:20:50 GMT"/>
<http.header.info id="Content-Type" value="text/xml; charset=utf-8"/>
</http.header>
<LoadXmlResponse>
<LoadXmlResult><error></error></LoadXmlResult>
</LoadXmlResponse>
</Payload>

XML RESPONSE:
XML RESPONSE

I'd like to test the response in a "path" atom PATH ATOM:
PATH ATOM

I can't find the correct xpath expression to read the from the XML response.

I tried these:

/*[/vpf:Msg/vpf:Body/vpf:Payload[@Role='C' and @id='atom24']/LoadXmlResponse/LoadXmlResult/error='']

/*[/vpf:Msg/vpf:Body/vpf:Payload[@Role='C' and @id='atom24']/LoadXmlResponse/LoadXmlResult='<error></error>']

/*[/vpf:Msg/vpf:Body/vpf:Payload[@Role='C' and @id='atom24']/@statusMsg="success"]

But without success.

Dharman
  • 30,962
  • 25
  • 85
  • 135

2 Answers2

0

Your XPath attempts show Msg and Body XML elements. They are missing in the provided input XML. Same about namespaces.

In any case, here is Working XPath expressions for the input XML.

/Payload/@calltype

/Payload/http.header/http.header.info[@id="Date"]

/Payload/LoadXmlResponse/LoadXmlResult
Yitzhak Khabinsky
  • 18,471
  • 2
  • 15
  • 21
0

Try using

[./@Role=&apos;C&apos; and ./@Id=&apos;atom24&apos;]/LoadXmlResponse/LoadXmlResult/error

I'm not sure if you need to use a special namespace before every tag you want (like we need jdbc: before every tag in sql result)

If it doesn't work you can use another xslt atom there you can put

<xsl:copy-of select="/vpf:Msg/vpf:Body/vpf:Payload[./@Role=&apos;C&apos; and ./@Id=&apos;atom24&apos;]/*"></xsl:copy-of>

It will give you all the content in a simple xml file from there you will able to retrieve the information by using tagName/tagName... with out a special namespace.