There are few HTTP transport-specific
properties in ESB.
Properties use in ESB access various
types of information regarding a message that passes through the ESB.
Also properties can be used to control the behavior of the ESB on a
given message.
WSO2 ESB support HTTP 1.1 outgoing
messages by default. To make it HTTP 1.0, there is a property that
would help to perform it.
<property name="FORCE_HTTP_1.0" value="true" scope="axis2"/>
By the following steps I will be
explaining how to test this behavior if WSO2 ESB.
Download WSO2 ESB,
http://wso2.com/products/enterprise-service-bus
To Setup :
----------------
- Go to <ESB_Home>/samples/axis2Server/src/SimpleStockQuoteService and build it, ant
- Start the Go to <ESB_Home>/samples/axis2Server and start the axis2Server by the following command, sh axis2server.sh.
- Start the ESB Server, <ESB_Home>/bin by providing, sh wso2server.sh.
- Run a tcpMon to view the outgoing messages.
- Start the tcpmon in the <ESB_Home>/bin - sh tcpmon.shCreate 2 listeners as below.1. Listen Port 8281, Target host – localhost, Target port – 8280 – Before hits the ESB2. Listen Port 9001, Target host – localhost, target port – 9000 – After passing through ESB and Before hits the backend
- Log in to the ESB and provide the following synapse configuration.
<?xml version="1.0" encoding="UTF-8"?> <definitions xmlns="http://ws.apache.org/ns/synapse"> <sequence name="fault"> <log level="full"> <property name="MESSAGE" value="Executing default "fault" sequence"/> <property name="ERROR_CODE" expression="get-property('ERROR_CODE')"/> <property name="ERROR_MESSAGE" expression="get-property('ERROR_MESSAGE')"/> </log> <drop/> </sequence> <sequence name="main"> <header name="Action" value="urn:getQuote"/> <filter source="get-property('To')" regex=".*/StockQuote.*"> <property name="FORCE_HTTP_1.0" value="true" scope="axis2"/> <send> <endpoint> <address uri="http://localhost:9001/services/SimpleStockQuoteService" format="soap11"/> </endpoint> </send> <drop/> </filter> <send/> </sequence> </definitions>
To Send the Rest request :
---------------------------------------------
- Go to axis2Client, <ESB_Home>/samples/axis2Client and send the following REST request.
ant stockquote -Dtrpurl=http://localhost:8281/services/StockQuote -Drest=true
Observations :
-------------------------
- On the server side, Standard :: Stock price = $157.06490695255485 will be generated.
- Observe the tcpMon.
Rest request sent to ESB can be
seen in port 8281,
POST /services/StockQuote HTTP/1.1
Outgoing message from ESB can be
seen in port 9001,
No comments:
Post a Comment