Contributed and maintained by: PCM Reddy,
The
following
procedure demonstrates how a BPEL process interacts with real life webservices and applies business logic without
writing
code.
This tutorial assumes you have some basic knowledge of, or programming experience with, the following technologies.
This tutorial assumes your system meets the following requirements.
Before you begin, you need to install the following software on your computer.
Ask questions on the nbusers@netbeans.org mailing list.
Any issues and suggestions:
http://www.netbeans.org/community/issues.html
Exercise
1:
1.
In the IDE,
from main
menu, choose File > New Project
2.
Navigate to Samples
> Service Oriented
Architecture > Synchronous BPEL Process
( call it as “SynchonusSample6” , you can use
any name )
3.
In IDE
project tab two
new nodes are added
4.
Select
“SynchronusSample6Application” and right click, select Add JBI Module.
5.
In Select
Project Dialog
select “SynchonusSample6” and click on “Add Project Jar files”
6.
Expand
“SynchonusSample6” and open “SynchronusSample.bpel”
7.
Select
“Process Files”
folder, right click and select “New > File Folder”
8.
Select
categories : XML
and File Types : External WSDL document as shown below

9.
Enter
this URL as shown below : http://www.swanandmokashi.com/HomePage/WebServices/StockQuotes.asmx?WSDL

10.
Click on
“Finish” button
11.
Repeat steps
step 7 to
step 10 for this WSDL URL : http://www.webservicex.com/CurrencyConvertor.asmx?wsdl

12.
Select “StockQuote.asmx.wsdl” in project window, drag
and drop on
to BPEL project

13.
Accept all
default
values and click on “OK” button.
14.
Select “CurrencyConverter.asmx.wsdl” in project window,
perform
steps 12 and 13
15.
Select
“Invoke” activity
(“Invoke1”) in Palette, drag and drop below “Assign1”
16.
Select
another “Invoke”
activity (“Invoke2”) in Palette, drag and drop below “Invoke1”
17.
Select
“Invoke1” right
click select “Edit”
18.
Select
Partner Link :
from drop down list select “PartnerLink1”
19.
Create Input
Variable
and Output Variable as shown below (by accepting all default values)

20.
Select
“Invoke2” right Click, select “Edit”
21.
Set
the values as shown below (See steps 18 and 19)

22.
Double Click
on
“Assign1” activity
23.
Select and
delete existing
connections and
24.
Select “paramA” and “QuoteTicker”
as
shown below
25.
Select
“String” Menu as
circled below
26.
Select String
literal
(“String Literal1”)and drop in middle pane, drop another “String
Literal” in
middle pane
27.
Select 1st
String literal and set value “USD”, and connect to “FromCurrency”
28.
Select 2nd
String
literal and set value “USD” and connect to “ToCurrency”

29.
Select “IF”
activity,
drag and drop below Invoke. (“Invole1” element.
If1 is added in BPEL diagram)
30.
Select
“Assign” activity
(“Assign2), drag and drop below IF (“If1”)
31.
Select
“Assign” activity
(“Assign3), drag and drop below IF (“IF2”) next to the previous one
If
condition is checking for stock quote “SUNW” and the price
32.
Double click
on IF (
“If1”), In BPEL Mapper
window, Select Operator menu ->
Select “Operator” -> “==” in the Mapper
menu , drag and drop in the middle pane
33.
Select a
string literal
and drop in the middle pane, Use String literal to set the value “SUNW”
34.
Connect StockTicker and
String literal to ”EQUAL ==” operator
35.
Similarly add
“<” , Use
Number
literal to enter “7” and connect to
“AND” operator as shown below.

Now
we are going throw if condition for “If1” activity
36.
Now select
“Assign2”
drop “Multiplication” operator
37.
Drop “Concat” operator from String menu, set the
values below and
connect all the elements as shown below

Now
we are going throw else condition for “If1 activity.
38.
Repeat steps
36 and 37

39.
From main
menu , File
-> New project -> Web -> Web Application ( call it as SQWeb)
40.
Select all
default
values
41.
Add a jsp file called “stockquote.jsp”
42.
Right click
on webapplication, select New -> “WebServiceClient”
43.
Local File
: browse and select “SynchronousSample.wsdl”
which can be found in “src” under BPEL
project
created in step 2, supply package name “mywsclient”
and click on “Finish” button.

44.
Open “stockquote.jsp” created in step 41, right click
in editor
-> “Web Service client Resources” -> Call Webservice
operation as shown below. Click on “OK” button.

45. Edit “index.jsp” and “stockquote.jsp” and connect them. See sources for details.
| index.jsp |
create a form (Action = stockquote.jsp ) with inut field with name = "stockticker" |
| stockquote.jsp |
|
46.
From runtime
tab select
“Sun java System Application Server 9” right click and start
47.
From Projects
Tab,
Select “SynchronusSample6Application” right click -> Clean and build
48.
Select
“SynchronusSample6Application” right click -> Deploy
49.
Select WebApplication (SQWeb
created in
step 39) right click and execute
50.
In web
browser index.jsp will appear, enter “SUNW
and click on “Submit”
Button.

51.
Now
BPEL logic is going thro IF condition

52.
Now BPEL
logic is going
thro else condition

Enable
debugging:
Click
on Runtime Tab
Expand
“Sun Java System Application Server 9” node, select
“com.sun.bpelse-1.0.2”
node. Select properties popup menu.
Set
DebugEnabled value to “true”
Start
Appserver in debug mode.

Open
BPEL
file

Set
BreakPoint as shown below.


Select
“SynchronusSample.bpel” file and click on
attach debugger
button as shown above.
Select
Debugger
“BPEL Debugger” and click on “OK” button.

Run
WebApp (SQWeb)
(See step #
50)
Click
on BPEL variables tab in debugger output window to watch BPEL variables
during
debug session.
Click
on Step in (F7) button in debugger toolbar
Observe
the debug action visually.

Sometimes times we might have gotten the Service Assembly in a bad state. It may have been a bad Service Assembly and the deployment only went halfway through, or our BC may have been messed up. In any case, if you are unable to stop, shutdown, and undeploy a Service Assembly, here are some steps to manually clean out all the Service Assemblies in your JBI framework.
In this
exercise, you learned
how to perform the following tasks:
·
Create
a Synchronous
BPEL project.
·
Adding
external webservices to BPEL process
·
Adding
business
logic to BPEL process
·
Modify
mapping by using
mapper palette.
·
Accessing
BPEL
process from a Webapplication
To send comments and suggestions, get support, and keep informed on the latest developments on the NetBeans IDE J2EE development features, join the nbusers@netbeans.org mailing list.
Resources
for further reading:
http://www.netbeans.org/kb/55/entpack-index.html
http://www.netbeans.org/kb/index.html
http://enterprise.netbeans.org/
http://www.sun.com/products/soa/index.jsp