jaspal singh
09/13/2023, 4:26 PMLee Turner
09/13/2023, 5:34 PM<Getlocation>
<searchdetails>
<Search>
<City>New York</City>
<countrycode>xx</countrycode>
</Search>
</searchdetails>
</Getlocation>
You can then use that with a mapping like this to match the request:
{
"priority": 1,
"request": {
"method": "GET",
"urlPath": "/send-me",
"bodyPatterns": [
{
"matchesXPath": "/Getlocation/searchdetails/Search/City[. = \"New York\"]"
}
]
},
"response": {
"status": 200
}
}
I haven’t added the namespace definition in there but hopefully the above will get you startedCity
or countrycode
like in your example you could do something like this:
"matchesXPath": "/Getlocation/searchdetails/Search[City/text() = \"New York\" or countrycode/text() = \"xx\"]"
jaspal singh
09/13/2023, 5:46 PMLee Turner
09/15/2023, 6:09 PMjaspal singh
09/15/2023, 6:21 PMLee Turner
09/15/2023, 6:29 PM{
"request": {
"method": "GET",
"url": "/send-file",
"bodyPatterns": [
{
"matchesXPath": "//SearchCriteria[City/text() = \"Boston\" or Countrycode/text() =\"US\"]"
}
]
},
"response": {
"status": 200,
"headers": {
"Content-Type": "text/xml;charset=UTF-8"
},
"body": "<Abody>"
}
}
With this request payload and it seems to work:
<GetLocationRequestRequest xmlns="<http://urlpath.org>">
<SearchLocationDetails>
<SearchCriteria>
<City>Boston</City>
<Countrycode>US</Countrycode>
<StateProvice>MA</StateProvice>
</SearchCriteria>
</SearchLocationDetails>
</GetLocationRequestRequest>
I don’t think you need the xPathnamespaces
in your mapping file.jaspal singh
09/15/2023, 6:45 PMLee Turner
09/15/2023, 6:58 PMjaspal singh
09/15/2023, 6:58 PMLee Turner
09/15/2023, 7:12 PM