business process design in soa

76
Chapter 16. Service- Oriented Design Part IV Business Process Design Oleh: Farid Ridho

Upload: farid-er

Post on 24-Jun-2015

462 views

Category:

Documents


3 download

TRANSCRIPT

Page 1: Business Process Design in SOA

Chapter 16. Service-Oriented Design

Part IV Business Process Design

Oleh: Farid Ridho

Page 2: Business Process Design in SOA

Ada apa di bab ini?

• WS-BPEL language basic• WS-Coordination overview• disain Business Process

Page 3: Business Process Design in SOA

WS-BPEL Language Basic

• Bahasa berbasis XML• Mendefinisikan bisnis proses• Merupakan bahasa untuk orkestrasi

Page 4: Business Process Design in SOA

Struktur Umum WS-BPEL

Page 5: Business Process Design in SOA

Sejarah BPEL4WS dan WS-BPEL

• BPEL4WS pertama kali disusun pada juli 2002 oleh tim gabungan IBM, Microsoft dan BEA -> BPEL4WS 1.0

• SAP dan Siebel System bergabung dengan tim dan merilis versi terbaru pada mei 2003 -> BPEL4WS 1.1

• BPEL4WS 2.0 -> WS-BPEL

Page 6: Business Process Design in SOA

Prasyarat

• Pengetahuan dasar tentang orchestration, coordination, atomic transactions dan business process

• Dibahas di bab 6

Page 7: Business Process Design in SOA

The process element (1)

• Merupakan root elemen• Mempunyai atribut name• Untuk mendefinisikan proses

Page 8: Business Process Design in SOA

The process element (2)

<process name="TimesheetSubmissionProcess" targetNamespace="http://www.xmltc.com/tls/process/" xmlns= "http://schemas.xmlsoap.org/ws/2003/03/ business-process/" xmlns:bpl="http://www.xmltc.com/tls/process/" xmlns:emp="http://www.xmltc.com/tls/employee/" xmlns:inv="http://www.xmltc.com/tls/invoice/" xmlns:tst="http://www.xmltc.com/tls/timesheet/" xmlns:not="http://www.xmltc.com/tls/notification/"> <partnerLinks> ... </partnerLinks> <variables> ... </variables> <sequence> ... </sequence> ... </process>

Page 9: Business Process Design in SOA

The partnerLinks and partnerLink elements (1)

• Berperan sebagai client pada proses• Bertanggungjawab melakukan invoke pada

process service• Dapat di-invoke oleh process service itu sendiri• Memiliki atribut myRole dan partnerRole

Page 10: Business Process Design in SOA

The partnerLinkType element (2)

<definitions name="Employee" targetNamespace="http://www.xmltc.com/tls/employee/wsdl/" xmlns="http://schemas.xmlsoap.org/wsdl/" xmlns:plnk= "http://schemas.xmlsoap.org/ws/2003/05/partner-link/" ... > ... <plnk:partnerLinkType name="EmployeeServiceType" xmlns= "http://schemas.xmlsoap.org/ws/2003/05/partner-link/"> <plnk:role name="EmployeeServiceProvider"> <portType name="emp:EmployeeInterface"/> </plnk:role> </plnk:partnerLinkType> ... </definitions>

Page 11: Business Process Design in SOA

The partnerLinks and partnerLink elements (2)

<partnerLinks> <partnerLink name="client" partnerLinkType="tns:TimesheetSubmissionType" myRole="TimesheetSubmissionServiceProvider"/><partnerLink name="Invoice" partnerLinkType="inv:InvoiceType" partnerRole="InvoiceServiceProvider"/><partnerLink name="Timesheet" partnerLinkType="tst:TimesheetType" partnerRole="TimesheetServiceProvider"/><partnerLink name="Employee" partnerLinkType="emp:EmployeeType" partnerRole="EmployeeServiceProvider"/><partnerLink name="Notification" partnerLinkType="not:NotificationType" partnerRole="NotificationServiceProvider"/>

