Sample Guide - HelloWorld

Objective

Explains the basic constructs like <import/>, <partnerLinks/>, <variables/>.


Prerequisites

  • Log in into BPS server admin console.
  • Under Business Processes -> Add BPEL.
  • Upload the HelloWorld2.zip , (all samples are located at our sample repository.)
  • Under the Business Processes -> Processes.
  • Under the WSDL details widget -> Create instance

Overall Idea

If we look at the basic bpel process, we can observe some general bpel constructs which are compulsory to any process. eg - <import/>, <partnerLinks/>, <variables/>. Let's take a look at on a general structure of a bpel process.

<process
        name="ProcessName"
        targetNamespace="http://wso2.org/bps/samples">

    <import namespace="http://wso2.org/bps/samples/wsdl"
            location="ProcessService.wsdl"
            importType="http://schemas.xmlsoap.org/wsdl/"/>
    <import namespace="http://wso2.org/bps/samples/schema" location="schema.xsd"
            importType="http://www.w3.org/2001/XMLSchema"/>

    <partnerLinks>
        <partnerLink name="PartnerLinkName"
                     xmlns:ns01="http://schemas.xmlsoap.org/wsdl/"
                     partnerLinkType="ns01:ProcessPartnerlinkType"
                     partnerRole="myRole"/>
    </partnerLinks>

    <variables>
        <variable name="VarName"
                  xmlns:ns01="http://schemas.xmlsoap.org/wsdl/"
                  messageType="ns01:ProcessOperationResponse"/>
    </variables>

    <sequence>
        ...
    </sequence>
</process>

Let's understand what those compulsory elements are.

  • <import/> -
    <import location="HelloWorld2.wsdl" namespace="http://ode/bpel/unit-test.wsdl"
            importType="http://schemas.xmlsoap.org/wsdl/"/>
    

    Used to include WSDL and XSD definitions in the BPEL definition.
    Note - need to define namespace prefix for the namespace of imported resource in the BPEL definition in order to refer the imported resources inside BPEL definition.


  • <partnerLinks/> -
    <partnerLinks>
        <partnerLink name="helloPartnerLink"
                     partnerLinkType="test:HelloPartnerLinkType"
                     myRole="me"/>
    </partnerLinks>
    

    This is where the connections to external parties are defined. If there’s any external interaction, partner link should be defined for each of them. Each partner link has one or two partner link types and roles which are defined in the service WSDL.

    For more details on creating partner links and invoking external parties, refer http://wso2.org/library/articles/writing-simple-ws-bpel-process-wso2-bps-apache-ode#establish-partner-link


  • <variables/> -
    <variables>
        <variable name="myVar" messageType="test:HelloMessage"/>
        <variable name="tmpVar" type="xsd:string"/>
        <variable name="tmpDate" type="xsd:dateTime"/>
    </variables>
    

    BPEL variable are used to store the state of the process in the run-time. The type of a variable can be a WSDL message type or XML schema definition.

    For more details on defining variables, referring and modifying variables, refer http://wso2.org/library/articles/writing-simple-ws-bpel-process-wso2-bps-apache-ode#variable-manipulation