Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

The SOAP 1.1 or 1.2 body element. For example, expression="$body/getQuote" refers to the first getQuote element in the SOAP body regardless of whether the message is SOAP-11 or SOAP-12.

Header

The SOAP 1.1 or 1.2 header element. For example, expression="$header/wsa:To refers to the addressing To header regardless of whether this message is SOAP-11 or SOAP-12.

axis2

...

$axis2

Prefix for Axis2 MessageContext properties. This is used to get the property value at the axis2 scope. For example, to get the property named 'messageType' use the following XPath expression:

$axis2:messageType

 

 

Prefix for Axis2 MessageContext properties. For example, expression="$axis2:value of Axis2 message context property with name REST_URL_POSTFIX" gives the value of the axis2 message context property with name , use the XPath expression $axis2:REST_URL_POSTFIX. We have discussed an example below.

Example of $axis2 usage:

1. Deploy the following proxy service.

...

Similarly, you can use $axis2 prefix with HTTP Transport Properties.

ctx

Prefix for Synapse MessageContext properties. For example, expression="$ctx:RESPONSE" gives the value of the Synapse message context property with name "RESPONSE."

...

$trp

Prefix for used to get the transport headers. For example,expression=" to get the transport header named Content-Type of the current message, use the XPath expression $trp:Content-Type. HTTP transport headers are not case sensitive. Therefore, $trp:Content-Type " gives the value of the "Content-Type" transport header, which is going to be and $trp:CONTENT-TYPE are regarded as the same. We have discussed an example below.

Example of $trp usage:

1. Deploy the following proxy service. Note the property, <property name="stockprop" expression="$trp:Content-Type"/> in the configuration which is used to log the Content-Type HTTP header of the current message.

 

 

 

$axis2

 

$trp

Gets a transport header.

For example, to get the transport header named Content-Type use the following XPath expression:

$trp:Content-Type

HTTP transport headers are case-insensitive, so in the HTTP case,

$trp:Content-Type 

and

$trp:CONTENT-TYPE 

are equal.request message.

<proxy xmlns="http://ws.apache.org/ns/synapse" name="StockQuoteProxy" transports="https,http" statistics="disable" trace="disable" startOnLoad="true">
   <target>
      <inSequence>
         <log>
             <property name="stockprop" expression="$trp:Content-Type"/>
         </log>
         <send>
            <endpoint>
               <address uri="http://localhost:9000/services/SimpleStockQuoteService"/>
            </endpoint>
         </send>
      </inSequence>
      <outSequence>
         <send/>
      </outSequence>
   </target>
   <description></description>
</proxy>
                                
2. Send the StockQuoteRequest using sample stockquote client as follows.

ant stockquote -Daddurl=http://localhost:8280/services/StockQuoteProxy

3. You will notice the following message in ESB log.

[2013-03-18 12:23:14,101] INFO - LogMediator To: http://localhost:8280/services/StockQuoteProxy, WSAction: urn:getQuote, SOAPAction: urn:getQuote, ReplyTo: http://www.w3.org/2005/08/addressing/anonymous, MessageID: urn:uuid:25a3143a-5b18-4cbb-b8e4-27d4dd1895d2, Direction: request, stockprop = text/xml; charset=UTF-8

In this example, the property definition, <property name="stockprop" expression="$trp:Content-Type"/> is equivalent to <property name="stockprop" expression="get-property('transport','Content-Type')"/>

Similarly, we can use $trp prefix with the following properties.

<List down all properties in transport scope> - http://docs.wso2.org/wiki/display/ESB460/HTTP+Transport+Specific+Properties

 

 

 

$ctx

Gets a property at the default scope.

...