Thursday 24 January 2013

How to develop a SOA Composite using JDeveloper ?

Introduction

Starting point of any new technology or language is to make it say 'Hello'. Personally, for me to get acquainted to a new programming language is to write a 'hello world' program. Same I would like to do today by showing you how to develop a Simple Hello World Composite.

Before Starting with SOA development, make sure you have:

  • SOA installed
  • Jdeveloper with SOA Extension Enabled
Let us get Started.

Overview:

We will create a SOA Composite which will take input as a String(your name) and return the output as Hello <String Entered>.

Developing a Composite:

Open Jdeveloper and create a New Application by Navigating to File->New->Application->SOA Application. Click on Ok.


Enter the name of the Application in the next screen:


Enter name of the Project (HelloWorld) and make sure SOA is selected as shown.Click on Next.


 Now select the option 'Composite with BPEL Process'. Click on Finish.


Select 'Synchronous BPEL Process' from the drop down. Click on Ok.


Now you have successfully created a basic composite with a Synchronous BPEL process. It should look something like this:

Next step is to do some configurations in our BPEL Process so that it can understand what it needs to do.

Double click on the BPEL Process. You will see the below screen. 
Now you can make out easily what we are trying to do. It is same Java Programming. Some Input/Output variables.Some transformations, assignments, connection. 

Here we have a client, which will send a request (so it has a receive activity). It also has the power to give Output (hence replyOutput activity). So what is missing ???
We need to concatenate the input with 'Hello' and assign it to the output variable.


To achieve this, add the assign activity by dragging it from BPEL Constructs(see the right side of the pane)



Now the assign activity is added, we are ready to concatenate. 
Double click on Assign Activity.
We want to assign input to the process to the result, after concatenating 'Hello' to the front.
Drag the function (highlighted) on the result variable.
In this screen, Select String Function from the drop down, double click on concat, you can see the format/description of the function.
It accepts arguments in quotes separated by comma.
Give the First argument as 'hello'.
For second argument, double click on client input string after expanding input variable.

Click on Ok and Apply and save it.

Now you are ready to deploy your first BPEL Project on your SOA Server.
Start your SOA server if not already started.

Steps to create an Application Server connection in Jdevloper:

Click on File->New->Connection->Application Server Connection.
Give the connection name and click on Next.


Give the Username and password to connect to Admin Server.


Give the Hostname,  Port number of Admin Server and name of your domain. Click on Next


Give Test Connection. If all the test are successful. Click on Next and then Finish.


Deploying the Composite:

Right click on the project and select deploy as shown:
Select the Application Server connection you created in the next couple of screen and at the end click on Finish.

If you see the above screen, it means you have successfully deployed the composite on the SOA Server.

Now time to test our HelloWorld composite :)

Login to EM Console. Click on your composite. Click on Test Button. Enter the input as shown:

Click on Test Web Service Button. You will see the output as below !


Voila :) 
You have successfully created, deployed and tested a SOA Composite !!!
Welcome to SOA Development with JDEVELOPER
Explore and learn from here ;)

Cheers