Hello , I want to extract values from xml, but i a...
# help
s
Hello , I want to extract values from xml, but i am getting error . How do i go about it
Copy code
[ERROR] 1:3: could not find helper: 'xpath'
{{{xpath request.body '/request/outter/inner/@id'}}}
The xml:
Copy code
<?xml version="1.0"?>
<request>
    <outter>
        <inner id="2343"> stuff</inner>
    </outter>
</request>
The mapping -
Copy code
{
  "request": {
    "method": "POST",
    "urlPattern": "/dummy122",
    "headers": {
      "Content-Type": {
        "equalTo": "application/xml"
      }
    }
  },
  "response": {
    "status": 200,
    "headers": {
      "Content-Type": "application/xml"
    },
    "transformers": [
      "response-template"
    ],
    "body": "{{{xpath request.body '/request/outter/inner/@id'}}}"
  }
}
I've searched a lot , i am using version
3.5.3
. Is there any configuration that i need to enable to use xpath?
l
The xPath helper has a capital P. In your example it is all lowercase https://wiremock.org/docs/response-templating/#xpath-helpers
🙌 1
s
Thank-you @Lee Turner. This resolves my issue. Did not realise the typo.
👍 1