Get hands-on experience with 20+ free Google Cloud products and $300 in free credit for new customers.

Unable to extract variable from XML

How to extract id value from below xml using apigee?

sample:

<?xml version="1.0" encoding="UTF-8"?>
<A xmlns:ns1="http://www.test.com/abc/xyz">
    <id>50905</id>
    <abc>test test</abc>
</A>

Tried below combination but didn't seems working.Please suggest

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<ExtractVariables async="false" continueOnError="false" enabled="true" name="Extract-Id">
    <DisplayName>Extract-Id</DisplayName>
    <Source clearPayload="false">request</Source>
    <XMLPayload stopPayloadProcessing="false">
        <Namespaces>
            <Namespace prefix="ns1">http://www.test.com/abc/xyz</Namespace>
        </Namespaces>
        <Variable name="IdValue" type="nodeset">
            <XPath>/A/id</XPath>
        </Variable>
 	<!--<Variable name="IdValue" type="number">
            <XPath>/A/id</XPath>
        </Variable>
	<Variable name="IdValue" type="number">
            <XPath>number(/A/id)</XPath>
        </Variable>-->

    </XMLPayload>
    <IgnoreUnresolvedVariables>true</IgnoreUnresolvedVariables>
</ExtractVariables>

Thanks

0 3 829
3 REPLIES 3