Sie sind auf Seite 1von 11

End-2-End Purchase Order Processing

End-2-End Purchase Order Processing.........................................................................................................................1


1.1 Introduction........................................................................................................................................................2
1.2 Description of the application............................................................................................................................2
All orders will be written to a text file for later reference.................................................................................2
Sall orders !defined as those under "1#$$$% are to be autoaticall& appro'ed..............................................2
(arge orders !those greater than or e)ual to "1#$$$% go through a 'alidation and appro'al process................2
The customer's credit card must be validated......................................................2
If the order is $5,000 or more, a customer service representative must manually
approve the order................................................................................................. 2
Appro'ed orders shall ha'e the status *appro'ed*............................................................................................2
(arge orders with an in'alid credit card shall ha'e the status *in'alid+redit+ard*..........................................2
(arge orders re,ected b& the custoer ser'ice representati'e shall ha'e the status *re,ected*.........................2
All appro'ed orders are sent to the fulfillent ser'ice which uses the order 'alue to deterine the
fulfillent 'endor- .1$$$ goes to /SPS# 01 1$$$ and . 2$$$ goes to /PS# 0 2$$$ goes to 3edEx................2
1.2.1 SOA +oponents......................................................................................................................................4
A ser'ice that accepts new orders in 56( forat............................................................................................4
A 3ile Adapter ser'ice that can write 56( essages !such as orders% to a file...............................................4
A 7PE( ser'ice ipleenting the large order process.....................................................................................4
8he credit card 'alidation ser'ice used b& the large order 7PE( ser'ice to 'alidate a gi'en credit card.........4
A Database Adapter ser'ice used b& the credit card 'alidation ser'ice to retrie'e the status of a gi'en credit
card fro the database.........................................................................................................................................9
A 7PE( ser'ice ipleenting the 3ulfillent process....................................................................................9
A :6S adapter ser'ice that produces essages for the fulfillent 'endors.....................................................9
A content-based 6ediator ser'ice to route sall orders to the file adapter and fulfillent process and large
orders to the large order process..........................................................................................................................9
8he large order 7PE( ser'ice also uses a 7usiness ;ule coponent to deterine if anual appro'al is
re)uired and see<s huan appro'al using a =uan 8as< coponent................................................................9
8he 3ulfillent 7PE( ser'ice also uses a 7usiness ;ule coponent to deterine the fulfillent 'endor.....9
1.4 Prere)uisites.......................................................................................................................................................9
An Oracle database............................................................................................................................................9
Oracle :De'eloper 11g.......................................................................................................................................9
Oracle SOA Suite 11g........................................................................................................................................9
1.9 Pro,ect 3iles........................................................................................................................................................9
doc > contains the instructions for creating and running the deo...................................................................9
input > a few files with saple input data.........................................................................................................9
s)l > two database scripts used during setup.....................................................................................................9
scheas > xsd files used throughout saple when defining ser'ices..............................................................9
ch2 > ch? > a solution pro,ect for each chapter................................................................................................9
1.9.1 3ile +on'entions........................................................................................................................................9
1.9.2 Installing the database schea...................................................................................................................9
1.9.4 +reating the database resources.................................................................................................................2
1.9.9 +reating the :6S resources.......................................................................................................................@
Section 1.1 End-2-End Purchase Order Processing 1-1
1.1 Introduction
In this tutorial we will build a SOA coposite application to process and appro'e purchase
orders. 8he purchase order details can coe in fro an& source !in our case a testing page%# the
credit card status for the custoer is 'alidated and if the credit card is good# the order continues.
An order for a large purchase price re)uires a anual appro'al step. 3inall&# the order is written
to a text file to be processed b& the fulfillent house.
8his SOA coposite application contains a database adapter# file adapter :6S adapter# Aeb
ser'ices binding# ediator routing# 7PE( process# 7usiness ;ule# and =uan 8as<. 8he
coplete application will be built in ? steps.
8he solution at the end of each step is a'ailable so the user a& choose to start the tutorial at an&
step# beginning with the solution for the pre'ious step.
1.2 Description of the application
8he application &ou will build is the bac<-end processing of a new order. 8he business process to
be ipleented is as follows.
All orders will be written to a text file for later reference.
Sall orders !defined as those under "1#$$$% are to be autoaticall& appro'ed.
(arge orders !those greater than or e)ual to "1#$$$% go through a 'alidation and
appro'al process.
- 8he custoerBs credit card ust be 'alidated.
- If the order is "2#$$$ or ore# a custoer ser'ice representati'e ust anuall&
appro'e the order.
Appro'ed orders shall ha'e the status *appro'ed*.
(arge orders with an in'alid credit card shall ha'e the status *in'alid+redit+ard*.
(arge orders re,ected b& the custoer ser'ice representati'e shall ha'e the status
*re,ected*.
All appro'ed orders are sent to the fulfillent ser'ice which uses the order 'alue to
deterine the fulfillent 'endor- .1$$$ goes to /SPS# 01 1$$$ and . 2$$$ goes to
/PS# 0 2$$$ goes to 3edEx.
3igure 1 shows a 'isual representation of the business process.
1-2 End-2-End Purchase Order Processing Section 1.4
Figure 1 Visual view of the business process
1.2.1 SOA Components
In ters of the SOA application &ou will create the following
A ser'ice that accepts new orders in 56( forat.
A 3ile Adapter ser'ice that can write 56( essages !such as orders% to a file.
A 7PE( ser'ice ipleenting the large order process
8he credit card 'alidation ser'ice used b& the large order 7PE( ser'ice to 'alidate a
gi'en credit card.
Section 1.1 End-2-End Purchase Order Processing 1-
A Database Adapter ser'ice used b& the credit card 'alidation ser'ice to retrie'e the
status of a gi'en credit card fro the database.
A 7PE( ser'ice ipleenting the 3ulfillent process
A :6S adapter ser'ice that produces essages for the fulfillent 'endors
A content-based 6ediator ser'ice to route sall orders to the file adapter and
fulfillent process and large orders to the large order process.
8he large order 7PE( ser'ice also uses a 7usiness ;ule coponent to deterine if
anual appro'al is re)uired and see<s huan appro'al using a =uan 8as<
coponent.
8he 3ulfillent 7PE( ser'ice also uses a 7usiness ;ule coponent to deterine the
fulfillent 'endor.
1. Prere!uisites
8his tutorial re)uires the following-
An Oracle database
Oracle :De'eloper 11g
Oracle SOA Suite 11g
1.4 Pro"ect #iles
8his tutorial coes with se'eral directories and files-
doc > contains the instructions for creating and running the deo
input > a few files with saple input data
sql > two database scripts used during setup
schemas > xsd files used throughout saple when defining ser'ices
ch2 ch9 > a solution pro,ect for each chapter
1.4.1 #ile Con$entions
After unCipping the file for this saple# o'e or cop& it to c:\po. 8his docuent assues that
path. If &ou unCipped soewhere else then ad,ust accordingl& when c:\po is referenced
throughout this docuent.
1.4.2 Installing the data%ase schema
8his deo re)uires a table in the database owned b& the soademo user.
1. 6a<e sure &our database is running.
2. +reate the soademo user. It is o< to run this script e'en if the soademo user alread&
exists. 3ro a coand line# cd to the c:\po\sql director& and run the following
replacing pw with &our own s&ste userDs password-
cd c:\po\sql
sqlplus system/pw @create_soademo_user.sql
1-4 End-2-End Purchase Order Processing Section 1.4
. Eow# create the credit card info table. It is o< to run this script again e'en if the table
alread& exists. 7e sure to run it with the soademo user for proper ownership.
cd c:\po\sql
sqlplus soademo/soademo @create_creditrating_table.sql
1.4. Creating the data%ase resources
8his deo re)uires a database data source. Fou create this using the Aeb(ogic Ser'er console.
3irst create the data source and then a connection pool for that data source.
4. 3irst# start &our Aeb(ogic ser'er using the instructions in Appendix A.
&. Open http-GGlocalhost-H$$1Gconsole to start the console and login using weblogicGweblogic.
;eplace the host and port and usernaeGpassword to atch &our own configuration.
'. On the left na'igation bar# select Services > JDBC > Data Sources. In the data source
table# select New.
(. Enter the data source inforation
Name: soademoDatabase
JNDI Name- jdbc/soademoDatabase
Database Type: Oracle
8he Database dri'er defaults to the correct dri'er- OracleDs Dri'er !8hin 5A% for Instance
connections
). Select Next# select Next again
*. Enter the database inforation.
Database Name- 5E !&our database SID%
Host name- localhost !host where &our database is running%
Port- 1221 !set according to &our configuration%
Database user name- soadeo !created in pre'ious section%
Database user passwor- soadeo
1+. Select Next
11. Select Test Con!i"uration. +onfir success essage at top of page.
12. Select Next
Section 1.1 End-2-End Purchase Order Processing 1-&
1. Select Tar"et server where &our SOA coponent is running > soa_server1.
14. Select #inis$
Eow create the connection pool. Fou ha'e to edit the database adapter application.
1&. In the left na'igation bar# select Dep%oyments.
1'. Select the DbAdapter application !select the nae# not the chec<box%
1(. Select the Con!i"uration tab# and then select the &utboun Connection Poo%s tab.
1). Select New
1*. Select the radio button for ,a'ax.resource.cci.+onnection3actor& and select Eext
2+. Enter the JNDI Name as follows- eis/DB/soademoDatabase
Eote that this is not the sae 'alue as in step 2 abo'e. It ust atch the 'alue &ou enter in
&our database connection &ou create when building &our application later.
21. Select #inis$
22. Select &' to sa'e the deplo&ent plan. Eote that &ou will need to change the plan nae if
&ou alread& used this plan nae for a different deplo&ent.
2. Edit the connection pool to reference the data source. Select the +onfiguration 8ab# expand
the connection factor& and select &our new connection pool !select the nae# not the
chec<box%
24. In the Properties table# select the 'alue listed for x(DataSource and replace it with &our
date source &ou created abo'e- jdbc/soademoDatabase. Press EE8E; <e& to appl& the
'alue. Select Save. Fou ust use the EE8E; <e& for the 'alue to be entered in the field.
Fou ust use the Save button to sa'e the 'alue.
2&. Io bac< to the ain Dep%oyments page to )pate the DbAdapter. Select Dep%oyments in
the left na'igation bar.
2'. Select the chec<box next to DbAdapter.
2(. Select )pate.
2). Select *eep%oy t$is app%ication and confir the deplo&ent plan location.
2*. Select #inis$
+. +onfir that the connection pool is added b& going bac< to the Db(apter >
Con!i"uration > &utboun Connection Too%s and expand the connection factor& listed
there.
1. +onfir the 'alue of the x(DataSource propert& that &ou entered in step 29. (oo< closel&J
8his is the ost coon place where the configuration is in error.
1.4.4 Creating the ,-S resources
8his deo re)uires a :6S resource. Fou create this using the Aeb(ogic Ser'er console. 3irst
we create the :6S )ueue and connection factor& and then a connection pool for that connection
factor&.
2. 6a<e sure &our ser'er is started using the instructions in Appendix A. If it is not alread&
open# open http-GGlocalhost-H$$1Gconsole to start the console and login using
weblogicGweblogic. ;eplace the host and port and usernaeGpassword to atch &our own
configuration.
3irst add the :6S Kueue.
. On left na'igation bar# expand Services > +essa"in" and select J+S +ou%es.
1-' End-2-End Purchase Order Processing Section 1.4
4. Select S&(J+S+ou%e
&. In the Summary o! *esources table# select New
'. Select the resource t&pe- ,ueue and select Next
(. Enter nae- demoFulfillmentQueue an JNDI name: jms/ demoFulfillmentQueue
). Select Next
*. Select Subep%oyment SOASubDeployment
4+. Select :6S Ser'er SOAJMSServer
Section 1.1 End-2-End Purchase Order Processing 1-(
41. Select #inis$
Eow add the +onnection 3actor&.
42. In the Summary o! *esources table# select New
4. Select the resource t&pe- Connection #actory and select Next
44. Enter nae- demoCF an JNDI name: jms/ demoCF.
4&. Select Next
4'. Select #inis$
Fou should see both the )ueue and the connection factor& listed in the Summary o! *esources
as shown here.
1-) End-2-End Purchase Order Processing Section 1.4
Eow add the connection pool
4(. In the left na'igation bar# select Dep%oyments
4). Select J+S (apter !select the nae# not the chec<box%
4*. Select the Con!i"uration tab and then the &utboun Connection Poo%s tab
&+. Select New
&1. Select the factor& oracle.tip.adapter.jms.!msConnectionFactor"
&2. Select Next
&. Enter eis/Queue/demo.
&4. Select #inis$
Section 1.1 End-2-End Purchase Order Processing 1-*
&&. At this point# you s$ou% be as-e !or t$e ep%oyment p%an %ocation. Se%ect t$e pat$ an
enter a i!!erent ep%oyment p%an t$an use be!ore !or t$e atabase aapter. I! you
c$oose t$e ep%oyment p%an use by t$e Db(apter. it wi%% be overwritten an you
wi%% $ave to re/enter t$e ata source.
&'. Select &'.
If &ou are not as<ed# chec< the &verview tab !or t$e ep%oyment p%an bein" use.
Io bac< to the new connection pool to hoo< up the connection factor&
&(. Select Con!i"uration tab
&). Expand the factor&- oracle.tip.adapter.jms.!msConnectionFactor"
&*. Select eis/Queue/demo
'+. Set the propert& Connection#actory0ocation 'alue to jms/demoCF. Fou ust use the
EE8E; <e& for the 'alue to be entered in the field. Fou ust use the Save button to sa'e
the 'alue.
'1. Select Save
'2. Eow the adapter ust be redeplo&ed. Select Dep%oyments
'. Select :6SAdapter
'4. Select )pate
'&. Lerif& that the correct deplo&ent plan is selected and Select Next
''. Select #inis$
1-1+ End-2-End Purchase Order Processing Section 1.4
'(. Io bac< to the :6SAdapter &utboun Connection Poo%s tab and re'iew the connection
factor& propert& 'alue for the eis/demo/Queue connection pool that &ou set in step @$. (oo<
closel&J 8his is the ost coon place where the configuration is in error.
'). Io bac< to the DbAdapter &utboun Connection Poo%s tab and re'iew the connection pool
properties that &ou set in step 29.
Ahen the two resources are added and confired# &ou are read& to start building the SOA
coposites. +ontinue with +hapter 2.
Section 1.1 End-2-End Purchase Order Processing 1-11