This site contains the documentation that is relevant to older WSO2 product versions and offerings.
For the latest WSO2 documentation, visit https://wso2.com/documentation/.

Pass-through Proxy Service with an Endpoint Reference

This section describes how the developer creates the registry resource and proxy configuration projects and submits all projects to a SVN repository.

To create the project:

  1. In Developer Studio, choose File > New > Project, expand the WSO2 > Maven Project category, and create a Maven Multi Module Project called HelloWorldApp.

To create and work with dynamic resources:

  1. Select the HelloWorldApp project in the explorer, choose File > New > Project, expand the WSO2 > Repository category, and create a Registry Resource Project called HelloWorldDynamicResources
  2. Create one folder inside the HelloWorldDynamicResources project for each environment you need to manage, namely Development and QA.
  3. Create a registry resource for the endpoint in the Development environment:
    1. Right-click the HelloWorldDynamicResources project and choose New > Registry Resource.
    2. Choose From existing template and click Next.
    3. Choose the Address Endpoint Template.

    4. Save the resource in the dev folder of the resources project.

    5. Select 'gov' as the Registry.
    6. Specify a registry path where the resource needs to be deployed, i.e. trunk/endpoints/HelloWorld.

    7. Append the environment to the artifact name (e.g. HelloWorldServiceEP-Dev).
  4. Click HelloWorldDynamicResources in the project explorer, choose File > New > Project, expand the WSO2 > Repository category, and create a Registry Resource Project for QA.
  5. Create a registry resource for the endpoint as you did in step 4, but this time specify the following settings:
    1. Name the resource HelloWorldServiceEP-QA (the same resource name as the Dev resource) but append "-QA" to the end of the artifact name.
    2. Specify the registry path as _system/governance/branches/qa.
  6. Navigate to HelloWorldServiceEP.xml inside the Development resources project folder, double-click the file, click the Source tab, and then make it point to HelloWorldService in the Dev environment by changing the URL to:  http://10.200.3.92:9764/services/t/dev-as.com/HelloService/ .
  7. Navigate to HelloWorldServiceEP.xml inside the QA resources project folder, double-click the file, click the Source tab, and then make it point to HelloWorldService in the QA environment by changing the URL to: http://10.200.3.92:9764/services/t/qa-as.com/HelloService/.
  8. Edit the HelloServiceWSDL.xml inside the Development folder and input the contents of the HelloService WSDL in the Dev environment.

To create and work with static resources: 

  1. Right-click the HelloWorldApp project in the project explorer, choose New > Proxy Service, click Next.
  2. Select Create a New Proxy Service from the options available. The following window appears:
     
  3. Create a Pass Through Proxy service using the endpoint reference from the registry.
  4. Click on Create new ESB Project and set the name as HelloWorldProxyServices.
  5. In the Advanced Configuration section, select Pick from Registry.
  6. Set the EndPoint key to gov:/endpoints/HelloWorld/HelloWorldServiceEP.xml. 

    Note that gov: indicates that we are using the governance section of the registry, and the remaining part of the path is what is exposed to the ESB. This URL remains the same across all environments. Therefore, this one proxy service can be used in all environments and it calls the correct endpoint for the current environment.

  7. Edit the proxy service to define the publishing WSDL for the service. Select Design View.
    1. Right-click on the proxy service in the graphical editor and select 'Show Properties view'.
    2. Scroll down to the WSDL category and select REGISTRY_KEY as the WSDL Type.
    3. Click on the icon in the WSDL key row and specify the registry path as gov:wsdls/HelloWorld/HelloWorldServiceWSDL.xml.

The projects setup is now complete. You now need to create CApp projects for each of the Composite Applications you want to generate. The ESB code must go in its own CApp, and you create a separate CApp for the resources of each environment.

The proxy service needs to go in its own CApp. For resources, you have the choice of:

  • Packaging all resources in a single CApp: in this case, when you deploy the application to the registry, all the resources you have defined (Dev and QA in this case) are created/updated in the registry.
  • Packaging resources for a single environment in their own CApp - In this case, you need to deploy each application separately.

This choice depends essentially on the amount of control you want over deployment and management of the resources. In the next steps, we show you how to create one CApp per environment.

To create a HelloWorldCApp Carbon Application project:

  1. Select the HelloWorldApp multi-module project.
  2. Choose File > New > Carbon Application Project from the main Eclipse menu.
     
  3. Name the project HelloWorldCApp.
  4. Select HelloWorldProxyServices in the dependencies list.
  5. Click Next.
  6. Set the artifactID to HelloWorld (this ensures a HelloWorld-<versionNumber>.car file is created).
  7. Click Finish.
  8. Like above, create the HelloWorldResourcesDevCApp Carbon Application and add the HelloWorldResources Project Dev resources to it.
     
  9. Repeat the step above for the QA environment, pointing to the QA resources.
  10. Your final project structure should now look like this:
  11. Right-click the top project (HelloWorldApp) and invoke Generate POM - Select all the HelloWorld projects, which are then added as modules to the top multi-module Maven project. If you look at the top project pom.xml, you should see the following entries inside:

    <modules>
        <module>HelloWorldProxyServices</module>
        <module>HelloWorldResources</module>
        <module>HelloWorldCApp</module>
        <module>HelloWorldResourcesDevCApp</module>
      	<module>HelloWorldResourcesQACApp</module>
    </modules>

Your projects are now ready to be built and deployed.