【发布时间】:2018-09-25 17:53:15
【问题描述】:
我正在尝试在 soapUI 中针对以下 XML 创建 XPath Match 断言,以查看元素是否存在:
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
<soapenv:Body>
<ns2:executeResponse xmlns:ns2="http://ws.namf09.anzlic.org.au">
<responses id="?" xmlns="http://namf09.anzlic.org.au">
<result status="OK" completed="true" hasErrorsInResponseElements="false"/>
<response id="200.1">
<responseResult>
<address>
<streetNumber1>2</streetNumber1>
<streetName>sydney</streetName>
<streetType>SQ</streetType>
<localityName>sydney</localityName>
<stateTerritory>NSW</stateTerritory>
<postcode>2000</postcode>
</address>
</responseResult>
</response>
</responses>
</ns2:executeResponse>
</soapenv:Body>
</soapenv:Envelope>
我的第一次尝试是boolean(//address),soapUI 说这是错误的。但是,当我让soapUI 为我计算出命名空间时,它提出了:
declare namespace ns2='http://ws.namf09.anzlic.org.au';
declare namespace ns1='http://namf09.anzlic.org.au';
declare namespace soapenv='http://schemas.xmlsoap.org/soap/envelope/';
boolean(//ns1:address)
这可行,但我不明白 ns1 命名空间的来源。我认为这是默认设置,但是如果没有soapUI,我怎么能解决这个问题呢?
【问题讨论】: