# Proxy Services

A proxy service acts as a service hosted in WSO2 ESB, and typically fronts an existing service endpoint. A proxy service can be created and exposed on a different transport, schema, WSDL, or QoS (such as WS-Security, WS-Reliable Messaging) other than the real service. It can mediate the messages before they are delivered to the actual endpoint and the responses before they reach the client.

Clients can send requests for proxy services directly to the ESB, as the client sees it as a service hosted on WSO2 ESB.For example it can perform the `?wsdl` function and view the WSDL of the virtual proxy service. In the ESB configuration, such requests can be handled anyway you like. You can process the message and send it to the actual service, probably running on a different computer, but it is not necessary to always send the message to the actual service. You can list a combination of tasks to be performed on the messages received for the proxy service and terminate the flow or send a message back to the client even without sending it to the actual service.

## Adding a Proxy Service

From the left navigation menu, select Proxy Service under Manage > Services > Add. This will take you to the Create Proxy Service from Template page.

Figure 1: Select Proxy Service Template

Select a template that suits your mediation requirements. If you are looking to create an advanced proxy service or if none of the available templates matches your requirements, select the Custom Proxy option at the end of the templates list. This will launch the proxy service creation wizard which enables you to customize all aspects of the proxy service including the sequences, endpoints, transport settings, WSDL options and other QoS settings.

The Create Proxy Service from Template page provides you the following set of built-in templates for creating and setting up proxy services easily and quickly.

- Pass Through Proxy
- Secure Proxy
- WSDL Based Proxy
- Log and Forward Proxy
- Transformer Proxy
- Custom Proxy

### Pass Through Proxy

This template can be used to create a simple proxy service on a specified endpoint. Here is no any option availble to define sequences.

This proxy service does not perform any processing on the messages that pass through the proxy.

Figure 2: Pass Through Proxy Template

#### Parameters

- Proxy service settings : User should porvide proxy name and the endpoint URL. Selecting an endpoint can be chossed as direct endpoint or a registry entry.
- WSDL options : If user likes to publish the actual back end service WSDL/ customized WSDL, he can provide the WSDL entry as a registry entry or as a URL or an inline wsdl option. If user doesn't provide the WSDL option, the default WSDL will be published when user request for ?WSDL.
- Transport settings : Proxy service transport options can be specified here.

Note: If the user configures WSO2 ESB with WSO2 Governance Registry and if he uploads all the required files as *.gar file (described in WSO2 GREG documentation), he can provide only the base WSDL under 'WSDl options'. There is no need to provide all required imported schemas as WSDL resources since ESB is able to resolve the imported resources using only the base WSDL. Please note that for the above function user needs to uncomment the following lines @ synapse.properties file which is avilable in ESB_HOME/lib/core/WEB_INF/classes folder.

synapse.wsdl.resolver=org.wso2.carbon.mediation.initializer.RegistryWSDLLocator
synapse.schema.resolver=org.wso2.carbon.mediation.initializer.RegistryXmlSchemaURIResolver

### Secure Proxy

This template can be used to create a proxy with WS-Security engaged. If you wish to expose an existing service with WS-Security you can choose this option.

Figure 3: SecureProxy Template

#### Parameters

In addition to "Pass through proxy" configurations, user should provide the security policy.

- Proxy service settings : User should porvide proxy name and the endpoint URL. Selecting an endpoint can be chossed as direct endpoint or a registry entry.
- WSDL options : If user likes to publish the actual back end service WSDL/ customized WSDL, he can provide the WSDL entry as a registry entry or as a URL or an inline wsdl option. If user doesn't provide the WSDL option, the default WSDL will be published when user request for ?WSDL.
- Transport settings : Proxy service transport options can be soecified here.

Note: If the user configures WSO2 ESB with WSO2 Governance Registry and if he uploads all the required files as *.gar file (described in WSO2 GREG documentation), he can provide only the base WSDL under 'WSDl options'. There is no need to provide all required imported schemas as WSDL resources since ESB is able to resolve the imported resources using only the base WSDL. Please note that for the above function user needs to uncomment the following lines @ synapse.properties file which is avilable in ESB_HOME/lib/core/WEB_INF/classes folder.

synapse.wsdl.resolver=org.wso2.carbon.mediation.initializer.RegistryWSDLLocator
synapse.schema.resolver=org.wso2.carbon.mediation.initializer.RegistryXmlSchemaURIResolver

