I've been trying to create a stub system for a SOAP service using wiremock standalone. I've got the response.xml s ready and I'm required to return them based on an id value in the SOAP request xml. For example, Soap Request:
<?xml version="1.0" encoding="UTF-8"?>
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<AddressType>
<addressId>Q1004DB</addressId>
</AddressType>
</soap:Body>
</soap:Envelope>
As I mentioned before, I have response xmls set for each of the address Ids. In this case, I've got a response xml named Q1004DB.xml which should be returned as response of this request. So I'm trying to figure out a logic to be put in place which will enable me to do this.
It would be great if someone can help me with how I can implement a logic in wiremock standalone where I can return a response based on the values in the input request xml. Thanks in advance !
As a first step, I tried returning the addressId as the response. I followed a couple of answers from StackOverflow and saw this format but this doesn't seem to work. Can someone please tell what might be wrong here ?
{
"request": {
"url": "/ws/AddressSoapService",
"method": "POST"
},
"response": {
"body": "{{$.addressType.addressId}}",
"headers": {
"Server": "Microsoft-IIS/8.0",
"Connection": "Keep-Alive",
"Web-Service": "DataFlex 18.1",
"Access-Control-Allow-Headers": "content-type",
"Date": "Tue, 26 Jun 2018 07:45:47 GMT",
"Strict-Transport-Security": "max-age=31536000",
"Cache-Control": "private, max-age=0",
"Content-Type": "application/soap+xml; charset=utf-8"
}
}
}