</partnerLinks>

Page 12: Business Process Design in SOA

The partnerLinkType element (1)

• Digunakan untuk setiap partner service yang terlibat pada proses

• Biasanya juga di-embedded pada dokumen WSDL

• Berisi satu elemen peran (role) masing-masing myRole dan partnerRole

• Pada akhirnya bisa memiliki satu atau dua elemen child role

Page 13: Business Process Design in SOA

The variables element (1)

• Menyimpan informasi yang berhubungan dengan workflow logic

• Keseluruhan pesan dan set data dalam bentuk XSD dapat disimpan ke dalam variable dan ditemukan kembali selama proses berjalan

Page 14: Business Process Design in SOA

The variables element (2)<variables><variable name="ClientSubmission“ messageType="bpl:receiveSubmitMessage"/> <variable name="EmployeeHoursRequest“ messageType="emp:getWeeklyHoursRequestMessage"/> <variable name="EmployeeHoursResponse" messageType="emp:getWeeklyHoursResponseMessage"/> <variable name="EmployeeHistoryRequest" messageType="emp:updateHistoryRequestMessage"/> <variable name="EmployeeHistoryResponse" messageType="emp:updateHistoryResponseMessage"/> ... </variables>

Page 15: Business Process Design in SOA

The getVariableProperty and getVariableData functions (1)

• getVariableProperty(variable name, property name)– Mengekstrak nilai properti dari suatu variabel– Argumen pertama adalah nama variabel,

argumen kedua adalah nama propertinya

• getVariableData(variable name, part name, location path)– Mendapatkan data dari variabel

Page 16: Business Process Design in SOA

The getVariableProperty and getVariableData functions (2)

getVariableData ('InvoiceHoursResponse', 'ResponseParameter')getVariableData ('input','payload', '/tns:TimesheetType/Hours/...')

Page 17: Business Process Design in SOA

The sequence element (1)

• Untuk mengatur serangkaian aktivitas agar bisa dieksekusi secara berurutan (sequential)

• Sebuah aktivitas akan dieksekusi apabila aktivitas sebelumnya pada antrian telah selesai

Page 18: Business Process Design in SOA

The sequence element (2)

<sequence><receive> ... </receive><assign> ... </assign><invoke> ... </invoke><reply> ... </reply>

</sequence>

Page 19: Business Process Design in SOA

The invoke element (1)

• Menjelaskan operasi dari partner service yang diinginkan (invoke) selama eksekusi

• Pada elemen invoke biasanya terdapat 5 atribut yaitu partnerLink, portType, operation, inputVariable, dan outputVariable

Page 20: Business Process Design in SOA

The invoke element (2)

<invoke name="ValidateWeeklyHours" partnerLink="Employee" portType="emp:EmployeeInterface" operation="GetWeeklyHoursLimit" inputVariable="EmployeeHoursRequest" outputVariable="EmployeeHoursResponse"/>

Page 21: Business Process Design in SOA

The receive element

• Membuat informasi process service yang diinginkan pada saat melakukan request

• Process service sebagai process provider yang diminta (invoke)

Page 22: Business Process Design in SOA

The receive element (2)

<receive name="receiveInput“partnerLink="client" portType="tns:TimesheetSubmissionInterface" operation="Submit“variable="ClientSubmission“createInstance="yes"/>

Page 23: Business Process Design in SOA

The reply element (1)

• Terdapat pada pertukaran synchronous• Bertanggungjawab untuk membuat detil dari

respon pesan yang dikembalikan kepada partner service yang melakukan request

• Berhubungan dengan elemen partnerLink yang sama dengan yang ada pada elemen receive

Page 24: Business Process Design in SOA

The reply element (2)

<reply partnerLink="client" portType="tns:TimesheetSubmissionInterface" operation="Submit" variable="TimesheetSubmissionResponse"/>

Page 25: Business Process Design in SOA

