【发布时间】:2022-01-14 02:04:34
【问题描述】:
我有以下来自 SOAP 调用的 XML 响应
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<soap:Body>
<GetContractStatusesResponse xmlns="http://www.proactis.com/xml/xml-ns/">
<GetContractStatusesResult>
<Message>Successful</Message>
<Code>1</Code>
<InterfaceLanguage>de</InterfaceLanguage>
<GetContractStatusesData xmlns="http://schemas.proactis.com/p4/contractmanagement/2013/02">
<ContractStatus code="DRFT" typeId="3581">Draft</ContractStatus>
<ContractStatus code="BAPR" typeId="3582">Being Approved</ContractStatus>
<ContractStatus code="RJCT" typeId="3583">Rejected</ContractStatus>
<ContractStatus code="CNCL" typeId="3584">Cancelled</ContractStatus>
<ContractStatus code="APPR" typeId="3585">Approved</ContractStatus>
<ContractStatus code="ACPE" typeId="3586">Activation Pending</ContractStatus>
<ContractStatus code="ACTV" typeId="3587">Active</ContractStatus>
<ContractStatus code="SUSP" typeId="3588">Suspended</ContractStatus>
<ContractStatus code="COMP" typeId="3589">Completed</ContractStatus>
<ContractStatus code="NOV" typeId="3783">Novated</ContractStatus>
<ContractStatus code="DEF" typeId="3853">In Defects Period</ContractStatus>
</GetContractStatusesData>
</GetContractStatusesResult>
</GetContractStatusesResponse>
</soap:Body>
</soap:Envelope>
我正在尝试创建一个 xpath 引用来检索 GetContractStatusesData 数组,这样我就可以遍历每个 ContractStatus 以使用该值以及相关的代码
我尝试了各种在线 xpath 生成器,但它们在导入逻辑应用程序时似乎无法正常工作,甚至尝试更简单的方法,例如获取消息值。
这些是我通过设置逻辑应用变量尝试过的那些
xpath(xml(variables('Payload')), '//ContractStatus[1]/@code')
xpath(xml(variables('Payload')), '//ContractStatus[1]/text()[1]')
我通常返回的结果是[]
【问题讨论】:
标签: xml xpath soap azure-logic-apps