如何从Edge策略中的SOAP请求中提取变量?

时间:2014-05-31 21:14:28

标签: apigee

这是我的政策:

<?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>

1 个答案:

答案 0 :(得分:1)

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