Sunday, May 24, 2015

BPEL partner links simplified for java developers

If you have come across the need to create a BPEL process invoking a web service, you surely had to deal with partner links, port types and many other terminologies. Until you get the hang of it , it is somewhat confusing on what they actually do. So this is a simple explanation on how you can keep in mind the usage of these properties so you know when and how to use them.

Partner links are used to link all the external web services that a bpel process deals with. It's somewhat a reference/declaration , so that you can define how and where our bpel process would interact with a given web service.  The basic structure of a partner link is as follows.

    Partner Link
      --- Partner Link Type
                    ---  Port Type
                         ---  operation

for example a sample partner link would like like  this.
<plink:partnerLinkType name="loanProcessorEjbPartner">

    <plink:role name="loanProcessorEJB"
                portType="ns:LoanProcessorEJBSEI">

    </plink:role>

  </plink:partnerLinkType>
As a Java developer, it will be much easier for you to understand this definition, if you think of each section in java terminology. Now try to think of the structure with the meanings of terminologies in red.

Partner Link
      --- Partner Link Type ( Abstract class)
                    ---  Port Type (Interface)
                         ---  operation (methods defined in the interface)

Wasn't that much easier? A partner link type is something like an abstract class, that would implement the interface (port type) ,which contains the method (operation). So basically we are creating a relationship with a partner link by saying, at this invoke of a web service, we will be executing this certain operation defined in this interface, by using this abstract class.

Another important point is the partner role that will be defined. This partner role will tell if it's a service provider or a service consumer. So if you define a 'myRole' it will mean that the  bpel process you created will act as the service provider and vice versa.

Once you grasp these concepts, invoking a web service and creating a bpel process is not going to be hard. In fact, you could look into [1] which explains how to invoke a web service with a bpel process using WSO2 BPS.  Also you could go through [2] to gain more information on how BPEL works.

[1] http://wso2.com/library/tutorials/2011/04/using-carbon-studio-model-wsbpel-process-using-bpel-editor/

[2]BPEL for Java Developers - ActiveVOS

No comments:

Post a Comment