Create your first SOA Composite - Hello World ! Process




Create your first SOA Composite - Hello World ! Process

Start JDeveloper.  Left click Applications node in the Applications Navigator and select New Application, as shown
Create an Application named Training.Give “Training” in Application nameSelect a suitable location and select SOA Application in the Application Template



The wizard now prompts you to create a project.  Later, you can add more projects to this application.

Give the project name as HelloWorld

Select Composite template as Composite with BPEL Process.  This is a convenient shortcut to tell that the composite we want to create would contain one BPEL process.  As an alternative, we can choose Empty Composite here,  add add a BPEL component later.



Click on Finish
  
A new dialog opens up.  This is to configure the BPEL component that we are adding to our composite.

Give name as HelloWorld_BPELSelect Template as Synchronous BPEL Template and click ok.


Templates are pre-defined structures provided by Oracle.  Essentially, by using a template, a few activities shall come by default, so that you are saved of the mundane steps of adding those activities.  It’s even possible to create your own custom templates.  As of now, we select the predefined template for a synchronous process.  A synchronous process is one which is expected to be comparatively short-lived (few seconds to minutes) and hence can be expected to return a response quite quickly.  So, the client invoking a synchronous process can afford to wait (and block) for the response to come back.
 
 The following structure comes up.



This is the picture of the composite (more technically, it’s the design time view of composite.xml).  As you can see, it contains a service component called HelloWorld_BPEL and a binding component called helloworld_bpel_client.

 Service components are the building blocks that you use to construct a SOA composite application. Examples - BPEL, Human Task, Business Rules, Mediators, Spring.

 Binding component establish a connection between a SOA composite and the external world.  They are categorized as Service binding component and Reference binding components.  Service binding components provide the entry point to the composite Reference binding components provides access to the external service in the outsideworld.  Examples include JCA Adapters (FTP adapter, DB adapter, Apps adapter etc), HTTP Binding, Direct binding etc.


  Double click on this component to open it up.



As you can see, there is an input coming from the helloworld_bpel_client service binding  (which represents any client that is invoking our BPEL process).
 Drag an Assign activity from the component palette on the right.



In this assign activity, we can add any number of “Copy rules”.  Copy rules allow us to copy values from a source variable to a target variable, or to assign result of an expression (say a concatenate operation or a square root operation) to a target variable.

 We want to create an expression similar to
“Hello” + Input = Output. 
This we shall create using the following steps:
  1. Expand output variable so that you can see client:result.  This is the string field to which we want to assign some value.
  1. From the icons on top right corner, drag an expression  onto client:result.
  1. 3 . A dialog called Expression Builder opens up.  Expression builder is a nifty tool to quickly create expressions.  It shows categories of operations.  You choose a category and it shows you the expressions within that category.   For example 



1.      Here we choose “concat” function from the String Functions category
2.      Click on Insert into expression.  This puts the concat() into the Expression box above.  (When you get experienced, you can simply write functions directly here.).  Place the mouse cursor between “(“ and “)” of the concat function
3.      Next we expand the input and select the client:input field.  This is the field that has got the value that was sent by the user.  We want to append hello to this and assign that to the output variable.  So choose this
4.      Press Insert into expression
5.      Type ‘Hello’ followed by a comma.    Note that in BPEL, (or more precisely xpath) we use single quotes for strings

Now press OK.  Control returns to Edit Assign dialog.  Now expand the outputVariablein the To section (right section) and select client:result field.  Press OK




This has completed the Assign activity.  For better readability we should always give descriptive names to activities.  So double click on the text “Assign1” (not the icon) and give name as “Assign_Hello”
  


The BPEL process is now complete !




Now we shall deploy this to the BPEL Server.  Make sure you have created connection to the application server.  If not, here are the steps 
  1. Go to Application Server Navigator tab.  Right click Application Servers and select New Application Server
  1. Select Standalone Server




In SOA, we always use Standalone.  Integrated is used when creating ADF apps.
  1. Give a name to the connection, like MyApplicationServer.  Select Weblogic  10.3 from the Connection type



