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:
- 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:
- Select the HelloWorldApp project in the explorer, choose File > New > Project, expand the WSO2 > Repository category, and create a Registry Resource Project called HelloWorldDynamicResources
- Create one folder inside the HelloWorldDynamicResources project for each environment you need to manage, namely Development and QA.
- Create a registry resource for the endpoint in the Development environment:
- Right-click the HelloWorldDynamicResources project and choose New > Registry Resource.
- Choose From existing template and click Next.
Choose the Address Endpoint Template.
Save the resource in the dev folder of the resources project.
- Select 'gov' as the Registry.
Specify a registry path where the resource needs to be deployed, i.e. trunk/endpoints/HelloWorld.
- Append the environment to the artifact name (e.g. HelloWorldServiceEP-Dev).
- Click HelloWorldDynamicResources in the project explorer, choose File > New > Project, expand the WSO2 > Repository category, and create a Registry Resource Project for QA.
- Create a registry resource for the endpoint as you did in step 4, but this time specify the following settings:
- Name the resource HelloWorldServiceEP-QA (the same resource name as the Dev resource) but append "-QA" to the end of the artifact name.
- Specify the registry path as
- Navigate to
HelloWorldServiceEP.xmlinside 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:
- Navigate to
HelloWorldServiceEP.xmlinside 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:
- Edit the
HelloServiceWSDL.xmlinside the Development folder and input the contents of the HelloService WSDL in the Dev environment.
To create and work with static resources:
- Right-click the HelloWorldApp project in the project explorer, choose New > Proxy Service, click Next.
- Select Create a New Proxy Service from the options available. The following window appears:
- Create a Pass Through Proxy service using the endpoint reference from the registry.
- Click on Create new ESB Project and set the name as HelloWorldProxyServices.
- In the Advanced Configuration section, select Pick from Registry.
Set the EndPoint key to
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.
- Edit the proxy service to define the publishing WSDL for the service. Select Design View.
- Right-click on the proxy service in the graphical editor and select 'Show Properties view'.
- Scroll down to the WSDL category and select REGISTRY_KEY as the WSDL Type.
- Click on the icon in the WSDL key row and specify the registry path as
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:
- Select the HelloWorldApp multi-module project.
- Choose File > New > Carbon Application Project from the main Eclipse menu.
- Name the project HelloWorldCApp.
- Select HelloWorldProxyServices in the dependencies list.
- Click Next.
- Set the artifactID to HelloWorld (this ensures a HelloWorld-<versionNumber>.car file is created).
- Click Finish.
- Like above, create the HelloWorldResourcesDevCApp Carbon Application and add the HelloWorldResources Project Dev resources to it.
- Repeat the step above for the QA environment, pointing to the QA resources.
- Your final project structure should now look like this:
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:
Your projects are now ready to be built and deployed.