chrislatimer
chrislatimer

Reputation: 3560

How to extract variable from SOAP request in Edge policy?

Here's my policy:

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

In trace tool I see that request.content resolves fine and shows the content, but I was expecting apigee.operation to be populated with the contents of . What am I doing wrong?

Fixed Policy:

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

Upvotes: 0

Views: 1335

Answers (1)

Michael Bissell
Michael Bissell

Reputation: 1208

If you know the Xpath you don't really need the scema and then you take on more variable out of the equation (ie whether the schema is valid). Then you could just reference //Body (or wherever it is in the xml)

Upvotes: 1

Related Questions