Prepare database
EMPLOYEE
Column
|
Datatype
|
Nullable
|
EMP_ID
|
NUMBER(22)
|
False
|
EMP_FIRSTNAME
|
VARCHAR2(50)
|
False
|
EMP_SURNAME
|
VARCHAR2(50)
|
True
|
OU_ID
|
NUMBER(22)
|
False
|
BIRTH_DATE
|
DATE
|
True
|
NATIONAL_ID
|
CHAR(13)
|
False
|
EMPLOYEE_BAK
Column
|
Datatype
|
Nullable
|
ID
|
NUMBER(22)
|
True
|
FIRSTNAME
|
VARCHAR2(50)
|
True
|
SURNAME
|
VARCHAR2(50)
|
True
|
OU_ID
|
NUMBER(22)
|
True
|
BIRTH_DATE
|
DATE
|
True
|
NATIONAL_ID
|
CHAR(13)
|
True
|
insertEmployee
CREATE OR REPLACE PROCEDURE OSBDEMO.insertEmployee(
p_emp_firstname IN EMPLOYEE.EMP_FIRSTNAME%TYPE,
p_emp_surname IN EMPLOYEE.EMP_SURNAME%TYPE,
p_ou_id IN EMPLOYEE.OU_ID%TYPE,
p_birth_date IN EMPLOYEE.BIRTH_DATE%TYPE,
p_national_id IN EMPLOYEE.NATIONAL_ID%TYPE)
IS
BEGIN
INSERT INTO OSBDEMO.EMPLOYEE ("EMP_ID", "EMP_FIRSTNAME", "EMP_SURNAME", "OU_ID", "BIRTH_DATE", "NATIONAL_ID")
VALUES (EMP_SEQ.NEXTVAL, p_emp_firstname,p_emp_surname, p_ou_id, p_birth_date, p_national_id);
END;
ทดสอบเรียกใช้งาน
CALL OSBDEMO.insertEmployee('Johny','English',11,SYSDATE,'1234567890123')
ดูผลลัพธ์
SELECT * FROM OSBDEMO.EMPLOYEE ORDER BY EMP_ID DESC
|
Artifact files
Inbound
|
Files
|
Schema
|
xsd/CopyEmployeeService.xsd
|
WSDL
|
CopyEmployeeService.wsdl
|
Proxy Service
|
CopyEmployeeProxyService.proxy
|
Outbound (AddNewEmployee)
|
Files
|
WSDL
|
NewEmployeeService.wsdl
|
JCA config files
|
NewEmployeeService_db.jca
|
Schema
|
xsd/NewEmployeeService_sp.xsd
|
Business Service
|
NewEmployeeService_db.biz
NewEmployeeService_db.wsdl
|
Outbound (QueryAllEmployee)
|
Files
|
WSDL
|
QueryEmployeeService1.wsdl
|
JCA config files
|
QueryEmployeeService1_db.jca
|
Schema
|
xsd/QueryEmployeeService1.xsd
|
Business Service
|
QueryEmployeeService1_db.biz
QueryEmployeeService1_db.wsdl
|
Outbound (ReplicaAllEmployee)
|
Files
|
WSDL
|
MergeEmployeeService1.wsdl
|
JCA config files
|
MergeEmployeeService1_db.jca
MergeEmployeeService1-or-mappings.xml
MergeEmployeeService1-properties.xml
|
Schema
|
MergeEmployeeService1_table.xsd
|
Business Service
|
MergeEmployeeService1_db.biz
MergeEmployeeService1_db.wsdl
|
From
|
To
|
Files
|
Inbound
|
AddNewEmployee
|
CopyEmployeeService_To_NewEmployeeService.xsl
|
Inbound
|
QueryAllEmployee
|
CopyEmployeeService_To_QueryEmployeeService1.xsl
|
Inbound
|
ReplicaAllEmployee
|
CopyEmployeeService_To_MergeEmployeeService1.xsl
|
JDeveloper:
Inbound
xsd =>
wsdl =>
Outbound (AddNewEmployee)
สร้าง Database Adapter


Outbound (QueryAllEmployee)
Outbound (ReplicaAllEmployee)


Transformation =>
CopyEmployeeService_To_NewEmployeeService.xsl
CopyEmployeeService_To_QueryEmployeeService1.xsl
CopyEmployeeService_To_MergeEmployeeService1.xsl
OEPE:
เปิด Eclipse สร้าง Business Service ทั้ง 3 ตัว ด้วยการ Right-click ที่ jca file และ Generate Service
สร้างเสร็จสามารถทดสอบ Business Service ด้วย Service Bus Console
สร้าง Proxy Service
- ให้ browse ไปหา WSDL file ที่กำหนด จากนั้นเลือก Binding
OEPE จะ check WSDL file และกำหนด Protocol ให้เรา Confirm
กำหนดให้เป็น Transactional Proxy ด้วยการเลือก Transaction Required=Enabled (จะใช้ได้ต้องทำการ configure JDBC driver class เป็น XA ก่อน)
เริ่มวาด Message Flow ด้วยการ Drag and drop PipelinePairNode1 จาก Design Palette
สร้าง Stage แรกในขา Request Pipeline ด้วยการ Drag and drop Stage จาก Design Palette
NewEmployee Stage
ภายใน stage นี้ประกอบด้วย Publish action เพื่อเรียก NewExployeeService
Replace ด้วย XSL
ระบุให้เป็น Synchronous call
Query Stage
Add Namespaces ใน stage นี้
ภายใน stage ที่ 2 นี้ประกอบด้วย
Assign ค่าให้ Variable
ระบุเป็น Synchronous call
Replace action ให้ใส่ Code ใน Expression
let $in_xml := $QueryResponseVariable
for $i in $in_xml/quer:QueryEmployeeService1Output
let $r :=
<quer:EmployeeBak>
<quer:id>
{ data($i/quer:EMP_ID) }
</quer:id>
<quer:firstname>
{ data($i/quer:EMP_FIRSTNAME) }
</quer:firstname>
<quer:surname>
{ data($i/quer:EMP_SURNAME) }
</quer:surname>
<quer:ouId>
{ data($i/quer:OU_ID) }
</quer:ouId>
<quer:birthDate>
{ data($i/quer:BIRTH_DATE) }
</quer:birthDate>
<quer:nationalId>
{ data($i/quer:NATIONAL_ID) }
</quer:nationalId>
</quer:EmployeeBak>
return $r
|
Replicate Stage
Add Namespaces ใน stage นี้





Completed Message Flow
เป็นอันเสร็จสิ้น จากนั้นลองทดสอบด้วย payload
<cop:CopyEmployeeRequest xmlns:cop="http://www.soabpm-vm.com/SOATrainingSamples/TransactionalInsert/xsd/CopyEmployeeService">
<!--Zero or more repetitions:-->
<cop:CopyEmployeeRequestInput>
<cop:EMP_FIRSTNAME>Austin</cop:EMP_FIRSTNAME>
<cop:EMP_SURNAME>Power</cop:EMP_SURNAME>
<cop:OU_ID>11</cop:OU_ID>
<cop:BIRTH_DATE>2008-09-28T18:49:45</cop:BIRTH_DATE>
<cop:NATIONAL_ID>2222222222222</cop:NATIONAL_ID>
</cop:CopyEmployeeRequestInput>
</cop:CopyEmployeeRequest>
|
================
Good Luck.
================