51Testing软件测试论坛

标题: 如何用利用SOAPUI工具中的Groovy script实现取xml格式返回报文中某个属性值 [打印本页]

作者: 掉渣饼    时间: 2017-2-23 15:57
标题: 如何用利用SOAPUI工具中的Groovy script实现取xml格式返回报文中某个属性值
例如:要取RspTime属性的值,该怎么弄?
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
        <soap:Body>
                <ns2:doQryUserInfoByAccNbrResponse xmlns:ns2="http://www.xxxx.cn">
                        <return><![CDATA[<ContractRoot><TcpCont><TransactionID>6099075108201507231009733946</TransactionID><ActionCode>1</ActionCode><RspTime>20170223113510</RspTime><Response><RspType>0</RspType><RspCode>0000</RspCode><RspDesc>调用服务成功</RspDesc></Response></TcpCont><SvcCont><QueryUserInfo><CUST_ID></CUST_ID><CUST_NAME></CUST_NAME><CUST_ADDRESS></CUST_ADDRESS><CERT_TYPE>6</CERT_TYPE><CERT_NUMBER>wwww</CERT_NUMBER><ACC_NBR></ACC_NBR><BRAND_CD></BRAND_CD><OFFER_DESC></OFFER_DESC><BRAND_NAME></BRAND_NAME><ACC_PROD_INST_ID>110000117889</ACC_PROD_INST_ID><PRODUCT_NAME></PRODUCT_NAME><OWNER_CUST_ID></OWNER_CUST_ID><USE_CUST_ID></USE_CUST_ID><PAYMENT_MODE_CD></PAYMENT_MODE_CD><CREATE_DATE>20151229140122</CREATE_DATE><FINISH_TIME>20151229140134</FINISH_TIME><BEGIN_RENT_TIME>20151229140512</BEGIN_RENT_TIME><STOP_RENT_TIME>20501231235959</STOP_RENT_TIME><COMMON_REGION_ID>11</COMMON_REGION_ID><REGION_NAME></REGION_NAME><STATUS_CD>100000</STATUS_CD><STATUS_NAME>在用</STATUS_NAME><STATUS_DATE>20160229132630</STATUS_DATE><CHANNEL_ID>100000066</CHANNEL_ID><CHANNEL_NAME/><CREDIT_LEVEL>00</CREDIT_LEVEL><CONTRACT_NO>110005179756</CONTRACT_NO><PAY_FEE_COUNT>1</PAY_FEE_COUNT><MBR_FLAG>0</MBR_FLAG><UIM_NO>99034614840300501061</UIM_NO><ADDRESS_DESC/><LAN_ID>11</LAN_ID><SECOND_IMSI/><USERFLAG_4G>0</USERFLAG_4G></QueryUserInfo></SvcCont></ContractRoot>]]></return>
                </ns2:doQryUserInfoByAccNbrResponse>
        </soap:Body>
</soap:Envelope>




欢迎光临 51Testing软件测试论坛 (http://bbs.51testing.com/) Powered by Discuz! X3.2