The switch, case, and otherwise elements (1)

• Untuk menambahkan conditional logic pada definisi proses

• Mirip dengan switch case yang ada di bahasa pemrograman– Switch -> scope– Case -> conditional– Otherwise -> catch all the end of switch (if case

condition failed, otherwise are executed)

Page 26: Business Process Design in SOA

The switch, case, and otherwise elements (2)

<switch><case condition= "getVariableData('EmployeeResponseMessage', 'ResponseParameter')=0"> ... </case> <otherwise> ... </otherwise></switch>

Page 27: Business Process Design in SOA

The assign, copy, from, and to elements (1)

• Memiliki kemampuan untuk meng-copy values diantara variable proses

• Memungkinkan kita memberikan data melalui proses sebagai informasi yang diterima dan dirubah selama proses eksekusi

Page 28: Business Process Design in SOA

The assign, copy, from, and to elements (2)

<assign><copy><from variable="TimesheetSubmissionFailedMessage"/> <to variable="EmployeeNotificationMessage"/></copy><copy><from variable="TimesheetSubmissionFailedMessage"/><to variable="ManagerNotificationMessage"/></copy></assign>

Page 29: Business Process Design in SOA

faultHandlers, catch, and catchAll elements

• Digunakan untuk penanganan kondisi error• Dapat terdiri dari banyak elemen catch• Penanganan default error menggunakan

elemen catchAll

Page 30: Business Process Design in SOA

faultHandlers, catch, and catchAll elements

<faultHandlers><catch faultName="SomethingBadHappened" faultVariable="TimesheetFault"> ...</catch><catchAll> ... </catchAll></faultHandlers>

Page 31: Business Process Design in SOA

Pembahasan WS-BPEL lebih lengkap

• Silahkan kunjungi:

http://docs.oasis-open.org/wsbpel/2.0/wsbpel-v2.0.pdf

Page 32: Business Process Design in SOA

WS-Coordination Overview

Page 33: Business Process Design in SOA

WS-Coordination Overview

• Mekanisme untuk manajemen konteks yang dapat diterapkan untuk mendukung transaksi yang atomic dan long-running

• Mekanisme coordination meliputi activation service, registration service, a coordinator, dan participants yang mengimplementasikan protokol atau aturan-aturan tertentu (bab 6)

• Manajemen konteks diatur secara otomatis oleh orchestration engine yang dibuat dengan WS-BPEL

Page 34: Business Process Design in SOA

WS-Coordination Overview

• The CoordinationContext element• The Identifier and Expires elements• The CoordinationType element• The RegistrationService element

Page 35: Business Process Design in SOA

Service-oriented Business Process Design

Page 36: Business Process Design in SOA

Disain Service-oriented

Page 37: Business Process Design in SOA

Overview

• Menerjemahkan business process requirement yang telah dikumpulkan dengan tepat dan menerapkannya dengan akurat

• Perhitungkan semua kemungkinan variasi aktivitas proses

• Termasuk memperhitungkan bagaimana proses merespon kondisi yang abnormal

• Proses bisnis dirancang oleh analis menggunakan alat permodelan -> menghasilkan diagram

• Implementasi ditangani oleh arsitek dan developer

Page 38: Business Process Design in SOA

Process Service Design

Page 39: Business Process Design in SOA

Process Description

Page 40: Business Process Design in SOA

Case Study: TLS TimeSheet Submission

Process (Bab 12)

Page 41: Business Process Design in SOA

Service Design

• Untuk menentukan partner link pada WS-BPEL

>>

Page 42: Business Process Design in SOA

Service Composition

Page 43: Business Process Design in SOA

Service Candidate

Page 44: Business Process Design in SOA

Designing Business Process

Page 45: Business Process Design in SOA

Step by step

1. Menyusun skenario interaksi antara process service dengan partner service

2. Merancang antarmuka process service3. Membentuk percakapan process service4. Menentukan logika proses5. Meluruskan skenario interaksi dan perbaiki

