Trying to use Wiremock as a tool for virtualizing SOAP services.
The request mapping criteria looks something like below:-
Mapping Criteria:
{
"request":{
"method":"POST",
"urlPattern":"/myServices/mycontent.asgx",
"headers":{
"SOAPAction":{
"contains":"#SearchMyContent"
}
},
"bodyPatterns":[{
**"matchesXPath":"//data:MyContentItemCode[contains(text(), 'SD_12345')] and //MyContentItemCode[contains(text(), 'SD_22222')]",**
"xPathNamespaces":{
"SOAP-ENV": "http://schemas.xmlsoap.org/soap/envelope/",
"data":"http://www.ins.com/insi/1.0/insi-data",
"msg":"http://www.ins.com/insi/1.0/insi-messaging",
"nc":"http://www.ins.com/insi/1.0/insi-non-compliant",
"soapenv":"http://schemas.xmlsoap.org/soap/envelope/",
"srvc":"http://www.ins.com/insi/1.0/insi-services"
}
}]
},
"response":{
"status":200,
"headers":{
"Content-Type":"text/xml;charset=utf-8"
},
"body":"encoded_XML_body"
}
}
For security reasons, I cannot post the entire SOAP service request here but below is a small snippet from the SOAP service that has to be matched with the xpath in the mapping criteria
<srvc:MyContentItemCodeList>
<data:MyContentItemCode>SD_12345</data:MyContentItemCode>
<data:MyContentItemCode>SD_22222</data:MyContentItemCode>
</srvc:MyContentItemCodeList>
As you can see I am trying to match both the "data:MyContentItemCode" tags in my mapping criteria. However, wiremock doesn't recognize/support this. It could be because the xpath returns a boolean value. My questions is - Is there a way to match on boolean values in Wiremock.
I did not find an example in Wiremock documentation here:- http://wiremock.org/docs/request-matching/
When I post the mappings to the wiremock server, it does get posted successfully but when I try to hit the wiremock server I do not get back my virtualized response(i.e. the request matching isn't considered)
Any help/ pointers on this would be appreciated.