调用WebService后,在属性中设置响应值以重用它

时间:2018-07-19 11:33:46

标签: wso2

在通过介体调用进行服务调用之后,我尝试在响应中检索一个值,以在后续调用中重用它。 主体的价值很高,但是在xpath上,我从不返回值。

提取XML文件

<log description="LogApresAppelALAuthentication" level="full"/>
<property description="Get body response Auth" expression="$body" name="bodyRespAuth" scope="default" type="OM" />
<log>
    <property expression="$ctx:bodyRespAuth" name="bodyRespAuth"/>
</log> 
<property description="Get Token CS" expression="$ctx:bodyRespAuth//AuthenticateUserResult/text()" name="tokenCS" scope="default" type="STRING" xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:urn="urn:Core.service.livelink.opentext.com" xmlns:ns="http://org.apache.synapse/xsd"/>  
<log>
    <property expression="$ctx:tokenCS" name="tokenCS"/>
</log>

日志:

MessageID: urn:uuid:97a99ef0-cfb3-4d14-9013-20ee8bb89e6d, Direction: request, Envelope: <?xml version='1.0' encoding='utf-8'?><soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:S="http://schemas.xmlsoap.org/soap/envelope/"><soapenv:Body><AuthenticateUserResponse xmlns="urn:Core.service.livelink.opentext.com"><AuthenticateUserResult>kzE3hcjoG6lYIn6yglLGwYXNivGpCGMDoJWcetPTEj9EiU%2BSGaTqyxZ9azmTc%2BMdGbKcJzCsSAz0epdXkZkP%2BeIazTcvQtu8</AuthenticateUserResult></AuthenticateUserResponse></soapenv:Body></soapenv:Envelope>
MessageID: urn:uuid:97a99ef0-cfb3-4d14-9013-20ee8bb89e6d, Direction: request, bodyRespAuth = <soapenv:Body xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"><AuthenticateUserResponse xmlns="urn:Core.service.livelink.opentext.com"><AuthenticateUserResult>kzE3hcjoG6lYIn6yglLGwYXNivGpCGMDoJWcetPTEj9EiU%2BSGaTqyxZ9azmTc%2BMdGbKcJzCsSAz0epdXkZkP%2BeIazTcvQtu8</AuthenticateUserResult></AuthenticateUserResponse></soapenv:Body>
MessageID: urn:uuid:97a99ef0-cfb3-4d14-9013-20ee8bb89e6d, Direction: request, tokenCS = 

我为xpath使用了几种可能的组合,但是每次我在tokencs中都没有值时。 你有想法吗 ?

1 个答案:

答案 0 :(得分:0)

我找到了解决方法

<property description="Get Token CS" expression="$body//*/urn:AuthenticateUserResult/text()" name="tokenCS" scope="default" type="STRING" xmlns:urn="urn:Core.service.livelink.opentext.com" />

我有我的价值