Rahul Agrawal
09/22/2023, 7:57 AM"request" : {
"url" : "/some/operation1",
"method" : "POST"
},
"response" : {
"status" : 200,
"bodyFileName" : "wsdl/2019-12-21_WEP.xml",
"headers" : {
"Content-Type" : "text/xml"
},
"transformers" : [ "response-template" ]
}
Now the need is to extract some xpath values from the in coming soap request body and replace/substitute them in the hard code soap responses at runtime.
Using the soapXPath helpers mentioned in the section https://wiremock.org/docs/response-templating/#xpath-helpers of the documentation,
extraction of the value can be done.
However we are unable to find how to insert those into the soap response .
---we want to dynamically replace certain parts of the hard coded soap response that is in the file wsdl/2019-12-21_WEP.xml
What are the possible ways to do this using wiremock.
Thanks in advance.Tom
09/22/2023, 9:02 AM2019-12-21_WEP.xml
body file, so something like this:
<item>{{{soapXPath request.body '//request-data-item/text()'}}}</item>
Rahul Agrawal
09/22/2023, 9:05 AMjava -jar wiremock-standalone-3.1.0.jar --verbose --local-response-templating
did not work with
java -jar wiremock-standalone-3.1.0.jar --verbose
Also
instead of double // it seems we have to use a single /
<item>{{{soapXPath request.body '/request-data-item/text()'}}}</item>
Once again thank for getting such a prompt response from someone of your level.
👏Tom
09/22/2023, 2:13 PMAbhijeet
09/22/2023, 3:23 PMTom
09/22/2023, 4:08 PMAbhijeet
09/22/2023, 4:29 PM