Tag Archives: soa

BPEL structured activities: Pick with Ecplipse -2-

BPEL’s Pick activity

  1. Create a new BPEL project named “BPEL_Pick” by selecting File→New→Others→BPEL 2.0→BPEL Project. Select Next. Type the project name as BPEL_Pick and select the Target Runtime as Apache ODE 1.x Runtime. Click Finish.
  2. Create a new BPEL process file named PickSample by right clicking on the BPEL_Pick/bpelContent folder, select New→Others→BPEL 2.0→New BPEL Process File. Click Next. Fill in BPEL Process Name the stringPickSample, and in the Namespace the string http://pick.bpel.tps. Select the Template as Synchronous BPEL Process. Click Next.
  3. Modify the Service Address as http://localhost:8080/ode/processes/PickSample (suppose that your Tomcat environment is running on port 8080). Click Finish.

  4. Open the PickSampleArtifacts.wsdl file in your project. Right click on the PickSample Port Type. Select Add Operation.
  5. Rename the new operation as sayGoodbye . Rename the existing operation from process to sayHello.

  6. Open the Outline→Bindings→PickSampleBinding. In the Properties view. Click Generate Binding Content... Keep default declaration, select Overwrite existing binding InformationFinish.

  7. Open the PickSample.pbel file to design the process. Click and drag the Pick activity from the Palette to the process before the receiveInput activity.
  8. In the Details tab of the Pick activity, select the option Create a new Process instance if one does not already exist.
  9. Remove the receiveInput activity and move the replyOutput activity to the OnMessage event, inside the Pick. Click and drag an Assign activity to the process, before the replyOutput. A Sequence is automatically created.

  10. Click on the OnMessage activity. In the Details tab, select the operation sayHello.

  11. Right click on the Pick activity. Select Add OnMessage. In the Details tab, select the operation sayGoodbye. Add an Assign activity and a Reply activity to the sayGoodbye branch.

  12. Click on the Reply activity of the sayGoodbye branch, in the Details tab, assign the PickSample→sayGoodbye→sayGoodbyeResponse→parameters→out to the clientResponse variable.

  13. The same way with the replyOutput activity, assign PickSample→sayHello→PickSampleResponseMessage→payload→result to the output variable.
  14. Click on the Assign activity, select Details→New. Assign the expression concat(“Hello ”,$input.payload/tns:input) to the output→payload→result variable. A pop-up dialog appears asking you about the variable initiation. Select Yes.

  15. The same way, at the Assign1 activity, assign the expression concat(“Goodbye ”,$clientRequest.parameters/tns:in) to the clientResponse→parameters→out variable.
  16. It’s now finish the design part. Verify that there is no error in the dessign. We move to the service declaration and registration.
  17. Right click on the BPEL_Pick/bpelContent folder, select New→Others→BPEL 2.0→Apache ODE Deployment Descriptor. Click Next. Verify the BPEL Project name as /BPEL_Pick/bpelContent. Click Finish.
  18. Open the deploy.xml file. And select the Associated port with the Partner Link client is PickSamplePort.
  19. Save file and open the Server view, right click on the Ode v1.x Server at localhost, select Add and Remove Projects. Select the BPEL_Pick in the Available projects box and click Add. Then, click Finish.
  20. Start the ODE server and use the Eclipse’s Web Services Explorer to test our application. You will see two operations sayHello and sayGoodbye that you can select to use. Depending on the operation you select, BPEL will execute the respective process.

     

Advertisements

Baby Steps on BPEL “HelloWorld” process with Eclipse -1-

Deploying the HelloWorld BPEL process

  1. Create new BPEL project: File→New→Others→BPEL 2.0→BPEL Project.
  2. Name it BPEL_HelloWorld. Select the Target Runtime as Apache ODE 1.x Runtime and Configuration as Defaut Configuration for Apache ODE 1.x Runtime. Click Finish.
  3. In the folder BPEL_HelloWorld\bpelContent, File → New → Other → BPEL 2.0 → New BPEL process file.
  4. Name it HelloWorld, Namespace http://helloworld.localhost and select Template Synchronous BPEL Process. Click Next.
  5. Edit the Service Address to : http://localhost:8080/ode/processes/HelloWorld (suppose that your Tomcat environment runs at port 8080) and keep other default declarations. Click Finish.
  6. Three files are created in the folder bpelContent and the HelloWorld.bpel is opened for editing the BPEL process.
  7. Click to open the Palette panel on the right of the canvas. (or right click on the canvas, select Show Pallette on Palette View)
  8. Drag the Assign action next to the receiveInput action and delete the FIX_ME-Add_Business_Logic_Here.
  9. Right click on the Assign activity. Select Show in properties.
  10. In the Properties tab, select Details. Click on the New button to define an assign operator.
  11. Assign from input→payload→input to output→payload→result. An Initializer popup dialog appear. Click Yes to initialize the output variable and save the process.
  12. It’s time now to deploy the BPEL project. Click on the folder bpelContent, select File→New→Others→BPEL 2.0→Apache ODE Deployment Descriptor.
  13. Click Next. Verify the BPEL Project name as BPEL_HelloWorld. Click Finish.
  14. Double click on the deploy.xml file in the bpelContent folder.
  15. In the Inbound Interfaces table, select the Partner Link as client, Associate Port as HelloWorldPort. Click on Related Service then other fields will be automatically filled. Save the deploy.xml file.
  16. To deploy the project on the server, right click on the Ode v1.x Server at localhost, select Add and Remove Projects.
  17. Select the BPEL_HelloWorld/HelloWorld in the Available projects box and click Add. Then, click Finish.
  18. Start the ODE server. If the deployment was successful, you will see the following output in the console tab.
  19. We will test the project with Web Services Explorer provided by Eclipse. Right click on the HelloWorldArtifacts.wsdl file. Select Web Services→Test with Web Services Explorer.
  20. Select the operation process. Then, type Hello ODE in the input textbox. If your deployment was success, you will get the same string in the SOAPresponse.