proses (opsional)

Page 46: Business Process Design in SOA

1. Menyusun skenario interaksi

• Tentukan requirement pertukaran pesan pada process service dari informasi-informasi yang sudah ada sebelumnya:– Workflow logic yang telah dihasilkan pada service

modelling (Bab 12)– Kandidat process service (Bab 12)– Service design yang sudah ada (existing) (Bab 15)

• Informasi ini digunakan untuk menganalisis semua kemungkinan interaksi antara process service dan partner service

Page 47: Business Process Design in SOA

Successful completion of the Timesheet Submission Process

Page 48: Business Process Design in SOA

A failure condition caused by an authorization rejection

Page 49: Business Process Design in SOA

The incoming and outgoing request messages expected to be processed by the Timesheet

Submission Process Service ->

Page 50: Business Process Design in SOA

2. Merancang antarmuka process service

• Menentukan definisi service untuk process service• Dalam bentuk WSDL• Tinjau ulang WSDL yang sedang digunakan dan perbaiki

jika memang diperlukan• Beberapa pertimbangan:

– Dokumen input dan output diperlukan untuk setiap proses operasi

– Buat definisi WSDL portType atau interface area– Tambahankan informasi meta melalui element document– Terapkan standar disain tambahan dalam batas-batas alat

permodelan

Page 51: Business Process Design in SOA

Case Study

• Timesheet submission process hanya memiliki satu operasi yang dijalankan oleh client yaitu submit

Page 52: Business Process Design in SOA

Timesheet Submission Process Service design

Page 53: Business Process Design in SOA

The abstract service definition for the Timesheet Submission Process Service

<definitions name="TimesheetSubmission" targetNamespace="http://www.xmltc.com/tls/process/wsdl/" xmlns="http://schemas.xmlsoap.org/wsdl/" xmlns:ts="http://www.xmltc.com/tls/timesheet/schema/" xmlns:tsd= "http://www.xmltc.com/tls/timesheetservice/schema/" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:tns="http://www.xmltc.com/tls/timesheet/wsdl/" xmlns:plnk= "http://schemas.xmlsoap.org/ws/2003/05/partner-link/"> <types> <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" targetNamespace= "http://www.xmltc.com/tls/ timesheetsubmissionservice/schema/"> <xsd:import namespace= "http://www.xmltc.com/tls/timesheet/schema/" schemaLocation="Timesheet.xsd"/> <xsd:element name="Submit"> <xsd:complexType> <xsd:sequence> <xsd:element name="ContextID" type="xsd:integer"/> <xsd:element name="TimesheetDocument" type="ts:TimesheetType"/> </xsd:sequence> </xsd:complexType> </xsd:element> </xsd:schema> </types> <message name="receiveSubmitMessage"> <part name="Payload" element="tsd:TimesheetType"/> </message> <portType name="TimesheetSubmissionInterface"> <documentation> Initiates the Timesheet Submission Process. </documentation> <operation name="Submit"> <input message="tns:receiveSubmitMessage"/> </operation> </portType> <plnk:partnerLinkType name="TimesheetSubmissionType"> <plnk:role name="TimesheetSubmissionService"> <plnk:portType name="tns:TimesheetSubmissionInterface"/> </plnk:role> </plnk:partnerLinkType> </definitions>

Page 54: Business Process Design in SOA

3. Membentuk percakapan process service

• Tentukan partner services yang berpartisipasi dalam proses dan tetapkan perannya

• Tambahkan konstruk partnerLinkType pada WSDL

• Buat elemen partnerLink untuk setiap partner service

• Tentukan elemen variable untuk mewakili pertukaran pesan masuk dan keluar

Page 55: Business Process Design in SOA

The revised Employee service definitions construct

