2

I am using string operations on xpath and getting is not a valid xPath expression.

{{#assign 'promoCode'}}{{xPath request.body "//*[substring-after(local-name()='commonOrderId','ABC')]"}}{{/assign}}

{{#assign 'promoCode'}}{{xPath request.body "substring-after(//*[local-name()='commonOrderId'],'ABC')"}}{{/assign}}

tried string operation also, none of these(substring, substring-after) worked.

Took reference of XPath wildcards on node name, still no luck.

substring-after is working fine when I am validating it on any xpath tester, however, it's not working with wiremock, I am running with standalone process 2.23.2 When I looked into wiremock logs I saw Caused by: com.sun.org.apache.xpath.internal.XPathException: Can not convert #STRING to a NodeList!. Following is the sample request xml:

<osn:OrderId>
               <osn:commonOrderId>ABC3534534345435</osn:commonOrderId>
            </osn:OrderId>

Thanks in advance.

Aplesh Rana
  • 173
  • 1
  • 1
  • 10

0 Answers0