Wednesday, May 6, 2015

Passing accept headers to fault sequence

When it comes to writing custom fault sequences, there are situations where you need to access values of different properties/ headers within your in sequence. One such requirement is to access the value of an accept header within your fault sequence. Usually , such axis2 based values are not preserved in fault sequence. Therefore you need to use 'operation' scope.

Below example code explains how you can retrieve accept header value in your fault sequence. In your in sequence, you can save header value to a property like below.

          <header name="Accept" value="image/jpeg" scope="transport"/>
         
            <property name="accept" expression="$trp:Accept" scope="operation"/>


Next in your in sequence you can access that created property like following.

 <property name="testheader" expression="get-property('operation', 'accept')"/>

You can get more information regarding this scope in [1]

[1] https://docs.wso2.com/display/ESB481/XPath+Extension+Functions#XPathExtensionFunctions-operationscope


No comments:

Post a Comment