如何从 SOAP 中的 SOAP 请求中提取数据 UI
How to extract data from SOAP-request in SOAP UI
我正在创建模拟 SOAP 响应,它应该 return 数据包含在 SOAP 请求中。请查找请求示例:
SOAP 请求:
<v01:GetAncillaryOffersRQ version="1.0">
...
<v01:PNRLocator itineraryRef="itinerary_1">AAAAAA</v01:PNRLocator>
...
</v01:GetAncillaryOffersRQ>
请找到应该 returned:
的模拟响应
模拟回复:
<soapenv:Header></soapenv:Header>
<soapenv:Body>
<v01:GetAncillaryOffersRS version="?">
<v021:ApplicationResults status="?">
<v021:Error type="?" timeStamp="?">
<v021:SystemSpecificResults timeStamp="?" reference="?">
<v021:Message code="?">No such PNR: ${pnrLocarotReq}</v021:Message>
<v021:DocURL>?</v021:DocURL>
</v021:SystemSpecificResults>
</v021:Error>
</v021:ApplicationResults>
</v01:GetAncillaryOffersRS>
</soapenv:Body>
我正在尝试使用以下脚本将 SOAP 请求的值传递给模拟响应:
def req = new XmlSlurper().parseText(mockRequest.requestContent)
def pnrLocarotReq = req.GetAncillaryOffersRQ.PNRLocator
log.info "PNR Locator: $pnrLocarotReq"
并且此值未传递给响应。从控制台中我可以看到,参数值不是从请求中提取的。
控制台输出:
Fri Feb 13 12:22:23 CET 2015:INFO:PNR Locator:
你能告诉我我做错了什么吗?
这段代码对我来说很好用:
def req = new XmlSlurper().parseText(mockRequest.requestContent)
def pnrLocarotReq = req.Body.GetAncillaryOffersRQ.PNRLocator
log.info "PNR Locator: $pnrLocarotReq"
非常感谢userRao
我正在创建模拟 SOAP 响应,它应该 return 数据包含在 SOAP 请求中。请查找请求示例:
SOAP 请求:
<v01:GetAncillaryOffersRQ version="1.0">
...
<v01:PNRLocator itineraryRef="itinerary_1">AAAAAA</v01:PNRLocator>
...
</v01:GetAncillaryOffersRQ>
请找到应该 returned:
的模拟响应模拟回复:
<soapenv:Header></soapenv:Header>
<soapenv:Body>
<v01:GetAncillaryOffersRS version="?">
<v021:ApplicationResults status="?">
<v021:Error type="?" timeStamp="?">
<v021:SystemSpecificResults timeStamp="?" reference="?">
<v021:Message code="?">No such PNR: ${pnrLocarotReq}</v021:Message>
<v021:DocURL>?</v021:DocURL>
</v021:SystemSpecificResults>
</v021:Error>
</v021:ApplicationResults>
</v01:GetAncillaryOffersRS>
</soapenv:Body>
我正在尝试使用以下脚本将 SOAP 请求的值传递给模拟响应:
def req = new XmlSlurper().parseText(mockRequest.requestContent)
def pnrLocarotReq = req.GetAncillaryOffersRQ.PNRLocator
log.info "PNR Locator: $pnrLocarotReq"
并且此值未传递给响应。从控制台中我可以看到,参数值不是从请求中提取的。
控制台输出:
Fri Feb 13 12:22:23 CET 2015:INFO:PNR Locator:
你能告诉我我做错了什么吗?
这段代码对我来说很好用:
def req = new XmlSlurper().parseText(mockRequest.requestContent)
def pnrLocarotReq = req.Body.GetAncillaryOffersRQ.PNRLocator
log.info "PNR Locator: $pnrLocarotReq"
非常感谢userRao