<definitions name="Employee" targetNamespace="http://www.xmltc.com/tls/employee/wsdl/" xmlns="http://schemas.xmlsoap.org/wsdl/" xmlns:act= "http://www.xmltc.com/tls/employee/schema/accounting/" xmlns:hr="http://www.xmltc.com/tls/employee/schema/hr/" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:tns="http://www.xmltc.com/tls/employee/wsdl/" xmlns:plnk= "http://schemas.xmlsoap.org/ws/2003/05/partner-link/"> ... <plnk:partnerLinkType name="EmployeeType"> <plnk:role name="EmployeeService"> <plnk:portType name="tns:EmployeeInterface"/> </plnk:role> </plnk:partnerLinkType> </definitions>

Page 56: Business Process Design in SOA

The partnerLinks construct containing partnerLink elements for each of the process

partner services<partnerLinks> <partnerLink name="client" partnerLinkType="bpl:TimesheetSubmissionProcessType" myRole="TimesheetSubmissionProcessServiceProvider"/> <partnerLink name="Invoice" partnerLinkType="inv:InvoiceType" partnerRole="InvoiceServiceProvider"/> <partnerLink name="Timesheet" partnerLinkType="tst:TimesheetType" partnerRole="TimesheetServiceProvider"/> <partnerLink name="Employee" partnerLinkType="emp:EmployeeType" partnerRole="EmployeeServiceProvider"/> <partnerLink name="Notification" partnerLinkType="not:NotificationType" partnerRole="NotificationServiceProvider"/> </partnerLinks>

Page 57: Business Process Design in SOA

The variables construct containing individual variable elements representing input and output messages from all partner

services and for the process service itself

<variables> <variable name="ClientSubmission" messageType="bpl:receiveSubmitMessage"/> <variable name="EmployeeHoursRequest" messageType="emp:getWeeklyHoursRequestMessage"/> <variable name="EmployeeHoursResponse" messageType="emp:getWeeklyHoursResponseMessage"/> <variable name="EmployeeHistoryRequest" messageType="emp:updateHistoryRequestMessage"/> <variable name="EmployeeHistoryResponse" messageType="emp:updateHistoryResponseMessage"/> <variable name="InvoiceHoursRequest" messageType="inv:getBilledHoursRequestMessage"/> <variable name="InvoiceHoursResponse" messageType="inv:getBilledHoursResponseMessage"/> <variable name="TimesheetAuthorizationRequest" messageType="tst:getAuthorizedHoursRequestMessage"/> <variable name="TimesheetAuthorizationResponse" messageType="tst:getAuthorizedHoursResponseMessage"/> <variable name="NotificationRequest" messageType="not:sendMessage"/></variables>

Page 58: Business Process Design in SOA

4. Menentukan logika proses

• Semua keterangan alur kerja yang ada diimplementasikan dengan WS-BPEL

Page 59: Business Process Design in SOA

Case Study: A descriptive, diagrammatic view of the process definition logic

Page 60: Business Process Design in SOA

Case study

• Yang pertama dibuat adalah elemen receive<receive xmlns= "http://schemas.xmlsoap.org/ws/2003/03/business-process/" name="receiveInput" partnerLink="client" portType="tns:TimesheetSubmissionInterface" operation="Submit" variable="ClientSubmission" createInstance="yes"/>

• Ketika document diterima, format data akan disimpan pada variable clientSubmission

Page 61: Business Process Design in SOA

Case study

• Sebelum meminta invoice service, konstruk assign digunakan untuk mengekstrak value dari timesheet document yang sekarang tersimpan di clientSubmission<assign name="GetInvoiceID"><copy><from variable="ClientSubmission" part="payload" query="/TimesheetType/BillingInfo"/><to variable="InvoiceHoursRequest" part="RequestParameter"/></copy></assign>

Page 62: Business Process Design in SOA

Case study

• Tambahkan elemen invoke setelah variable InvoiceHoursRequest berisi value yang dibutuhkan untuk operasi GetBilledHours pada service invoice <invoke name="ValidateInvoiceHours" partnerLink="Invoice" operation="GetBilledHours" inputVariable="InvoiceHoursRequest" outputVariable="InvoiceHoursResponse" portType="inv:InvoiceInterface"/>