Give Username as weblogic, and password as the weblogic password specified during installation

  1. If the SOA suite is running on your local system, then enter localhost in the Weblogic Hostname, else give the actual hostname.  No need to change ports.  In the weblogic domain, give the name of your domain as given in <MW_HOME>\user_projects\domains.  For example we have E:\Middleware\SOASuite11gR1PS3\user_projects\domains\SOASuitePS3DevDomain


Here Port (aka “Listen Port”) is default TCP port that this server uses to listen for regular (non-SSL) incoming connections.  To find this out, simple copy the port in the EM url.
  1. After this you can test the connection.  All tests should be successful. 


Now go back to JDeveloper and right click the composite “HelloWorld” in the Application Navigator.  Select Deploy > HelloWorld 


In the next step, select Deploy to Application Server.  Click nextMake sure Mark composite as default is checked, click nextSelect MyApplicationServer.  Let it choose the default partition, click finish

The log window will show that BPEL process is being compiled, and then deployed onto the server.


Now we want to run this program to see it in action !
Go to EM console now.  http://localhost:7001/em/Expand the tree on the left pane as shown and select HelloWorld
Select Test Button.  Then give some string in the input text field.  And then press Test Webservice button Test Web Service




Here EM console is acting like a client to our process.  It takes this input, creates a SOAP message and then sends that message to our BPEL process.
The output from the BPEL process is shown:

  You can now also click on the Launch Flow Trace button  to see the actual flow of the process.  Make sure you allow popups !!.  In mozilla, you may see the settings at bottom right corner.

 The flow trace page will open up



Flow Trace page shows the flow of messages through one or more connected SOA composite applications, their services, references, and service components. You can also view and respond to faults occurring in the flow and view composite sensor data collected in the flow.

ECID is a unique identifier for this flow (A flow can contain multiple composites, although in this HelloWorld, there is only one composite.  SOA server makes sure that all composites invoked during a single flow have this common value, which is used later on to connect them to each other.  This ability to identify a flow is something new in 11g). Note, ECIDs are not propagated through business events.

 To open the BPEL process, click on HelloWorld_BPEL link. It will open in a popup window

Here you can observe the various activities in Audit Trail as well as Flow tabs.  Audit tab is useful if you want to see the times each activity was invoked, inputs and outputs etc.  Similar information can also be gleaned from the Flow tab.  Click on the flow tab


While this looks similar to the BPEL diagram we had in JDeveloper, there is a difference.  Here the activities are links, and when we click on them, they show more information regarding the data processed.  For example, to find out the input, we can click the Receive activity (receiveInput) and see the following



Thank YOU...




































































































































































































BPEL Basics




Orchestrating Services with BPEL

Recap of SCA

nSCA provides a programming model
nThat model allows
qCreating service components written with a wide range of technologies
qAssembling the service components into a SOA composite application

nSOA 11g is SCA-enabled.

Introduction to BPEL

nBPEL:
qUsing BPEL we can create a flow that can call web services and incorporate business activities
qpresents a very intuitive flow-chart type representation that can be easily understood and modified
nMore technically, it is a markup language for composing a set of discrete services into an end-to-end process flow

qThe BPEL process we create itself becomes a webservice

Business Process Execution Language, commonly known as BPEL or WS-BPEL, is an XML based standard markup language that is emerging as the answer to process orchestration requirements. BPEL has very rich and comprehensive orchestration semantics, is based on wide industry participation, and is broadly accepted. The BPEL process coordinates interactions between a process instance and its partners. Both the BPEL process and its partners are modeled as WSDL services. Therefore, the BPEL process definition:• Interacts with one or more WSDL services• Provides the description of the behavior and interactions of a process instance through WSDL.

That is, the definition of a BPEL business process follows the WSDL model of separation between the message content and deployment information (messages and port type versus binding and address information)In short, a BPEL component can be exposed as a service through the composite WSDL if its operation can be useful to external clients.







Orchestration Requirements

nProcess orchestration coordinates services in a process from a single run-time environment
nOrchestration should enable us to create:
qBusiness processes from services and human activities
qCoarse grained business services from fine grained services
qIntegration flows to integrate various applications
n
nOrchestration requirements include:
qExecution sequencing including serial, parallel, or other kinds of control flow dependency patterns
qException handling including transactions and compensations
qData flow and manipulation
qEvent handling including timers and other out-of-band events
nWhy am I telling you about Orchestration!