### WSDL Based Proxy

This template can be used to create a proxy service out of a WSDL of an existing Web Service. Endpoint information is extracted from a remotely hosted WSDL of an actual service.

Figure 4: WSDL Based Proxy Template

#### Parameters

- Proxy service settings : User should porvide proxy name and the WSDL URL,Service and port number.
- WSDL options : If user likes to publish the actual back end service WSDL/ customized WSDL, he can provide the WSDL entry as a registry entry or as a URL or an inline wsdl option. If user doesn't provide the WSDL option, the default WSDL will be published when user request for ?WSDL.
- Transport settings : Proxy service transport options can be soecified here.

Note: If the user configures WSO2 ESB with WSO2 Governance Registry and if he uploads all the required files as *.gar file (described in WSO2 GREG documentation), he can provide only the base WSDL under 'WSDl options'. There is no need to provide all required imported schemas as WSDL resources since ESB is able to resolve the imported resources using only the base WSDL. Please note that for the above function user needs to uncomment the following lines @ synapse.properties file which is avilable in ESB_HOME/lib/core/WEB_INF/classes folder.

synapse.wsdl.resolver=org.wso2.carbon.mediation.initializer.RegistryWSDLLocator
synapse.schema.resolver=org.wso2.carbon.mediation.initializer.RegistryXmlSchemaURIResolver

### Logging Proxy

This template can be used to create a proxy service which logs all the incoming requests and forwards them to a given endpoint. If necessary responses coming back from the backend service can be logged before routing them to the client.

Figure 5:Logging Proxy Template

#### Parameters

- Proxy service settings : User should porvide proxy name and the endpoint URL. Selecting an endpoint can be chossed as direct endpoint or a registry entry. Request and Response log level also should be provided if user wants to log the messages.
- WSDL options : If user likes to publish the actual back end service WSDL/ customized WSDL, he can provide the WSDL entry as a registry entry or as a URL or an inline wsdl option. If user doesn't provide the WSDL option, the default WSDL will be published when user request for ?WSDL.
- Transport settings : Proxy service transport options can be soecified here.

Note: If the user configures WSO2 ESB with WSO2 Governance Registry and if he uploads all the required files as *.gar file (described in WSO2 GREG documentation), he can provide only the base WSDL under 'WSDl options'. There is no need to provide all required imported schemas as WSDL resources since ESB is able to resolve the imported resources using only the base WSDL. Please note that for the above function user needs to uncomment the following lines @ synapse.properties file which is avilable in ESB_HOME/lib/core/WEB_INF/classes folder.

synapse.wsdl.resolver=org.wso2.carbon.mediation.initializer.RegistryWSDLLocator
synapse.schema.resolver=org.wso2.carbon.mediation.initializer.RegistryXmlSchemaURIResolver

### Transformer Proxy

This template can be used to create a proxy service , where user is trying to implement a scenario where an existing service is exposed over a different schema (message format) you can make use of the Transformer Proxy option to easily setup a proxy service which can transform requests and responses based on specified XSLT configurations.

Figure 6:Transformer Proxy Template

#### Parameters

- Proxy service settings : User should porvide proxy name and the endpoint URL. Selecting an endpoint can be chossed as direct endpoint or a registry entry. XSLT tranformation script should be provided as a registry entry.
- WSDL options : If user likes to publish the actual back end service WSDL/ customized WSDL, he can provide the WSDL entry as a registry entry or as a URL or an inline wsdl option. If user doesn't provide the WSDL option, the default WSDL will be published when user request for ?WSDL.
- Transport settings : Proxy service transport options can be soecified here.

Note: If the user configures WSO2 ESB with WSO2 Governance Registry and if he uploads all the required files as *.gar file (described in WSO2 GREG documentation), he can provide only the base WSDL under 'WSDl options'. There is no need to provide all required imported schemas as WSDL resources since ESB is able to resolve the imported resources using only the base WSDL. Please note that for the above function user needs to uncomment the following lines @ synapse.properties file which is avilable in ESB_HOME/lib/core/WEB_INF/classes folder.

synapse.wsdl.resolver=org.wso2.carbon.mediation.initializer.RegistryWSDLLocator
synapse.schema.resolver=org.wso2.carbon.mediation.initializer.RegistryXmlSchemaURIResolver