在调用 WebService 后在 属性 中设置响应值以重用它
After call to a WebService set response value in property to reuse it
通过中介调用进行服务调用后,我尝试在响应中检索一个值,以便在后续调用中重用它。
body 很有价值,但对 xpath 我从来没有 return 价值。
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 中都没有任何价值。
你有好主意吗 ?
我找到了解决方案
<property description="Get Token CS" expression="$body//*/urn:AuthenticateUserResult/text()" name="tokenCS" scope="default" type="STRING" xmlns:urn="urn:Core.service.livelink.opentext.com" />
我有我的价值
通过中介调用进行服务调用后,我尝试在响应中检索一个值,以便在后续调用中重用它。 body 很有价值,但对 xpath 我从来没有 return 价值。
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 中都没有任何价值。 你有好主意吗 ?
我找到了解决方案
<property description="Get Token CS" expression="$body//*/urn:AuthenticateUserResult/text()" name="tokenCS" scope="default" type="STRING" xmlns:urn="urn:Core.service.livelink.opentext.com" />
我有我的价值