mirror of
https://github.com/wiremock/WireMock.Net.git
synced 2026-01-11 14:20:29 +01:00
Not able to match XML request body using XPathMatcher pattern #161
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @arpymastro on GitHub (Dec 20, 2018).
I want to create a mock server for SOAP service which accepts XML request body. I'm using XPathMatcher for request matching but it is always showing
"No matching found".My request body -
I am using below json for request matching -
@StefH commented on GitHub (Dec 20, 2018):
I think it should be
"Pattern": "//getMyData"Not possible.
@arpymastro commented on GitHub (Dec 20, 2018):
@StefH
"Pattern": "//getMyData"not working for me :(@StefH commented on GitHub (Dec 20, 2018):
Try
/s:Envelope/s:Body/*[local-name()='getMyData']See also https://stackoverflow.com/questions/31167803/what-is-the-xpath-of-an-element-in-a-different-default-namespace
@arpymastro commented on GitHub (Dec 21, 2018):
@StefH
Tried all below combinations but still no luck -
/s:Envelope/s:Body/*[local-name()='getMyData']/s:Envelope[@xmlns:s=\"http://schemas.xmlsoap.org/soap/envelope/\"]/s:Body/getMyData[@xmlns=\"https://www.google.com/apis/ads/publisher/v201811\"]//s:Envelope/s:Body/*[local-name()='getMyData']//s:Envelope[@xmlns:s=\"http://schemas.xmlsoap.org/soap/envelope/\"]/s:Body/getMyData[@xmlns=\"https://www.google.com/apis/ads/publisher/v201811\"]@StefH commented on GitHub (Dec 21, 2018):
I did test this:
The console logging displays:
@arpymastro commented on GitHub (Dec 21, 2018):
@StefH
Thank you!
Can you point me to a article/tutorial/utility where I can learn to extract XPath from XML? I might need to create complex pattern for my requirement
@StefH commented on GitHub (Dec 21, 2018):
Sorry I don't know any tutorials. Mostly I search the internet and stackoverflow.
But there are some online xpath validators which you can use to verify your request xml.