I’m trying to set up a postman mock server that has an XML response body and request body and I’m having trouble pulling a value from the request into the response when it comes to doing it with XML. I’ve been able to pull $body
fine when using JSON and using XML I’m able to pull $headers
fine. Here is what I’ve tried setting up with both my request and response.
Request:
<Root>
<Record>
<LeaseNumber>7898561</LeaseNumber>
</Record>
</Root>
Response
<Response>
<Lease>
<LN>{{$body 'Root.Record.LeaseNumber'}}</LN>
</Lease>
</Response>
Then when I hit the mock server I just get back exactly what I put in. Like this
<Response>
<Lease>
<LN>{{$body 'Root.Record.LeaseNumber'}}</LN>
</Lease>
</Response>
A few other things I’ve tried:
<LN>{{$body '/Root/Record/LeaseNumber'}}</LN>
<LN>{{$body 'Root[0].Record[0].LeaseNumber[0]'}}</LN>
<LN>{{$body 'Root.Record.LeaseNumber.0'}}</LN>
<LN>{{$body 'Root/Record/LeaseNumber/text()'}}</LN>
<LN>{{$body 'Root\.Record\.LeaseNumber'}}</LN>
<LN>{{$body}}</LN>
and all these attempts just output the same value that was put into the mock server response. But for some reason using {{$headers}} works.
The main question is just how to pull the body in a postman mock server using XML. Thanks!