2011-11-22 49 views
0

我试图将一个WS调用的响应中的值传递给另一个使用SoapUI的Transfer Property TestStep的请求。如何让SoapUI测试用例中的物业转移工作?

首先WS响应:

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> 
    <soapenv:Header/> 
    <soapenv:Body> 
    <ns5:PSResponse xmlns:ns5="http://www.ab.com/abonline/service/PaymentService/1.0/" xmlns:ns6="http://www.ab.com/abonline/service/CustomerCard/1.0/" xmlns:ns7="https://secure.incab.se/DTServerModuleService/v1"> 
     <ns5:abTransactionReference>1085-0</ns5:abTransactionReference> 
     <ns5:status>0</ns5:status> 
    </ns5:PSResponse> 
    </soapenv:Body> 
</soapenv:Envelope> 

解析属性工作正常使用类似的表达式:
declare namespace ns5="http://www.ab.com/abnline/service/PaymentService/1.0/" //ns5:abTransactionReference

下一个请求:

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns="http://www.ab.com/abonline/service/PaymentService/1.0/"> 
    <soapenv:Header/> 
    <soapenv:Body> 
    <UpdatePaymentRequest> 
     <abTransactionReference>30</abTransactionReference> 
... ... 

我尝试将所述属性进下一个请求使用:
//abTransactionReference

给我:[Missing match for Target XPath [//abTransactionReference]]

我也尝试了完整的XPath:
declare namespace soapenv="http://schemas.xmlsoap.org/soap/envelope/" //soapenv:Envelope/soapenv:Body/UpdatePaymentRequest/abTransactionReference

...造成类似的错误。

回答

0

看来你应该设置默认名称空间http://www.ab.com/...以及

0

您不能命名空间定义中使用""。例如,在上述的情况下>>

declare namespace soapenv="http://schemas.xmlsoap.org/soap/envelope/" 

应该是

declare namespace soapenv='http://schemas.xmlsoap.org/soap/envelope/'; 
0

尝试的XPath断言添加到UpdatePaymentRequest请求消息。点击XPath Match Configuration对话框中的Declare按钮,你会看到soapUI用于'http://www.ab.com/abonline/service/PaymentService/1.0/'命名空间的前缀。我想它会是这样的:

declare namespace soapenv='http://schemas.xmlsoap.org/soap/envelope/'; 
declare namespace ns1='http://www.ab.com/abonline/service/PaymentService/1.0/'; 

(见http://testautomationnoob.blogspot.com.by/2013/12/xpath-in-soapui-part-1-xpath-assertions.html)。那么就没有必要拥有XPath断言 - 您可以将其删除。所以,在xpath中使用“ns1”前缀。最后,您将拥有以下xpath:

declare namespace soapenv='http://schemas.xmlsoap.org/soap/envelope/'; 
declare namespace ns1='http://www.ab.com/abonline/service/PaymentService/1.0/'; 
/soapenv:Envelope/soapenv:Body/ns1:UpdatePaymentRequest/ns1:abTransactionReference 
+1

仅链接答案不是SO的方式。请详细说明您的答案。 – jogo