nBPEL is a standard for business process orchestration

Describing Process OrchestrationThe concept “process orchestration” encompasses the idea of coordinating services in a business process from a single run-time environment. Orchestration:• Directs and manages an on-demand assembly of multiple services• Results in the creation of a composite application forming a business processIndustry has now converged on using the Business Process Execution Language for Web Services (BPEL4WS) as the core standard for Web services orchestration, simply known as Business Process Execution Language (BPEL). Oracle BPEL Process Manager provides a run-time environment for executing applications developed in BPEL. The BPEL process runs in a specific run-time container to coordinate one or more services to complete a business process (flow).



BPEL Process Manager


nOracle BPEL Process Manager is implementation of the BPEL standard.
nThe Oracle BPEL Process Manager consists of the three components. Each component enables you to perform a specific set of tasks:
qThe design environment (Oracle JDeveloper) enables you to design and deploy BPEL processes.
qThe BPEL Server is where the process is ‘deployed’

qEM Control can be used to run and monitor the BPEL process (through the composite)

The design environment (Oracle JDeveloper) enables you to design and deploy BPEL processes. You design BPEL processes by dragging and dropping elements (known as activities) into the process and editing their property pages. You integrate BPEL processes with external services that you also design and edit (known as partner links). You also integrate technology adapters and services such as workflows, worklists, transformations, notifications, sensors, and business rules with the process. Deployment sends the Oracle BPEL Process Manager archive (a set of files in a JAR file with a directory structure similar to the project directory structure) to Oracle BPEL Server. The deployment operation automatically validates and compiles the project directory into the BPEL archive.

How they fit




Oracle BPEL Process Designer - JDev


Introduction to Activities

nActivities are the building blocks of a BPEL process service component. Oracle BPEL
nJDeveloper includes a set of activities that you drag into a BPEL process. You then double-click an activity to define its attributes (property values).

nActivities enable you to perform specific tasks within a BPEL process service component.

The HelloWorld Process


The Hello Process

During this lesson and practice you will create a simple BPEL process. It takes a name as an input message and returns the message “Hello ” followed by the name, through a synchronous reply.

In Oracle BPEL Process Designer, on the left, the Applications and Connection Navigators provide navigation within your project. The Applications Navigator shows the files associated with your project and the Connection Navigator provides access to wizards for configuring your connections (for example, Oracle BPEL Process Manager Server and database connections).

 In the middle of the window is the Diagram View which is a visual representation of the flow logic. Opening any component exposes a list of any global XML variables defined for the flow. An Inspector pane allows you to drill down into the Diagram View. At the bottom of the window, the Source tab allows you to switch into text-editing mode for the source code of the BPEL process.

Note: Two-way editing is enabled; such that, changes you make in either editing mode are reflected in the other mode.

On the right, the Component Palette provides a list of process activities, code snippets, and preferred components to include within your BPEL process.


Anatomy of a Composite



The files that are created to support this synchronous process are:

bpel.xml: The deployment descriptor for the process. This file contains the metadata for the Hello process and it defines the locations of the WSDL files for services called by this flow, along with other project-specific parameters.

Hello.bpel: The BPEL source for the process. The New Project dialog creates an empty flow, with just the minimum activities and definitions for the selected flow type. For a synchronous BPEL process, the only activities created are a <receive> to initiate the flow from a synchronous client request and a <reply> for the return.

Hello.xsd: This file contains the definitions of the messages that are exchanged by this process.  This file is referred to in the WSDL fileHello.wsdl: The WSDL (client) interface for this process. Defines the input and output messages for this flow, the client interface and operations supported, and the BPEL partnerLinkType(s), so that the flow can be incorporated into other processes. The New Project dialog generates a document-literal style WSDL that takes a string input message and returns a string response message.


Viewing the WSDL Source



  TYPE DEFINITION - List of services participating in this BPEL process The default output of the BPEL designer uses strings as input and   output to the BPEL Process. But you can define or import any XML Schema type and use them as part of the message types.

  MESSAGE TYPE DEFINITION - Definition of the message types used as part of the port type definitions

  PORT TYPE DEFINITION - A port type groups a set of operations into a logical service unit

 PARTNERLINKS – BPEL extension to WSDL.  The extensions are required because the WSDL specification is inadequate for this requirement of BPEL

