question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

XPath with namespace in request variable usage is not supported

See original GitHub issue

Last time, you explain how to get the internal variable, but didn’t work. I am going to put the original response and where the token lays.

<!-- HTTP/1.1 200 OK
SOAPAction: ""
X-Frame-Options: SAMEORIGIN
Referrer-Policy: origin-when-cross-origin
Strict-Transport-Security: max-age=31536000
X-Content-Type-Options: nosniff
Content-Security-Policy: default-src * 'unsafe-inline' 'unsafe-eval'; script-src * 'unsafe-inline' 'unsafe-eval'; connect-src * 'unsafe-inline'; img-src * data: blob: 'unsafe-inline'; frame-src *; style-src * 'unsafe-inline';
X-XSS-Protection: 1; mode=block
Content-Type: text/xml;charset=utf-8
Content-Length: 732
Date: Fri, 24 Jan 2020 18:04:10 GMT
Server: SWS
Connection: close
Vary: Accept-Encoding
Content-Encoding: gzip -->

<!-- <?xml version="1.0" encoding="UTF-8"?> -->
<soap-env:Envelope xmlns:soap-env="http://schemas.xmlsoap.org/soap/envelope/">
    <soap-env:Header>
        <eb:MessageHeader xmlns:eb="http://www.ebxml.org/namespaces/messageHeader" eb:version="1.0" soap-env:mustUnderstand="1">
            <eb:From>
                <eb:PartyId eb:type="URI">SWS</eb:PartyId>
            </eb:From>
            <eb:To>
                <eb:PartyId eb:type="URI">Client</eb:PartyId>
            </eb:To>
            <eb:CPAId>BBAA</eb:CPAId>
            <eb:ConversationId>SWS</eb:ConversationId>
            <eb:Service eb:type="xxxxxXML">Session</eb:Service>
            <eb:Action>SessionCreateRS</eb:Action>
            <eb:MessageData>
                <eb:MessageId>6203700650503870194</eb:MessageId>
                <eb:Timestamp>2020-01-24T18:04:10</eb:Timestamp>
                <eb:RefToMessageId>1234</eb:RefToMessageId>
            </eb:MessageData>
        </eb:MessageHeader>
        <wsse:Security xmlns:wsse="http://schemas.xmlsoap.org/ws/2002/12/secext">
            <wsse:BinarySecurityToken valueType="String" EncodingType="wsse:Base64Binary">000012552225ASDASD465411</wsse:BinarySecurityToken>
        </wsse:Security>
    </soap-env:Header>
    <soap-env:Body>
        <SessionCreateRS xmlns="http://www.opentravel.org/OTA/2002/11" version="1" status="Approved">
            <ConversationId>SWS</ConversationId>
        </SessionCreateRS>
    </soap-env:Body>
</soap-env:Envelope>

Reference Incorrect request variable reference syntax, it should be “variableName.(response|request).(headers|body).(headerName|JSONPath|XPath|*)”

Using a Xpath tool to get the variable //soap-env:Envelope/soap-env:Header/wsse:Security/wsse:BinarySecurityToken

## @name SessionCreateRQ

@token = {{SessionCreateRQ.response.body.//soap-env:Envelope/soap-env:Header/wsse:Security/wsse:BinarySecurityToken}}

returns: Invalid XPath query

Please any help I’ll appreciate.

Thanks in advance.

Best regards

Yitzhak

Issue Analytics

  • State:open
  • Created 4 years ago
  • Reactions:2
  • Comments:8 (2 by maintainers)

github_iconTop GitHub Comments

4reactions
ZefQcommented, Feb 13, 2020

Maybe you can try something like this. @token = {{SessionCreateRQ.response.body./*[local-name()='Envelope']/*[local-name()='Header']/*[local-name()='Security']//*[local-name()='BinarySecurityToken']}} Found this one that helped me at least https://stackoverflow.com/a/5239991

2reactions
Huachaocommented, Feb 14, 2020

@Stadly sure, I will leave this issue open

Read more comments on GitHub >

github_iconTop Results From Across the Web

Problem running xpath query with namespaces - Stack Overflow
I want to use the following xpath expression: /Msg[count('OrderStatus')[ 0]. but this won't work since I get an error message saying: ...
Read more >
Solved: Problem with XPath - Google Cloud Community
I'm trying to use XPath to extract some values from an XML Response Payload. I have validated the XPath elsewhere, but for some...
Read more >
XQuery, XSLT, and XPath Error Codes Namespace Document
A stylesheet parameter is visible if it is not masked by another global ... use of xsl:evaluate has been statically or dynamically disabled....
Read more >
Variables Do Not Return Values Resulting in Empty Body
Xpath With Namespace Declaration in a SoapEnv:Body is Failing - Variables ... When requesting proxy service from Testing Console with "SOAP ...
Read more >
XPath Queries and Namespaces | Microsoft Learn
XPath queries are aware of namespaces in an XML document and can use namespace prefixes to qualify element and attribute names. Qualifying ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found