Page 63: Business Process Design in SOA

Case study

• Setelah meminta invoice service, pesan balasan diterima dari operasi GetBilledHours. Pesan ini disimpan pada variabel InvoiceHoursResponse.

• Jika nilainya sesuai dengan yang ada pada timesheet document, maka jam kerja telah divalidasi.

• Untuk memutuskan hal ini maka digunakan element switch, case dan condition

Page 64: Business Process Design in SOA

Case study

<switch name="BilledHoursMatch"><case condition= "getVariableData('InvoiceHoursResponse', 'ResponseParameter') != getVariableData('input','payload', '/tns:TimesheetType/Hours/...')"><throw name="ValidationFailed" faultName="ValidateInvoiceHoursFailed"/></case> </switch>Jika kondisi tidak terpenuhi maka lama jam telah divalidasi, jika terpenuhi maka terjadi fault yang direpresentasikan melalui elemen throw kemudian mengirimkan ke faultHandlers

Page 65: Business Process Design in SOA

Case study

<faultHandlers><catchAll><sequence> ... </sequence></catchAll></faultHandlers>Fault handler menjalankan task:– Update employee profile history– Send notification to managaer– Send notfication to employee

Page 66: Business Process Design in SOA

A visual representation of the process logic within the faultHandlers construct

Page 67: Business Process Design in SOA

Update employee profile history

• Menggunakan konstruk assign dengan dua copy, satu untuk mendapatkan EmployeeID dari variabel ClientSubmission , sedang yang lainnya untuk menambahkan employee profile history

Page 68: Business Process Design in SOA

Update employee profile history

<assign name="SetEmployeeMessage"> <copy> <from variable="ClientSubmission" .../> <to variable="EmployeeHistoryRequest" .../> </copy> <copy> <from expression="..."/> <to variable="EmployeeHistoryRequest" .../> </copy></assign><invoke name="UpdateHistory" partnerLink="Employee" portType="emp:EmployeeInterface" operation="UpdateHistory" inputVariable="EmployeeHistoryRequest" outputVariable="EmployeeHistoryResponse"/>

Two copy elements used to populate the EmployeeHistoryRequest message

Page 69: Business Process Design in SOA

Send notification

• Aktifitas terakhir pada proses adalah mengirimkan notifikasi kepada managaer dan employee

Page 70: Business Process Design in SOA

5. Menyelaraskan skenario interaksi dan memperbaiki proses (opsional)

• Tinjau ulang skenario interaksi yang telah dibuat pada step 1

• Periksa definisi proses WS-BPEL untuk optimasi

Page 71: Business Process Design in SOA

Keuntungan dari menyelaraskan process logic dengan WS-BPEL

• Peta interaksi servis adalah bagian yang sangat penting sebagai dokumentasi untuk perbaikan ke depan atau sebagai knowledge transfer requirement

• Sebagai uji kasis sehingga memungkinkan penguji menghindari analisis yang bersifat spekulasi

• Memungkinkan ditemukannya penambahan process logic yang baru dan juga fault handling baru.

Page 72: Business Process Design in SOA

Keuntungan memperbaiki process definition

• Menggabungkan atau menataulang aktifitas untuk meraih peningkatan performa

• Mempersingkat markup code untuk memudahkan maintenance

• Menemukan fitur yang sebelumnya tidak dipertimbangkan.

Page 73: Business Process Design in SOA

Sequential, synchronous execution of process activities.

Page 74: Business Process Design in SOA

Concurrent execution of process activities using the flow construct

Page 75: Business Process Design in SOA

Tool untuk Permodelan Bisnis Proses

• Modeliosoft• TestMaker• Eclipse• eBPMN• Dan lain-lain

Page 76: Business Process Design in SOA

Selesai

Sekian dan terimakasih