WSDL provides a standard way in XML format to describe Web services. WSDL describes what functionality a Web service offers, how it communicates, and where it is accessible. WSDL documents have a <definitions> element that may contain:

Type definitions in a <types> element to describe message structures.
Interface (port type) definitions in an <interface> element to describe sequences of messages that a service can send and receive.

Binding definitions in a <binding> element describing the message format and protocol used - the implementation details to access the service (or endpoint).

Service definitions in a <service> element to describe a set of <endpoint> elements, each describing service details such as a URI to access the service.
WSDL Extensions provides a way to extension WSDL by defining structured message sequences and type patterns, security rules, and others items needed by an application.

BPEL depends on WSDL and WSDL Extensions:
•In partner links to reference message type structures for variables, and to invoke operations provided by a Web service.
•To describe the BPEL Process as a Web service, exposing the interface (message types and operations) to applications that interact with the BPEL process.  This is because when deployed, BPEL Processes are automatically published as Web Services so that they can be easily initiated by other BPEL Processes and also by Visual Basic applications, Excel spreadsheets or J2EE applications.


nDeploying a BPEL process makes it a service.  This is made possible by automatic addition of <service> and <binding> tag to the WSDL during deployment.

This WSDL file is copied from the deployed process visible through the BPEL Console.  Notice the <service> and <binding> tags, which were not present in the WSDL created in JDeveloper Note the <endPoint> tag inside <service>.  This tells the location where we can access this service (‘service’ because the BPEL process is automatically deployed as a web service as part of deployment)



BPEL Process Source Structure





The <variables> element is a container of one or more <variable> elements that represent messages and XML documents used by activities in process. The <variable> element provides a messageType attribute whose value, usually an XML type from in an XML schema, identifies the structure of the message or XML document variable.

The <sequence> element contains the orchestration logic, or process flow. The process flow is comprised of a sequence of activities that coordinate the flow of messages across the services integrated within the business process. For example:The <receive> element initiates a new instance of the process when a process request message is received.The <assign> element can assign messages to output variables from literals, other variables, expressions, and combinations of each.The <reply> element returns a synchronous response message to the client or requestor of the service formed by the BPEL process.

What next?

nAfter development, the composite needs to be deployed
nDeploying means putting the process in the SOA server.
nDeployment can be achieved through
qJDeveloper

qCommand prompt

Deploying where?

nIf you want to use JDeveloper for deploying the process, you need to create connection from JDeveloper to the SOA Server

Building and Deploying the process

nAfter creating the process, we need to compile and build it.
nWhen you build your process, all of the process components are packaged into a ‘SOA Archive file – SAR File
qThe SAR packages service components, such as BPEL processes, business rules, human tasks, and mediator routing services into a single application..

nJDeveloper uses ANT to build the BPEL process. 

If the BPEL process has been already deployed, JDeveloper will prompt you to enter a new version if you don’t want to overwrite the existing process deployed on the server.  It will show you all the versions that are currently deployed.

Managing and Administering 
nEM console can be used to manage the process that includes
qViewing all in-flight, closed and failed instances
qDeploying a composite if sar is available

qUndeploying a composite

BPEL's Relation to other Web Service Standards


BPEL Process Manager


Core Engine Architecture




The Delivery Manager listens for new messages coming in and the Dispatcher dispatches messages to the core engine. When a new version of an existing process is requested during deployment, the Lifecycle Manager creates a new JAR file. As soon as the server see the new JAR file, the Loader loads it. The core engine is stateless and any information related to state, is kept in the database. The Persistence Service handles the persistence of a state, passing the state to the Write Thru Cache for storage in the database. Dehydration is equivalent to persistence and dehydration occurs for all asynchronous processes, by default. If a failure occurs, the Persistence Service handles the return of state by hydrating back. Synchronous processes are not passed through dehydration.





































































































































































































About This Site

Howdy! My name is Suersh Rohan and I am the developer and maintainer of this blog. It mainly consists of my thoughts and opinions on the technologies I learn,use and develop with.
Powered by Blogger.

- Copyright © My Code Snapshots -Metrominimalist- Powered by Blogger - Designed by Suresh Rohan -