Extract credentials from SOAP headers

I just started learning apigee from last couple of days and want to know how to extract credentials(eg: username) from soap headers.I used below but it doesn't allow to set it.Let me know what is the issue?What is the format to setup for xpath to extract the value?

==

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<ExtractVariables async="false" continueOnError="false" enabled="true" name="Extract-UserName">
  <DisplayName>Extract UserName</DisplayName>
  <FaultRules/>
  <Properties/>
  <IgnoreUnresolvedVariables>true</IgnoreUnresolvedVariables>
  <Source clearPayload="false">request</Source>
  <VariablePrefix>apigee</VariablePrefix>
  <XMLPayload stopPayloadProcessing="false">
  <Namespaces>
  <Namespace prefix="soapenv">http://schemas.xmlsoap.org/soap/envelope/</Namespace>
  </Namespaces>
  <Variable name="userName" type="string">
  <XPath>/soapenv:Envelope/soapenv:Header/wsse:Security/wsse:UsernameToken/wsse:Username</XPath>
  </Variable>
  </XMLPayload>
</ExtractVariables>

To extract complete payload below syntax works.What is the difference between above & below?

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

-Vinay

Solved Solved
0 1 1,162
1 ACCEPTED SOLUTION

gagan
Participant II

@vinay poreddy - looks like namespace "wsse" needs to be defined?

<Namespaces>
  <Namespace prefix="soapenv">http://schemas.xmlsoap.org/soap/envelope/</Namespace>
  </Namespaces>
  <Variable name="userName" type="string">
  <XPath>/soapenv:Envelope/soapenv:Header/wsse:Security/wsse:UsernameToken/wsse:Username</XPath>

View solution in original post

1 REPLY 1

gagan
Participant II

@vinay poreddy - looks like namespace "wsse" needs to be defined?

<Namespaces>
  <Namespace prefix="soapenv">http://schemas.xmlsoap.org/soap/envelope/</Namespace>
  </Namespaces>
  <Variable name="userName" type="string">
  <XPath>/soapenv:Envelope/soapenv:Header/wsse:Security/wsse:UsernameToken/wsse:Username</XPath>