Simple HTTP proxy service with UltraESB-X

A glance into AdroitLogic Ultra Studio and UltraESB-X

I recently tried out the AdroitLogic . UltraStudio is AdroitLogic’s latest product which was released in January 2017. Their previous ESB, known in the name UltraESB was there for around 6 years offering a high level of performance and higher reliability while being a lightweight ESB. While preserving those renowned qualities UltaESB‘s successor, UltraESB-X is coming out with a new design and with a very user friendly, easy to use user interface which is an . I will give you a brief idea on how it was like to work with UltraStudio for the first time and will show you some use cases of UltraESB-X.

UltraESB-X — Design Overview

UltraStudio come out with concept of . A project can have multiple , which are to represent possible message flows. That is, an Integration Flow will have the following components.

  • — This is the connector responsible of sending messages out of the Integration Flow. As in the ingress connector, egress connector will make use of the underlying transport sender implementations like HTTP sender, JMS sender and etc.
  • — This is the component which will be seen by the users. If a user want to use a HTTP listener, user has to drag and drop a HTTPIngressConnector to the integration flow and configure its listening port. In the runtime, the connector will take necessary steps to build and start a HTTP transport listener if there is not transport listener listening on the given port.
  • — This is the underlying transport listener which is actually listening to requests coming to a given service path, files coming to a given directory or mesmessages coming to a given message queue. There are different types of underlying transport listeners depending on the underlying transport we are willing to use. Examples are HTTP, HTTPS, FTP, SFTP and JMS transport listeners. The users will not directly see these listeners. Instead, Ingress connectors are the entity which is responsible of offering the functionalities of the underlying transport listeners.
  • — These are the elements in an integration flow which are responsible for processing messages. A processing element can be there to add a header to a message, to convert XML payloads to JSON payloads and many more.
  • — This is the underlying transport sender responsible for sending messages out of the server. Therefore, there can be multiple egress connectors sharing the same transport sender if all those egress connectors want to send messages to the same endpoint.

In order to try and see how user friendly UltraStudio is, I decided to try out some common scenarios expected to be fulfilled by an ESB (Enterprise Service Bus). Acting as an proxy server is one such common use case. In the first section of this article I will explain you how I have setup an HTTP proxy service using UltraStudio. Then I will explain you how I configured the same thing to work with HTTPS along with 2 way SSL.

What is a proxy service?

A proxy service can be considered as another computer/server which is lying in between the client and the actual endpoint. In the most common scenario, the proxy servers are configured at the gateways of local area networks. Therefore they are covering up the actual identities of the clients in an internal network from the outside networks, most probably from the internet.

The other type of proxy servers are used closer to the servers where the proxy server act as a gateway to the internet hiding an internal network of enterprise servers. We do not hear about them in day-to-day life. These type of proxy servers are used for security, scalability, high availability and load balancing purposes. UltraStudio provides convenient methods to implement this type of proxy services.

Here we go …

To create an UltraStudio project, you need IntelliJ Idea community edition installed and you need to install the plugin. Once done, go to . You will then get the following window.

As shown in the above figure, select an . Then, you have to specify some parameters like and for configuring the maven project being created.

Then, you have to select the connectors required for your project. Since I only need the HTTP connector, I have selected the only. Of course you can add more connectors later when you start building the integration flows through the UI.

Now, the processing elements known as . You can select as many of these inbuilt processing elements which will be used in your project. Also, you can write your own processing elements in a project in order to process the messages.

Now we are one step away from starting working on our project. Next you have to give a project name and a location for the project. Then we are good to go.

Step 2 — Our First Integration Flow

Ok. Now, we are going to build our first integration flow which is going to be a proxy service.

The above figure show the new project’s structure. This is equivalent to the maven project structure except that there is a directory in src/main. In fact, this is a maven project. We usually create integration flows in the directory. Just right click on that directory and select . Then, give a name to the integration flow (say “http-proxy”). Then a new file be created in the name which is where we are going to design our integration flow.

The above figure shows what it will contain when you open the http-proxy.xcml file. Wait … where’s the so called user friendliness? It is there. In the tab in the bottom left corner. Let’s go there. There we are in our working space. All the connectors and processors we selected when we were creating the project are listed in your left side pane.

Now, it’s playtime … Wanna drag some pictures and draw some arrows just as we used to when we were kids? Here we go.

We are now going to our integration flow. What does a proxy need? Yes, it has to listen for incoming HTTP requests. Then it has to send those requests to the actual endpoint. In between, we may need to log the request details for audit purposes. That means, we need an ingress connector, a processing element which can log and an egress connector which can send requests to the actual endpoint. Therefore will be your ingress connector and will be your egress connector.

First, we will drag and drop the NIO HTTP Listener. Once we drop it, a pane will appear from below asking the and the of the connector. Here, the port means the port on which the underlying listener (of the connector) will be listening on. As I have mentioned earlier, multiple connectors can share the same underlying listener when all those connectors want to listen on the same port. Service path is the suffix of the URL in which this connector is interested in. For example, if your connector’s port is 80 and your domain name is “”, the service path of the request is . So, this is how it will look like once you are done with the connector. There are also some, advanced configurations that can be done in the pane below. I will leave it up to you to explore.

That completes the listening part of our integration flow. Now the processing part. What do we need to do when we receive a request? Let’s assume we need to add an authentication header. Drag and drop a new element and fill in the header details as below.

Now, the NIO HTTP Sender for the egress connector. In this element’s configuration you have to specify the endpoint details including , and the , to which the requests are forwarded to. I have used an online JSON hosting API for this example. So, I want to direct my requests to which will return “{“status”:”success”}” JSON string as response.

Now, all we have to do is, connecting these elements with arrows. The (top most white dot) of NIO HTTP Listener has to be connected to the (grey dot on the left side) of the processing element. The (white dot on right) has to be connected to the input of the NIO HTTP Sender. Finally, since we need to send the response back to the client, the sender’s has to be pointed to the input of the NIO HTTP Listener. Now we are done.

That is our first integration flow. Note that I haven’t connected the dots of any element which are to process any error situation when receiving, processing or sending requests in order to keep this introduction simple.

If you are curious, you can go and see what has happened to the text in which is the other tab. It will be like this. What UltraStudio has done is, making everything simple for the user to design and visualize his/her design.

Step 3 — Does it work?

Let’s see if it works. First, you have to build your maven project. Go to terminal and run to build the maven project. To run this project, you have to add a new run configuration. Go to run/debug configurations and add a new . The configuration details will be auto filled. All you have to do is just run the newly created configuration. When you run it, you will see a set of log lines saying several components corresponding to your project has started. It will also say that out NIO HTTP Listener has started on the port we gave.

Now, we have to send a request to the NIO HTTP Listener which we configured. To do that you can use the plugin. Open it and add a new . Then fill in the URL to which we want to send the request. In this example, we setup the listener to listen on port 8280. Therefore the proxy’s URL is Remember the service path we gave, .

Now just send a GET request and wait for the response. If you followed this article correctly, you should have got the same correct response similar to me.

What’s next?

I just explained you how to set up an HTTP proxy service. You can do the same with HTTPS using the corresponding connectors. I will leave it up to you. When you are configuring HTTPS, you need to do some additional configurations like providing truststore paths and identity store paths. Go on, it will be fun. Thanks for following this article.

Originally published at on August 20, 2017.



A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Imesha Sudasingha

Associate Technical Lead @WSO2 | Promoting Opensource | Member @TheASF