Announcements
This site is in read only until July 22 as we migrate to a new platform; refer to this community post for more details.
Get hands-on experience with 20+ free Google Cloud products and $300 in free credit for new customers.

Unable to extract value from soap message with namespaces

Not applicable

Hi,

I am trying to extract a value from a soap message i.e ACCOUNT_NUMBER from the following soap message:

<soapenv:Envelope 
    xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" 
    xmlns:ser="http://xx.yyyy.com/xxxxx">
  <soapenv:Header/>
  <soapenv:Body>
    <ser:CreditRequest>
      <ACCOUNT_NUMBER>5057</ACCOUNT_NUMBER>
    </ser:CreditRequest>
  </soapenv:Body>
</soapenv:Envelope>

When I used Extract Variables policy, I’m not getting the value extracted. Here's the policy:

<ExtractVariables name="Extract-CustomerAccNo">
  <DisplayName>Extract AccNo</DisplayName>
  <Properties/>
  <Source clearPayload="false">request</Source>
  <XMLPayload stopPayloadProcessing="false">
    <Namespaces>
      <Namespace prefix="soapenv">http://schemas.xmlsoap.org/soap/envelope/</Namespace>
      <Namespace prefix="ser">http://xx.yyyy.com/xxxxx</Namespace>
    </Namespaces>
    <Variable type="string" name="req.accno">
      <XPath>/soapenv:Envelope/soapenv:Body/ser:CreditRequest/ACCOUNT_NUMBER</XPath>
    </Variable>
  </XMLPayload>
</ExtractVariables> 

due to some namespace issue maybe? There is no default namespace available in the soap request. Otherwise I could have tried the following:

<XPath>/soapenv:Envelope/soapenv:Body/ser:CreditRequest/xmlns:ACCOUNT_NUMBER</XPath>

Could you please help me to get the value extracted?

Solved Solved
1 9 1,662
1 ACCEPTED SOLUTION

Hi @Julie Joseph,

I used the same above code and same input and able to see apigee is extracting the account number value irrespective of default name space. In the header I gave content-type as application/xml. Rest all I gave same. Attaching the screen shot for your reference. When I dont give content-type as application/xml it does not work. Hope it helps.

View solution in original post

9 REPLIES 9