简体   繁体   English

根据标签值从 soap 响应中提取值

[英]Extract value from soap response based on tag value

My soap response is as follows:我的soap回复如下:

<?xml version="1.0" encoding="UTF-8"?>
<e:Envelope xmlns:d="http://www.w3.org/2001/XMLSchema" xmlns:i="http://www.w3.org/2001/XMLSchema-instance" 
xmlns:fn35="http://www.filenet.com/ns/fnce/2005/02/ws/schema" xmlns:fn40m="http://www.filenet.com/ns/fnce/2006/11/ws/MTOM/schema" 
xmlns:fn40="http://www.filenet.com/ns/fnce/2006/11/ws/schema" xmlns:xop="http://www.w3.org/2004/08/xop/include" 
xmlns:e="http://www.w3.org/2003/05/soap-envelope">
    <e:Body>
        <ExecuteChangesResponse xmlns="http://www.filenet.com/ns/fnce/2006/11/ws/schema">
            <ChangeResponse id="1" classId="Document" objectId="{F4CA442A-CE20-45E8-8372-7F34367113A4}" 
            objectStore="{2417ADC1-633A-4DE3-ADC1-7B6E85E832A9}" 
            updateSequenceNumber="0" accessAllowed="998903">
                <Property i:type="fn40:SingletonString" propertyId="Owner" settable="1">
                    <Value>testUser</Value>
                </Property>
                <Property i:type="fn40:SingletonId" propertyId="Id">
                    <Value>{F4CA442A-CE20-45E8-8372-7F34367113A4}</Value>
                </Property>             
            </ChangeResponse>
        </ExecuteChangesResponse>
    </e:Body>
</e:Envelope>

and I want to extract the value of the property that has propertyId="Id" so I tried the following and it returns an empty string我想提取具有 propertyId="Id" 的属性的值,所以我尝试了以下操作,它返回一个空字符串

<property expression="//ExecuteChangesResponse/ChangeResponse/property[@propertyId='Id']/text()" name="Id" scope="default" 
                    type="STRING"  
                    xmlns:i="http://www.w3.org/2001/XMLSchema-instance" />

I was able to extract the value as follows:我能够按如下方式提取值:

<property expression="$body/fn:ExecuteChangesResponse/fn:ChangeResponse/fn:Property[@propertyId='Id']/fn:Value" name="Id" scope="default" 
 type="STRING"  
 xmlns:fn="http://www.filenet.com/ns/fnce/2006/11/ws/schema" />

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM