Not logged in | Login
How To Use Web Service Across Project By Reference
When creating SOA projects like bpel it is often desired to call a service residing in one project from another project. Typically to do this one needs to have the wsdl contract of the invoked service available in the project which wants to call this service.
Copying wsdl from one project to another can accomplish this task but this can lead to duplication of wsdls. Also the side effect is that when the original wsdl contract changes, it is hard to find out who is using it and user needs to redo changes everywhere, the wsdl is copied.
How can we avoid copying wsdl across projects? There is an option available which can avoid copying wsdl and use reference to original wsdl. This is described in details below:
Here we describe high level flow of how to use wsdls across projects when using bpel project in netbeans. Following are the steps:
(1) Create a bpel project (We use SynchronousSample bpel project as available in netbeans which also creates a composite app project which can be used to deploy this bpel project)
The bpel project is shown below. Note it has one wsdl file which specifies the web service implemented in the bpel process.
(2) Create another bpel project and composite app project which can deploy this bpel project:
In this project we will call the service as implemented in SynchronousSample project of step (1).
(3) Add wsdl service by reference:
There are two ways to do it:
Then select "Add Project Resource" option to browse to the location of the wsdl file in another project. (In our case SynchronousSample project as created in step (1)).
Once we select the wsdl file, the "Referenced Resources" node on the project gets updated and it shows the referenced resource:
Above mechanism should be available in most SOA projects.
(4) Under the cover a project level catalog.xml file gets updated and one catalog entry is added for this referenced wsdl. catalog.xml provides the functionality to be able to refer a resource of another project:
(5) When the project is build, it creates a service unit jar file for deployment to the project specific engine. (In this case bpel engine). This service unit jar packages a catalog.xml and also all the referenced resources from other projects:
(6) Once a resource from another project is added, The dialogs in the project which refers artifacts from another project shows the referenced resources as well, so that user can select them. For example when creating a bpel variable the wsdl file (and messages declared in it) from other project is also listed: