4
votes

Description

Unable to match a simple Soap body with x-mock-match-request-body.

To Reproduce

Steps to reproduce the behavior:

  1. Create an example for a mock server with any url, any http verb and any response
    • e.g. POST {{url}}/test with the response:
    {
        "test":"test"
    }
  1. Add the following request body in the example:
    <soap:Envelope>
    </soap:Envelope>
  1. Create a request pointed at the example url with the same body as the example body
  2. Send the request
  3. Add the header x-mock-match-request-body and give the value true
  4. Send the request

Expected behavior

Step 4 is expected to return the example response as the body is not matched and the http verb and url path is correct - this works as expected

Step 6 is expected to return the example response as the body is the same as specified in the example and the http verb and url path is correct - this does NOT work as expected

Screenshots

Mock example: image Mock example headers and response: image

Request with body matching: image Headers and response: image

Headers and response without body matching: image

  • App Type [Native App]

  • Postman Version [7.24.0]

  • OS: [Windows 10 Enterprise]

I am able to match a JSON-body without issue. Has anyone experienced this when using SOAP?

1
In your images the Examples count is 0 - Where are you adding this example? I don't really understand what it is you're trying to achieve - You're mixing XML and JSON in the same request.Danny Dainton
The example is in another request in the same collection. That is no issue. All I want is to match a Soap body. Yes you are certainly correct that the return type is JSON, however that is not relevant.owninggreendragsdude

1 Answers

0
votes

I added the header Content-type: Application/xml to both the example and the request and it worked.