mirror of
https://github.com/wiremock/WireMock.Net.git
synced 2026-01-11 21:10:32 +01:00
Trying to use attribute of the request object while creating response while mocking a soap service #351
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 @msutar021 on GitHub (Jul 9, 2021).
I want to create a mock response for SOAP service which accepts XML request . I'm using XPathMatcher for request matching. Request is matching is done successfully. I need to read one attribute of request.body and create the response using that.
My XML request is like this. I need the token id to create the response body.
Request.txt
I am using the below matcher models while creating mapping for the request.
And response model in mapping
The above code returns response as blank. I get whole request in the response.body if i use the below code without xpath
I tried different examples of using xpath but nothing works. Where is the mistake, i could not find.
Please suggest..
@StefH commented on GitHub (Jul 9, 2021):
@msutar021
Take a look at:
https://stackoverflow.com/questions/56933756/how-to-create-xpath-for-soap-header-and-body
In your case, I think you can use:
@msutar021 commented on GitHub (Jul 9, 2021):
I have tried this, it is not working; Response is null.
@StefH commented on GitHub (Jul 10, 2021):
The issue was related to
<?xml version='1.0' standalone='no'?>A new version will be released shorty.
See also
https://github.com/WireMock-Net/WireMock.Net/blob/master/test/WireMock.Net.Tests/ResponseBuilders/ResponseWithHandlebarsXPathTests.cs#L124
@msutar021 commented on GitHub (Jul 12, 2021):
Thank you so much for the reply. Please keep posted on the new version.
@StefH commented on GitHub (Jul 12, 2021):
It was released as version 1.4.18
https://github.com/WireMock-Net/WireMock.Net/blob/master/CHANGELOG.md
@msutar021 commented on GitHub (Jul 14, 2021):
Thank you. Its working now.