Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » BPEL Designer » Please help! Simple BPEL Process.
Please help! Simple BPEL Process. [message #888676] Mon, 18 June 2012 13:15 Go to next message
Hussein Mohsen is currently offline Hussein MohsenFriend
Messages: 2
Registered: June 2012
Junior Member

Hi all,

I'm very new to BPEL and I need the code of a simple BPEL process to proceed with my project as I'm running out of time.

The process takes 2 numbers x and y as inputs and returns (or sends or ...) their division x/y.

Thanks in advance.
Re: Please help! Simple BPEL Process. [message #889986 is a reply to message #888676] Wed, 20 June 2012 13:41 Go to previous messageGo to next message
Robert Brodt is currently offline Robert BrodtFriend
Messages: 811
Registered: August 2010
Location: Colorado Springs, CO
Senior Member

Are you asking us to do your homework for you? Wink

Start by creating a synchronous process (using the New BPEL Process wizard), then add an Assign immediately after the Receive. The Assign can be used to assign an XPath expression to the result variable. The calculation can be done in the expression.

HTH,
Bob
Re: Please help! Simple BPEL Process. [message #892983 is a reply to message #889986] Mon, 02 July 2012 08:30 Go to previous messageGo to next message
Hussein Mohsen is currently offline Hussein MohsenFriend
Messages: 2
Registered: June 2012
Junior Member

Lol no, it is not an assignment but a research step.

This is what I have reached, is there any misplacement of some tags?

Thanks.

<process name="divisionProcess">

<partnerLinks>
<partnerLink name="PL" partnerLinkType="PLT" myrole="dividingXandY" partnerRole="sendingXandY" />
</partnerLinks>

<message name="number">
<part name="value" type="xsd:int"/>
</message>

<variables>
<variable name="X" messageType="number" />
<variable name="Y" messageType="number" />
<variable name="Result" messageType="number" />
<variables>

<sequence>
<receive partnerLink="PL" variable="X" operation="req"/>
<receive partnerLink="PL" variable="Y" operation="req"/>

<assign>
<copy>
<from expression="bpws:getVariableProperty('X', 'value') / getVariableProperty('Y', 'value')"/>
<to variable="Result" part="value"/>
</copy>
</assign>

<reply partnerLink="PL" variable="Result" operation="ack"/>

</sequence>
</process>












































Re: Please help! Simple BPEL Process. [message #893351 is a reply to message #892983] Tue, 03 July 2012 16:15 Go to previous messageGo to next message
Robert Brodt is currently offline Robert BrodtFriend
Messages: 811
Registered: August 2010
Location: Colorado Springs, CO
Senior Member

Hi Hussein,

I'm wondering how this process file was generated because there are several problems with it, both syntactically and semantically:

* the <process> element should include either a "http://docs.oasis-open.org/wsbpel/2.0/process/executable" or "http://docs.oasis-open.org/wsbpel/2.0/process/abstract" namespace declaration
* the <variables> element does not have closing </variables> tag
* the <from> element should not have an "expression" attribute - the expression should just be written as CDATA enclosed in the <from> and </from> tags
* it is highly unusual to have two <receive> elements in a row, and the first one must have its "createInstance" attribute set to "yes"
* none of the XSD types or partner link types are defined and the process does not include an <import> which is typically where these types would be defined

Are you trying to import a BPEL process generated by a tool used for some non-standard runtime?

HTH,
Bob
Re: Please help! Simple BPEL Process. [message #893352 is a reply to message #893351] Tue, 03 July 2012 16:16 Go to previous message
Robert Brodt is currently offline Robert BrodtFriend
Messages: 811
Registered: August 2010
Location: Colorado Springs, CO
Senior Member

Here's the solution that I generated using the BPEL editor:

First, the "Division" bpel process file:

<!-- Division BPEL Process [Generated by the Eclipse BPEL Designer] -->
<!-- Date: Tue Jul 03 10:23:05 MDT 2012 -->
<bpel:process name="Division"
         targetNamespace="http://eclipse.org/bpel/sample"
         suppressJoinFailure="yes"
         xmlns:tns="http://eclipse.org/bpel/sample"
         xmlns:bpel="http://docs.oasis-open.org/wsbpel/2.0/process/executable"
         >

    <!-- Import the client WSDL -->
	<bpel:import location="DivisionArtifacts.wsdl" namespace="http://eclipse.org/bpel/sample" 
	        importType="http://schemas.xmlsoap.org/wsdl/" />
         
    <!-- ================================================================= -->         
    <!-- PARTNERLINKS                                                      -->
    <!-- List of services participating in this BPEL process               -->
    <!-- ================================================================= -->         
    <bpel:partnerLinks>
        <!-- The 'client' role represents the requester of this service. -->
        <bpel:partnerLink name="client"
                     partnerLinkType="tns:Division"
                     myRole="DivisionProvider"
                     />
    </bpel:partnerLinks>
  
    <!-- ================================================================= -->         
    <!-- VARIABLES                                                         -->
    <!-- List of messages and XML documents used within this BPEL process  -->
    <!-- ================================================================= -->         
    <bpel:variables>
        <!-- Reference to the message passed as input during initiation -->
        <bpel:variable name="input"
                  messageType="tns:DivisionRequestMessage"/>
                  
        <!-- 
          Reference to the message that will be returned to the requester
          -->
        <bpel:variable name="output"
                  messageType="tns:DivisionResponseMessage"/>
    </bpel:variables>

    <!-- ================================================================= -->         
    <!-- ORCHESTRATION LOGIC                                               -->
    <!-- Set of activities coordinating the flow of messages across the    -->
    <!-- services integrated within this business process                  -->
    <!-- ================================================================= -->         
    <bpel:sequence name="main">
        
        <!-- Receive input from requester. 
             Note: This maps to operation defined in Division.wsdl 
             -->
        <bpel:receive name="receiveInput" partnerLink="client"
                 portType="tns:Division"
                 operation="process" variable="input"
                 createInstance="yes"/>
        
        <!-- Generate reply to synchronous request -->
        <bpel:assign validate="no" name="Divide">
            <bpel:copy>
                <bpel:from><bpel:literal><tns:DivisionResponse xmlns:tns="http://eclipse.org/bpel/sample" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <tns:result>tns:result</tns:result>
</tns:DivisionResponse>
</bpel:literal></bpel:from>
                <bpel:to variable="output" part="payload"></bpel:to>
            </bpel:copy>
            <bpel:copy>
                <bpel:from>
                    
                    
                    <![CDATA[$input.payload/tns:x div $input.payload/tns:y]]>
                </bpel:from>
                <bpel:to part="payload" variable="output">
                    <bpel:query queryLanguage="urn:oasis:names:tc:wsbpel:2.0:sublang:xpath1.0">
                        <![CDATA[tns:result]]>
                    </bpel:query>
                </bpel:to>
            </bpel:copy>
        </bpel:assign>
        <bpel:reply name="replyOutput" 
               partnerLink="client"
               portType="tns:Division"
               operation="process" 
               variable="output"
               />
    </bpel:sequence>
</bpel:process>


And next the generated "DivisionArtifacts" WSDL file:


<?xml version="1.0"?>
<definitions name="Division"
        targetNamespace="http://eclipse.org/bpel/sample"
        xmlns:tns="http://eclipse.org/bpel/sample"
        xmlns:plnk="http://docs.oasis-open.org/wsbpel/2.0/plnktype"
        xmlns="http://schemas.xmlsoap.org/wsdl/"
        xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
        >

<!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     TYPE DEFINITION - List of types participating in this BPEL process 
     The BPEL Designer will generate default request and response types
     but you can define or import any XML Schema type and use them as part 
     of the message types.
     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->    
    <types>
        <schema attributeFormDefault="unqualified" elementFormDefault="qualified" 
                targetNamespace="http://eclipse.org/bpel/sample" 
                xmlns="http://www.w3.org/2001/XMLSchema">

            <element name="DivisionRequest">
                <complexType>
                    <sequence>
                    	<element name="x" type="string" />
                    	<element name="y" type="string"></element>
                    </sequence>
                </complexType>
            </element>

            <element name="DivisionResponse">
                <complexType>
                    <sequence>
                        <element name="result" type="string"/>
                    </sequence>
                </complexType>
            </element>
        </schema>
    </types>


<!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     MESSAGE TYPE DEFINITION - Definition of the message types used as 
     part of the port type defintions
     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->    
    <message name="DivisionRequestMessage">
        <part name="payload" element="tns:DivisionRequest"/>
    </message>
    <message name="DivisionResponseMessage">
        <part name="payload" element="tns:DivisionResponse"/>
    </message>

<!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     PORT TYPE DEFINITION - A port type groups a set of operations into
     a logical service unit.
     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->    

    <!-- portType implemented by the Division BPEL process -->
    <portType name="Division">
        <operation name="process">
            <input  message="tns:DivisionRequestMessage" />
            <output message="tns:DivisionResponseMessage"/>
        </operation>
    </portType>   
<!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     PARTNER LINK TYPE DEFINITION
     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->    
    <plnk:partnerLinkType name="Division">
        <plnk:role name="DivisionProvider" portType="tns:Division"/>
    </plnk:partnerLinkType>
    

<!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     BINDING DEFINITION - Defines the message format and protocol details
     for a web service.
     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
    <binding name="DivisionBinding" type="tns:Division">
    	<soap:binding style="document"
    		transport="http://schemas.xmlsoap.org/soap/http" />
    	<operation name="process">
    		<soap:operation
    			soapAction="http://eclipse.org/bpel/sample/process" />
    		<input>
    			<soap:body use="literal" />
    		</input>
    		<output>
    			<soap:body use="literal" />
    		</output>
    	</operation>
    </binding>

<!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     SERVICE DEFINITION - A service groups a set of ports into
     a service unit.
     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
    <service name="DivisionService">
    	<port name="DivisionPort" binding="tns:DivisionBinding">
    		<soap:address location="http://localhost:8080/Division" />
    	</port>
    </service>
</definitions>

[Updated on: Tue, 03 July 2012 16:29]

Report message to a moderator

Previous Topic:BPEL 2 INPUTS
Next Topic:[SOLVED] deploy.xml and missing Associated Port
Goto Forum:
  


Current Time: Thu Apr 25 01:40:18 GMT 2024

Powered by FUDForum. Page generated in 0.03596 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top