![](/img/trans.png)
[英]Matching JSON request body based on JSON Path with logical operators in WireMock
[英]How to get response based on the request body matching using wiremock and JSON
如何使用JSON和獨立的WireMock驗證我的Soap請求是否包含標頭和正文中的特定元素。
如果我的請求的標頭中包含<a:Id>1876</a:Id>
,我應該得到response1,否則我應該得到response2
同樣,我也需要檢查身體。
以下是我的請求XML
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:a="http://abc.example.com/a"
xmlns:b="http://abc.example.com/b"
xmlns:c="http://abc.example.com/c"
<soapenv:Header>
<a:abcHeaders>
<a:Id>1876</a:Id>
<a:Xid>12</a:Xid>
</a:abcHeaders>
</soapenv:Header>
<soapenv:Body>
<b:abcOpern>
<b:xyz>
<c:pqr>12</c:pqr>
</b:xyz>
</b:abcOpern>
</soapenv:Body>
</soapenv:Envelope>
在WireMock.Net中,您可以使用XPath匹配。 有關詳細信息,請參見此處 。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.