首页 > 解决方案 > 无法使用 xPath 和命名空间提取 SOAPUI 属性传输中的值

问题描述

我尝试在使用 xPath的Property Transfer中从 xml 中提取值:

declare namespace S="http://www.w3.org/2003/05/soap-envelope"
declare namespace ns7="http://schemas.BIGBANK.pl/" xmlns="http://schemas.BIGBANK.pl/"

/S:Envelope/S:Body/ns7:Document/ns7:QueryIPR/ns7:IPIList/ns7:PI/ns7:PI/ns7:cId/

我得到错误:

cId [net.sf.saxon.trans.XPathException: Required item type of first operand of '/' is node(); supplied value has item type xs:string]

我将传输源设置为上一步(返回有效 XML)、属性Response和路径语言XPath

不知道如何在 SoapUI 中修复它(在纯 java 中更容易)

标签: xpathsoapuixpath-2.0

解决方案


好的,我的错误在第二行我有:

declare namespace ns7="http://schemas.BIGBANK.pl/" xmlns="http://schemas.BIGBANK.pl/"

如果您使用纯 XML,则可以设置属性。但在 SoapUI 中应该是:

declare namespace ns7="http://schemas.BIGBANK.pl/" 

现在它工作正常。


推荐阅读