在创建模拟服务时使用 bodyPath() 时出错
Error when bodyPath() is used in creating a mock service
我的模拟场景如下。
场景:pathMatches('/tokenisationservice/TokenisationWS_1_3') && bodyPath('/Envelope/Body/getToken/GetTokenRequest/enterpriseID') == '1'
url 被嘲笑- 'http://localhost:8080/tokenisationservice/TokenisationWS_1_3'
请求XML
<soapenv:Envelope blah blah blah>
<soapenv:Header/>
<soapenv:Body>
<tok:getToken>
<GetTokenRequest>
<enterpriseID>1</enterpriseID>
<merchantGroupID>1</merchantGroupID>
<pan>1234567890123456</pan>
</GetTokenRequest>
</tok:getToken>
</soapenv:Body>
</soapenv:Envelope>
运行 独立空手道网。这给出了以下错误并且没有返回所需的响应。
15:53:19.159 [nioEventLoopGroup-3-3] WARN com.intuit.karate - 场景匹配评估失败:javascript 评估失败:pathMatches('/tokenisationservice/TokenisationWS_1_3') && bodyPath( '/恩维
lope/Body/getToken/GetTokenRequest/enterpriseID') == '1'
您的模拟/功能中似乎有错字。我试过了,它对我有用。另请注意,bodyPath()
仅在空手道 0.8.0 中引入
模拟:
Scenario: pathMatches('/tokenisationservice/TokenisationWS_1_3') && bodyPath('/Envelope/Body/getToken/GetTokenRequest/enterpriseID') == '1'
* print request
* def response = { success: true }
测试:
* url karate.properties['mock.url']
* path '/tokenisationservice/TokenisationWS_1_3'
* request
"""
<soapenv:Envelope>
<soapenv:Header/>
<soapenv:Body>
<tok:getToken>
<GetTokenRequest>
<enterpriseID>1</enterpriseID>
<merchantGroupID>1</merchantGroupID>
<pan>1234567890123456</pan>
</GetTokenRequest>
</tok:getToken>
</soapenv:Body>
</soapenv:Envelope>
"""
* method post
* status 200
* print response
我的模拟场景如下。
场景:pathMatches('/tokenisationservice/TokenisationWS_1_3') && bodyPath('/Envelope/Body/getToken/GetTokenRequest/enterpriseID') == '1'
url 被嘲笑- 'http://localhost:8080/tokenisationservice/TokenisationWS_1_3'
请求XML
<soapenv:Envelope blah blah blah>
<soapenv:Header/>
<soapenv:Body>
<tok:getToken>
<GetTokenRequest>
<enterpriseID>1</enterpriseID>
<merchantGroupID>1</merchantGroupID>
<pan>1234567890123456</pan>
</GetTokenRequest>
</tok:getToken>
</soapenv:Body>
</soapenv:Envelope>
运行 独立空手道网。这给出了以下错误并且没有返回所需的响应。
15:53:19.159 [nioEventLoopGroup-3-3] WARN com.intuit.karate - 场景匹配评估失败:javascript 评估失败:pathMatches('/tokenisationservice/TokenisationWS_1_3') && bodyPath( '/恩维 lope/Body/getToken/GetTokenRequest/enterpriseID') == '1'
您的模拟/功能中似乎有错字。我试过了,它对我有用。另请注意,bodyPath()
仅在空手道 0.8.0 中引入
模拟:
Scenario: pathMatches('/tokenisationservice/TokenisationWS_1_3') && bodyPath('/Envelope/Body/getToken/GetTokenRequest/enterpriseID') == '1'
* print request
* def response = { success: true }
测试:
* url karate.properties['mock.url']
* path '/tokenisationservice/TokenisationWS_1_3'
* request
"""
<soapenv:Envelope>
<soapenv:Header/>
<soapenv:Body>
<tok:getToken>
<GetTokenRequest>
<enterpriseID>1</enterpriseID>
<merchantGroupID>1</merchantGroupID>
<pan>1234567890123456</pan>
</GetTokenRequest>
</tok:getToken>
</soapenv:Body>
</soapenv:Envelope>
"""
* method post
* status 200
* print response