The UltraESB can be used to proxy any type of payload, including SOAP 1.1/1.2, XML, Text, HTML, Hessian, EDI, CSV, binary etc.. this example shows how a plain text response of a Servlet could be proxied through the UltraESB
To try out this sample, start the ToolBox and the sample Jetty server within it. The sample server hosts a servlet that outputs plain text. Using the HTTP/S client of the ToolBox, one can issue a GET request to the URL http://localhost:9000/service/TextServlet to get this response directly from the servlet as shown below
HTTP/1.1 200 OK
Content-Type: text/plain; charset=iso-8859-1
Connection: close
Server: Jetty(6.1.21)
Plain text Hello World
Now, start the sample configuration 101 of the UltraESB through the ToolBox, or the command line as follows
asankha@asankha:~/java/ultraesb-1.0-beta-1/bin$ ./ultraesb.sh -sample 101
Issuing a GET request to the text-proxy of the UltraESB at URL http://localhost:8280/service/text-proxy you will now get the same response through the UltraESB.
HTTP/1.0 200 OK
Content-Type: text/plain; charset=iso-8859-1
Date: Wed, 13 Jan 2010 05:51:10 GMT
Server: UltraESB/1.0-beta-1
Content-Length: 23
Connection: close
Plain text Hello World
Note that the advantage would be in mediating the request and response, performing transformations or other such actions via the UltraESB. The sample below shows the configuration used in the example, which can be easily modified and extended.
<u:proxy id="text-proxy">
<u:transport id="http-8280"/>
<u:target>
<u:inDestination>
<u:address>http://localhost:9000/service/TextServlet</u:address>
</u:inDestination>
<u:outDestination>
<u:address type="response"/>
</u:outDestination>
</u:target>
</u:proxy>
| < Prev | Next > |
|---|


