This post is about a feature in Oracle’s SOA Suite / JDeveloper 10.1.3.x that may easily go unnoticed: the option to publish a BPEL process as a template by using the Mark as Template option in JDeveloper.
The use case is the following: you have assembled a BPEL process that contains functionality that needs to be used in other BPEL processes. A good example is the usage of a generic ‘Error Hospital’ BPEL process from other BPEL processes. This becomes easy to understand and reuse when a sample or template is made available.
In previous BPEL versions, using a BPEL process as a template meant copying the BPEL project folder, renaming the BPEL process and subsequently searching for and replacing all namespaces in it. In 10.1.3.x you publish your BPEL code as a template to make it instantly available to your team members and also easily reusable by them. All it takes are a few simple steps.
When you have finished BPEL process creation, select the option Mark as Template from the context menu (right-click) of the BPEL project folder JDeveloper as shown in the following screen shot.
In the Name your Template screen specify a meaningful name for your template.
Note that the context menu for the BPEL process now reflects that it has been marked as a template.
You can now reuse the template as the basis for a new BPEL project. Create a new BPEL Process Project in JDeveloper. In the BPEL Project Creation Wizard you can now select your new template from the Template drop down box.
Once selected, JDeveloper takes care of renaming the contents of your template for use in your new BPEL process.
Custom templates cannot be managed from within JDeveloper. Templates are stored in XML file ‘template.xml’ that is maintained by JDeveloper in JDEV_HOME/integration/bpm/template. Edit that file for changing the names of your templates or for removing these. Share the file with your team mates through a source code control system. Enjoy!
As Marc rightfully points out, BPEL templating (in release 10.1.3.1) has its limitations. We find it useful for communicating and demonstrating particular concepts in bits and pieces of BPEL code. Typically, the template uses BPEL Empty constructs stating something like yourPartnerLinkCallGoesHere. Be carefull when creating large templates: when you find yourself reusing large BPEL processes your process decomposition may be in need of revision.
You have to be careful with this feature, though.
It will not rename namespaces in all files that are included in the template.
Notably, it does not replace namespaces in wsdl and xsd files.
This can lead to frustrating conflicts when you edit those xsd and/or wsdl files so they have conflicting definitions in the same namespace.