Installing BPEL designer and Apache ODE on Eclipse

Installing Eclipse BPEL designer

  1. Suppose that you have already downloaded and installed your Eclipse > v3.6.2(Helios,or Indigo), version for Java EE Developers and JDK (version > 1.5).
  2. Open the Eclipse, go to the menu Help→Install New SoftWare.
  3. Click on the button Add and define a new Eclipe update site with the location:
    http://download.eclipse.org/bpel/site/
  4. Now you have the update-site of BPEL available on the eclipse. Select the check box to BPEL Visual Designer and click on the button Next.

  5. Follow the installation windows, you will now have your BPEL installed on Eclipse. Note that: the BPEL dependencies(WTP, EMF, GEF, JEM) should be installed before the BPEL designer. Fortunately, with Eclipse Helios for JavaEE, you have all.
  6. After finishing the installation, restart it.
  7. To verify the installation was successful, after the restart, click on File→New→Other, you will see the BPEL 2.0 is on the list.

The BPEL designer is now ready to use. However, to run the BPEL process, you should have the server’s environment. Now, we are going to install the Apache ODE for the BPEL deployment.

Installing Apache ODE

  1. Download and extract the latest ODE from the Apache web site. The current stable version is the ODE 1.3.5.
  2. Inside the “apache-ode-war-1.3.5” folder, you will see an “ode.war” file. Deploy this file on your Tomcat server.
  3. The simple way to do this is extracting the “ode.war” file to get the ode folder.
  4. Copy this ode folder to your TOMCAT_DIR/webapps directory.
  5. That’s all.

Now, you have finished the installation steps. Now, you are going to set up the ODE server on Eclipse to run the BPEL application.

Setting up the ODE server on Eclipse

  1. Show the “Servers” view by selecting the menu Windows→Show View→Servers.
  2. Right click on the empty space of the “Servers” view, select New→Server.
  3. Leave the server host name as localhost and select the server type as the Apache→Ode v1.x Server. Rename the server’s name if you want. In my installation, I keep the default name. Then click on the button Next.

  4. Select the JRE as the Default JRE which was integrated in the Eclipse. Set the path to the ODE’s home directory and the Tomcat directory. Then, set the Tomcat’s port as the port in its configuration file. The default port is 8080.

    Note that: the ODE Runtime configuration above can also be added or editted using the menu Windows→Preferences→Server→Runtime Environments.

  5. Click Finish. You now have the ODE server which is ready to run on the Eclipse. You can see this server on the Server View.
  6. Now, you should test the server’s configuration by right click on the ODE server entry and select Start. Or you can click on the Start button on the Server View. If the server is sucessfully started, you will see the status like this.

  7. If you are using Tomcat v.6 or v.7, you probably get the error

    Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/juli/logging/LogFactory
      at org.apache.catalina.startup.Bootstrap.<clinit>(Bootstrap.java:54)
    Caused by: java.lang.ClassNotFoundException: org.apache.juli.logging.LogFactory
      at java.net.URLClassLoader$1.run(URLClassLoader.java:217)
      at java.security.AccessController.doPrivileged(Native Method)
      at java.net.URLClassLoader.findClass(URLClassLoader.java:205)
      at java.lang.ClassLoader.loadClass(ClassLoader.java:323)
      at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:294)
      at java.lang.ClassLoader.loadClass(ClassLoader.java:268)
      at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:336)
      ... 1 more
    Could not find the main class: org.apache.catalina.startup.Bootstrap. Program will exit.
  8. This error occurs maybe because it misses the tomcat-juli.jar in the Launch environment.
  9. To fix this, double click on the installed Ode v1.x Server in the Server View to see the configuration.

  10. Click on Open launch configuration → Classpath tab → Add External JARs → [your TOMCAT_DIR]\bin\tomcat-juli.jar. Then Ok.

  11. Now try to start your ODE server in the Server View.
  12. Terminate the server by clicking on the Stop button or right click on the server and select Stop. Every thing is ready now for the first BPEL program.