How to Extract SOAP Action from request headers

How to Extract SOAP Action from request headers?

-Vinay

Solved Solved
0 4 1,847
1 ACCEPTED SOLUTION

Using Javascript is could extract the request header - 'SOAPAction' successfully. The key is to check if extract function matches header name (case sensitive)

@vinay poreddy How are you trying to extract it?

var soapAction = context.getVariable('request.header.SOAPAction');

Trace screenshot:

1663-soapaction.png

View solution in original post

4 REPLIES 4

What is the request.header parameter to be used to extract soap header from incoming request?

Tried request.header.SOAPAction but no luck.

Please suggest.

Using Javascript is could extract the request header - 'SOAPAction' successfully. The key is to check if extract function matches header name (case sensitive)

@vinay poreddy How are you trying to extract it?

var soapAction = context.getVariable('request.header.SOAPAction');

Trace screenshot:

1663-soapaction.png

Above JS works.Thanks for the information.

Question:

Have you tried using extract variable and assign?

Yes,

Here is a sample for Extract Policy,

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<ExtractVariables async="false" continueOnError="false" enabled="true" name="Extract-Variables-1">
    <DisplayName>Extract Variables 1</DisplayName>
    <Properties/>
    <Header name="SOAPAction">
      <Pattern ignoreCase="false">{SOAPHeaderValue}</Pattern>
  	</Header>    
    <IgnoreUnresolvedVariables>true</IgnoreUnresolvedVariables>    
    <Source clearPayload="false">request</Source>
    <VariablePrefix>apigee</VariablePrefix>    
</ExtractVariables>

Now you can access the SOAP Header value using {VariablePrefix}.{Pattern}. i.e apigee.SOAPHeaderValue

If you are using JS,

var soapAction = context.getVariable('apigee.SOAPHeaderValue');

Sample Assign Message Policy to copy value from apigee.SOAPHeaderValue to another variable - flow.soap.header

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<AssignMessage async="false" continueOnError="false" enabled="true" name="Assign-Message-1">
    <DisplayName>Assign Message 1</DisplayName>
    <Properties/>     
	<AssignVariable>
    		<Name>flow.soap.header</Name>
    		<Ref>apigee.SOAPHeader</Ref>
    		<Value>NULL</Value>
	</AssignVariable>
    <IgnoreUnresolvedVariables>true</IgnoreUnresolvedVariables>
    <AssignTo createNew="false" transport="http" type="request"/>
</AssignMessage>



Hope this helps!!