using entire request body content for xpath correation
Hello,
I am trying to use entire request body for xpath corration using the xpath expression:
/root = 'req body'
however, when sending actual requests, the responder is not matching. How do i make sure that despite variations in the request body in terms of lines or empty spaces, the responder matches based only on the structure and values of the json or xml body. THank you.
Answers
-
Hi,
Are you saying you want to check that all values in the incoming request match? If you are looking for exact matches on entire messages then the Files Responder might be a better option since you can specify the exact request in a file paired with a response and all values in the incoming request will need to match the defined request.
0 -
Hi William, I would like to use the entire request body (json or xml ) for request body correlation instead of values of individual elements. response will be matched if the request sent matches with that used in the xpath correlation. i used the xpath experssion /root = 'req body' but is not working when same req body is sent. THis is in the context of REST calls. In addtion to the request body, the request path and method are also checked.
0 -
Hi,
If the issue is whitespace differences then that xpath would not normalize that. Since you want exact request matching I recommend looking at the Files Responder since it performs exact request matching and does have internal handling to do some whitespace normalization.
0 -
thanks again. can the File Responder be used in the context of REST calls with request method and path?
0 -
Yes, it will match on request method and path. It can do exact path matching or have wild card matching if needed.
0 -
ok, thanks.
0 -
sorry one last question: is this feature exposed via the REST APIs ?
0 -
No, the Files Responder does not have REST APIs.
0 -
since i would like to use REST API, i have resorted to the custom message responder correlation in which i can add a code to compare if two contents are same or not after parsing them into json or xml. Thanks for your help.
0