A Proxy service is a way of triggering a mediation flow defined in the ESB of WSO2 Enterprise Integrator (WSO2 EI). Alternatively, you can use REST APIs, Inbound Endpoints, Scheduled Tasks or Topics and Events.
Overview of proxy services
A proxy service is a virtual service that receives messages and optionally processes them before forwarding them to a service at a given endpoint. This approach allows you to perform necessary transformations and introduce additional functionality without changing your existing service. For example, if you want to use WS-Security with an existing, unsecured service, you can create a secure proxy service with WS-Security enabled with a specified security policy. Additionally, if you want a service to handle messages that are in different formats, you can create a Transformer proxy service to transform requests and responses based on specified XSLT configurations. A proxy service can also switch transports, process the messages with mediation sequences and tasks and terminate the flow or send a message back to the client even without sending it to the actual service.
Proxy Service vs. Proxy Server
Do not confuse a proxy service, which processes messages on their way to a service, with a proxy server, which acts as an intermediary for handling traffic to a server. For information on how to configure the ESB profile to route messages through a proxy server, see Working with Proxy Servers.
Each service could define the target for received messages as a named sequence or a direct Target
inSequence or endpoint ), and a target
outSequence defines how responses should be handled.
To create a dynamic proxy, specify the properties of the proxy as dynamic entries by referring to them with the
key attribute. For example, you could specify the
inSequence or endpoint with a remote key instead of defining it in the local configuration. As the remote registry entry changes, the properties of the proxy are updated accordingly.
The proxy service definition itself cannot be specified dynamically. That is, you cannot specify
Elements of a proxy service
Shown below is a Synapse proxy service's XML configuration. For additional samples of manual proxy service configurations, see Proxy Service Samples.
The elements used in the above configuration are explained below.
The target of a proxy service can be defined by adding an endpoint artifact to the proxy service, or by defining the required mediation logic inside the in-sequence of the proxy service. Consider an example, where the proxy service should route messages to a back-end service named StockQuoteService. The URI to access this back-end service is http://localhost:9000/services/SimpleStockQuoteService.
Shown below is an example of how an endpoint artifact is used to define this target.
Shown below is an example of how a mediation logic is defined in the in-sequence to define this endpoint. In this example, the Call mediator is used.