
Creating a proxy
When we need to create a service based on a SOAP web service, we will open the Developer Studio dashboard and follow these steps:
- Click on Proxy Service.
- Choose Create a New Proxy Service and click Next.
- In this window, we will enter the following information:

- Proxy Service Name: The name of the service.
- Proxy Service Type: These are common and simple scenarios where only a little information is needed to build the service, so we will be asked for that information here. Thus, the proxy will be created with all the needed artifacts and further customizations will not be necessary. In other words, we will create our server at once in this wizard. Depending on which service type we choose, the advanced configuration option will change, showing the required information in each case. The available types are as follows:
- Pass Through Proxy: In this scenario, the service just sends the information to the endpoint without any content processing. The WSDL exposed in this case is a generic one, and, of course, different from the backend web service.
- Custom Proxy: This is the scenario we must choose when we are building a complex service that suits none of the other scenarios.
- Transformer Proxy: In this scenario, the service modifies the message content, performing an Extensible Stylesheet Language (XSL) transformation. This transformation can be executed in the incoming flow, prior to sending it to the backend, and/or in the outcoming flow, transforming the response received from the backend before responding to the consumer.
- Log Forward Proxy: This scenario is similar to the Pass Through Proxy. The message is sent as is, but it allows you to log the message sent to the backend as well as the received one.
- WSDL Based Proxy: This scenario is the same as for the Pass Through Proxy and allows you to set the WSDL for the proxy. This may be the same as the backend or a custom one.
- Secure Proxy: Again, this scenario is a pass-through scenario but, additionally, it allows you to secure the web service, attaching a secure policy to the proxy.
- Save the proxy service in: As it says, here we choose the ESBConfig Project where we add the service.
- Advanced configuration: Here, we add the additional information required by the Proxy Service Type established earlier.
- Click on Finish, and we will see our service in the ESBConfig Project chosen:

- We can start editing our proxy by double-clicking on the My1stProxy.xml file that you can see in the preceding image. The edition screen will be shown, as follows:

- On the right-hand side, we can see a diagram showing the proxy design. The proxy design can be structured in these parts:
- In flow: Here, we place the logic that processes the incoming messages sent to the proxy.
- Out flow: Here, we place the logic for the outcoming messages; these are the responses received from an endpoint.
- Fault flow: Here, we implement the behavior that must be triggered when an error occurs during the flow.
- On the left-hand side, we can see the palette where we have all the artifacts available to build our services.
- To use these components, we just have to drag them from the palette and drop them in the correct area. We will discuss these components further in the next chapter.
As a best practice based on our experience, it is better for the incoming sequence, outcoming sequence, and the fault sequence to define sequences where we implement the logic. In other words, in proxy, we just link to sequences instead of implementing the logic in the proxy itself as you see in the following image:

We shall discuss more about sequences in the next section.
The truth behind the scene can be seen if we click on the Source tab, which we can find in the left-bottom corner of the proxy editor:

In this tab, we can see the proxy XML code:

As we acquire knowledge on WSO2EI, sometimes it will be useful to edit this XML code rather than using the visual editor in Eclipse.