Creating a Proxy Service
You can create a new proxy service or import an existing proxy service from an XML file, such as a Synapse configuration file using WSO2 Integration Studio.
Prerequisites
You need to have WSO2 Integration Studio installed to create a new proxy service or to import an existing proxy service. For instructions on installing WSO2 Integration Studio, see Installing WSO2 Integration Studio.
Step 1: Creating a new proxy service
Following sections describe how you can create a new proxy service.
Open WSO2 Integration Studio and click ESB Project → Create New in the Getting Started tab as shown below.
Enter a project name and click Finish.
Right-click the SampleServices project in the navigator and go to New → Proxy Service to open the New Proxy Service dialog.
Importing a proxy service?
If you already have a proxy service created, you have the option of importing the XML configuration. Select Import Proxy Service and follow the instructions on the UI. To create a new proxy service from scratch, continue with the following steps.
Select Create New Proxy Service and click Next.
Type a unique name for the proxy service, and select a proxy service template from the list shown below. These templates will automatically generate the mediation flow that is required for each use case.
The use cases covered by each template are explained below.
Template Type Description Pass-Through proxy This template creates a proxy service that forwards messages to the endpoint without performing any processing. Transformer proxy This template creates a proxy service that transforms all the incoming requests using XSLT and then forwards them to a given endpoint. It can also transform responses from the backend service. You need to simply specify the location of the XSLT you want to use. Log Forward proxy This template creates a proxy service that first logs all the incoming requests and passes them to a given endpoint. It can also log responses from the backend service before routing them to the client. You can specify the log level for requests and responses, where Simple logs To
,From
,WSAction
,SOAPAction
,ReplyTo
,MessageID
, and any properties, and Full logs all attributes of the message plus the SOAP envelope information.WSDL-Based proxy This template generates a proxy service from the remotely hosted WSDL of an existing web service. The endpoint information is extracted from the WSDL. In the URI field, enter the URL and URN of the WSDL. The URL defines the host address of the network resource (can be omitted if resources are not network homed), and the URN defines the resource name in local namespaces. For example, if the URL is ftp://ftp.dlink.ru
and the URN is/pub/ADSL/
, you would enterftp://ftp.dlink.ru/pub/ADSL/
for the URI. To ensure that the URI is valid, click Test URI. You then enter the service name and port of the WSDL. Lastly, if you want to publish this WSDL, click Publish Same Service Contract.Secure proxy This template creates a proxy service that uses WS-Security to process incoming requests and forward them to an unsecured backend service. You simply need to provide the policy file that should be used. Custom proxy This template creates an empty proxy service file, where you can manually create the mediation flow by adding all the sequences, endpoints, transports, and other QoS settings. In the Save in field, enter the project folder where the proxy service should be saved.
If you don't have an already created project, click Create New ESB Project to create one.
- Click Finish. The proxy service is created in the src/main/synapse-config/proxy-services folder under the project you specified, and the proxy service appears in the editor. Click its icon in the editor to view its properties.
You also have the option of using the management console to create proxy services: Click the Main tab on the management console, go to Manage -> Services -> Add, and then click Proxy Service. The Create Proxy Service from Template screen appears.
Step 2: Update the mediation flow in the proxy service
Once you have created a proxy service file as explained above, you can update the mediation flow by adding new mediation artifacts and changing the existing artifacts (which were generated for the template you selected).
- First, open the proxy service configuration file from the project explorer.
You can use either the design view or the source view to update the mediation flow. Shown below is an example of a PassThrough proxy service:
Step 3: Deploying the proxy service in the ESB server
Once you have added the security policy to your proxy service as explained in the previous topics, you need to create a Composite Application project with a CAR file. You can then deploy the CAR file in the ESB server:
- Right-click the Project Explorer and click New > Project.
- From the window that opens, click Composite Application Project.
Give a name to the Composite Application project and select the projects that you need to group into your C-App from the list of available projects. You need to select the ESB project, which contains the proxy service and security policy file respectively.
- Next, deploy the CAR file in the ESB server.