如何在soapUI中使用Xpath匹配断言

时间:2016-11-06 02:12:05

标签: xpath soapui

以下是回复:

[CDATA[<label for='cf_2866410'>UserId</label>]]]]>><![CDATA[</name><value></value><fieldtype>109

我想从这里得到值-109:

import com.eviware.soapui.support.XmlHolder

respXmlHolder = new XmlHolder(messageExchange.getResponseContentAsXml())
respXmlHolder.declareNamespace("ns1","http://uta.WS.abc.com")

CDATAXml = respXmlHolder.getNodeValue("//ns1:getCompanyResponse[1]/ns1:return[1]/text()")
log.info CDATAXml
CDATAXmlHolder = new XmlHolder(CDATAXml)

myval = CDATAXmlHolder.getNodeValue("//label[@for='cf_2866410']/fieldtype")
log.info myval

这是我到目前为止所尝试的:

$.ajax({
  url : "../src/awesome.cpp",
  dataType: "text",
  success : function (data) {
    $("#awesomecpp").text(data);
  }
});

我想转到例如id - 2748473并提取其字段类型

1 个答案:

答案 0 :(得分:0)

我能够通过以下方式获得它:

import com.eviware.soapui.support.XmlHolder

respXmlHolder = new XmlHolder(messageExchange.getResponseContentAsXml())
respXmlHolder.declareNamespace("ns1","http://uta.abc.com")

CDATAXml = respXmlHolder.getNodeValue("//ns1:getCompanyResponse[1]/ns1:return[1]")
CDATAXmlHolder = new XmlHolder(CDATAXml)

myval = CDATAXmlHolder.getNodeValue("//*[id='2858830']/fieldtype")
log.info myval