...
1. Deploy the following proxy service using instructions in Adding a Proxy Service.
Note the property, <property name="stockprop" expression="$axis2:REST_URL_POSTFIX"/> in the configuration which is used to log the REST_URL_POSTFIX value of the request message.
...
Example of $trp usage:
1. Deploy the following proxy service using instructions given in section Adding a 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 request message.
Code Block | ||
---|---|---|
| ||
<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 following StockQuote request using sample stockquote client as followsthe sample StockQuote client. For information on the sample client, refer to the Sample Clients sub heading in ESB Samples Setup.
ant stockquote -Daddurl=http://localhost:8280/services/StockQuoteProxy
3. You will notice Note the following message in the ESB log.
Code Block |
---|
[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 you 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.
...