Showing posts with label soa. Show all posts
Showing posts with label soa. Show all posts

BPEL Example

In this post we will create one more BPEL example. In the earlier HelloWorld example we have created a xsd file first and used it in the BPEL process. But we can also generate the xsd file while creating the bpel process. ie. BPEL process automatically creates a xsd file if you don't specify any existing file.

Lets create a simple BPEL process to calculate length of a input string.
We will send some string as input to the BPEL and it will calculate and returns the length of it.

This example includes 4 steps:

  1. Creating a SOA application and project
  2. BPEL creation
  3. Deploy the project
  4. Testing the project



1. Creating  a SOA application and project:

You can create a new SOA application and project by referring below old post
Create SOA Application and Project
Created StringLengthSoaApplication & StringLengthSoaProject

2. BPEL Creation :

Let's create a new BPEL process which returns string length.
1. Open StringLengthSoaProject (composite.xml) file.

2. Right click on the StringLengthSoaProject (Composite.xml) file --> Insert -->BPEL process.

3. Give a name for BPEL process, select "Synchronous BPEL process" and keep the remaining fields as it is with default values. Click on OK

4.  It will generate 3 files. BPEL process file, xsd file and wsdl file

5. In the generated xsd file you can observe both input and result are String types.

6. Open the BPEL file. Drag and drop Assign component between receiveInput and callbackClient.

7. Open Assign component by double clicking on it. Drag and drop Expression component on the result variable.

8. Expression builder dialog box opens. In the expression field add below expression to calculate length of a string.
concat('The Length is : ', string-length($inputVariable.payload/client:input))

I have used concat() & string-length() functions in the "string functions" section to in the above expression.
Click on OK.

9. Click on Apply and OK buttons on the "Edit Assign" dialog.

10. Save all your changes. BPEL has been created successfully.

3. Deploy the project :

Deploy the project by following below post.
After successfully deployed the project, you can test the flow.

4. Testing the project:

Test the deployed project by following below post.
Testing SOA project

Request: 

Response:

Testing SOA project


In this post we will see how to Test SOA composite flow.



Login into url -> http://localhost:7101/em   with your weblogic login credentials. (You have given credentials while creating a domain)

Next at left hand side, expand SOA and click on soa-infra
Next Select Deployed Composites tab and select our SOAHelloWorldProject.

Next click on Test button.

Now on Request tab, enter request details in the input fields and click on Test Web Service button located at bottom.

Now you can observe the Hello World message on Response tab.
full name --> firstname and lastname are appended.
message --> Hello World.

Deploying SOA Project

In this post we will see how to deploy the SOA project.

Before you deploy the project make sure weblogic server  is already running.

Now right click on the project and click on deploy by selecting the project.

Click on Next in Deployment Action dialog.


select check box "Overwrite any existing composites with the same revision ID." and click on Next in "Deploy configuration" dialog.

click on Next in Select Server dialog.


click on Next in SOA Servers dialog.


click on Finish in Summary dialog.

Verify is SOA build success in SOA tab.

Verify is deployment success in Deployment tab.

Creating SOA Application and Project

In this post we will see how to create a SOA Application and project.

I'm using Jdeveloper 12C

File -> New -> Application


Select SOA Application

Enter application name and click Next
Enter project name and click Next
Select Empty Composite and click on Finish

We have created SOA application and SOA project as of now.

Oracle SOA Hello World Example

Let's create a new BPEL process for showing a simple HelloWorld message.
Using Jdeveloper 12c and its integrated weblogic.
First we will create a new SOA application and new SOA project.

Oracle SOA Hello World Example Process steps:


File -> New -> Application


Select SOA Application

Enter application name and click Next
Enter project name and click Next
Select Empty Composite and click on Finish

We have created SOA application and SOA project as of now.

XSD file creation:

First lets create XSD file with request and response.
Right click on schemas folder -> New -> From Gallery



From New Gallery window, select XML Schema.


Enter XML schema name and click OK

Create elements like below in the xsd fle.
This xsd source look like this below.

<?xml version="1.0" encoding="windows-1252" ?>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://www.example.org"
            targetNamespace="http://www.example.org" elementFormDefault="qualified">
  <xsd:element name="HelloWorldRequest">
    <xsd:annotation>
      <xsd:documentation>A sample element</xsd:documentation>
    </xsd:annotation>
    <xsd:complexType>
      <xsd:sequence>
        <xsd:element name="firstname" type="xsd:string"/>
        <xsd:element name="lastname" type="xsd:string"/>
      </xsd:sequence>
    </xsd:complexType>
  </xsd:element>
  <xsd:element name="HelloWorldResponse">
    <xsd:complexType>
      <xsd:sequence>
        <xsd:element name="fullname" type="xsd:string"/>
        <xsd:element name="message" type="xsd:string"/>
      </xsd:sequence>
    </xsd:complexType>
  </xsd:element>
</xsd:schema>

BPEL process creation:

Right click on composite.xml design view and select BPEL process.

1)- Enter BPEL process name 
2)- Select Template as "Synchronous BPEL Process"
3)- Click on search button
4)- Select recently created XSD request and response types.



BPEL process looks like below in composite.xml after creation.

Now right click on BPEL process and click on Edit.



After BPEL process file is opened, 
1.Drag Assign component from components palette.
2.drop between receiveInput and receiveOutput.




Double click on Assign component and from right hand side drag functions button and drop on fullname element.
And use string concat() function to concat firstname & lastname.



 Again drag functions button from right hand side and drop on message element.
And enter message as "Hello World".

The Assignment from input and output looks like below.

Click Apply and click on OK.
Save all your changes.


Deploy the project:

Before you deploy the project make sure weblogic server  is up and running.
Now right click on the project and click on deploy by selecting the project.

Click on Next in Deployment Action dialog.


select check box "Overwrite any existing composites with the same revision ID." and click on Next in "Deploy configuration" dialog.

click on Next in Select Server dialog.


click on Next in SOA Servers dialog.


click on Finish in Summary dialog.

Verify is SOA build success in SOA tab.

Verify is deployment success in Deployment tab.


Test our BPEL process:

Login into url -> http://localhost:7101/em   with your weblogic login credentials. (You have given credentials while creating a domain)

Next at left hand side, expand SOA and click on soa-infra
Next Select Deployed Composites tab and select our SOAHelloWorldProject.

Next click on Test button.

Now on Request tab, enter request details in the input fields and click on Test Web Service button located at bottom.

Now you can observe the Hello World message on Response tab.
full name --> firstname and lastname are appended.
message --> Hello World.