Skip to end of metadata
Go to start of metadata
Sample Number101
LevelIntroductory
DescriptionThis sample demonstrates the usage of UltraESB to proxy Text messages/responses

Use Case

I have a service that returns text format responses and I want to proxy this text service and mediate the text responses. 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.

As shown in the above diagram, instead of directly talking to the text service, UltraESB acts as the proxy for all the requests going to the back-end server, making it possible to mediate text responses.

Sample Configuration

The configuration for a text proxy is trivial as it is just a proxy service to forward the messages into the text service back-end and return the response back to the caller.

Proxy service configuration to proxy text responses

The proxy service URL has been specified by the "ultra.transport.url" to be anything starts with the "text-proxy". The request message will be forwarded to the back-end text servlet and the response back to the caller, without any mediation in this case. Adding mediation for the response path is just a matter of adding a out sequence for the target.

Proxy service can handle any content type if not constrained

Unless a content type constraint is forced, a proxy service can handle SOAP, REST, Hessian, JSON, Text or binary etc

In Action

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.

Response from the back-end text servlet
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.

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.

Response from the ESB
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.6.0
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.

Related Samples

Sample NumberSample Title
101Restful proxy services
201Proxying SOAP messages