【问题标题】:How to extract variable from SOAP request in Edge policy?如何从边缘策略中的 SOAP 请求中提取变量?
【发布时间】:2014-06-01 09:21:49
【问题描述】:

这是我的政策:

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<ExtractVariables async="false" continueOnError="false" enabled="true" name="extract-operation">
    <DisplayName>extract-operation</DisplayName>
    <IgnoreUnresolvedVariables>false</IgnoreUnresolvedVariables>
    <Source clearPayload="true">request.content</Source>
    <VariablePrefix>apigee</VariablePrefix>
    <XMLPayload stopPayloadProcessing="false">
       <Namespaces>
          <Namespace prefix="soapenv">http://schemas.xmlsoap.org/soap/envelope/</Namespace>
        </Namespaces>
        <Variable name="operation" type="string">
          <XPath>/soapenv:Envelope/soapenv:Body</XPath>
        </Variable>
    </XMLPayload>
</ExtractVariables>

在跟踪工具中,我看到 request.content 可以很好地解析并显示内容,但我希望 apigee.operation 会填充 .我做错了什么?

固定政策:

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<ExtractVariables async="false" continueOnError="false" enabled="true" name="extract-operation">
    <DisplayName>extract-operation</DisplayName>
    <IgnoreUnresolvedVariables>false</IgnoreUnresolvedVariables>
    <Source clearPayload="true">request.content</Source>
    <XMLPayload stopPayloadProcessing="false">
       <Namespaces>
          <Namespace prefix="soapenv">http://schemas.xmlsoap.org/soap/envelope/</Namespace>
        </Namespaces>
        <Variable name="operation" type="nodeset">
          <XPath>/soapenv:Envelope/soapenv:Body</XPath>
        </Variable>
    </XMLPayload>
</ExtractVariables>

【问题讨论】:

    标签: apigee


    【解决方案1】:

    如果您知道 Xpath,那么您实际上并不需要 scema,然后您可以从等式中获取更多变量(即模式是否有效)。然后你可以只引用 //Body (或者它在 xml 中的任何地方)

    【讨论】:

    • 我不太明白你的意思,但我确实明白了。我需要从策略中删除变量前缀并将变量类型从string 更改为nodeset。既然您花时间回答,请点赞并接受。
    猜你喜欢
    • 1970-01-01
    • 2018-11-26
    • 1970-01-01
    • 2017-03-17
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-07-20
    相关资源
    最近更新 更多