Response Templating_Method not found error
See original GitHub issueI am trying to create a wiremock service where if a request comes in matching say an account number, it will respond with a response of say Success and if another account number, it will respond with a response of Bad request. Unfortunately there are json tag elements in the response that will change depending on the request, e.g in my below example RequestId needs to be the same as that of the request, for the downstream system to accept it,else it will be a duplicate transaction , if I hard code the value Request:
{
"RequestId" : "a43d1856",
....
"Accountnumber": "7654322"
}
Response:
{
"RequestId" : "a43d1856",
"ReasonCode" : "Success"
}
I used JsonPathMatcher to match the account number for the request, but I am finding it difficult to figure out how to substitute the dynamic request id from the incoming request to the response.
I tried:
"Response": {
"StatusCode": 200,
"BodyAsJson": {
"RequestId": "{{JsonPath.SelectToken request.body \"$.RequestId\"}}",
"ReasonCode" : "Success"
},
"UseTransformer": true,
"headers": {
"Content-Type": "application/json"
}
}
When I send a request through soapui matching the request, I get response : Method not found
Can you help me with what I am doing wrong?
Issue Analytics
- State:
- Created 3 years ago
- Comments:5
Thanks @StefH it worked! Thank you for your help!
Hello @jthomas2021, is the answer clear to you?