我目前正在使用以下通用方法来访问 SOAPUI 响应中的单个 xml 标记:
public class SoapUIAPI {
private String soapUITestCase;
private String tagValue;
private TestRunner runner;
public String getWebServiceResponseTagValue (String tag){
tagValue = runner.getRunContext().expand("${"+soapUITestCase+"#Response#//*:"+tag+"}");
return tagValue;
}
runner.getRunContext().expand
几乎似乎正在使用 xpath 表达式(但不完全是?)我的问题是我有一个看起来像这样的 xml 响应:
<content>
<memNum>123456</memNum>
<displayName>Mr John Smith</displayName>
<prefName>John</prefName>
<dob>11/09/1948</dob>
<occDesc>Truck Driver</occDesc>
<IRDNumber>19-211-314</IRDNumber>
<contactDetails>
<contact>
<MEMBER_PHONE_ID>123456</MEMBER_PHONE_ID>
<contactType>Mobile 2</contactType>
<countryCode>(+64)</countryCode>
<std>021</std>
<number>54545454</number>
</contact>
<contact>
<MEMBER_PHONE_ID>34567</MEMBER_PHONE_ID>
<contactType>Business Phone</contactType>
<countryCode>(+36)</countryCode>
<std>04</std>
<number>8756845</number>
<ext/>
</contact>
<contact>
<MEMBER_PHONE_ID>45678</MEMBER_PHONE_ID>
<contactType>Preferred Email 1</contactType>
<email>Test@gmail.com</email>
</contact>
<contact>
<MEMBER_PHONE_ID>56789</MEMBER_PHONE_ID>
<contactType>Preferred Email 2</contactType>
<email>test@test.com</email>
</contact>
</contactDetails>
<branch>New York</branch>
<adviser>Warren Duck</adviser>
</content>
如何<email>
在仍在使用的同时指定要返回的标签runner.getRunContext().expand
?
也许其他人会不同意,但我发现缺少 SOAPUI API 文档。