Business Process Execution Language for Web Services
Second Edition
An architect and developer's guide to orchestrating web services using BPEL4WS
Matjaz B. Juric
With Benny Mathew and Poornachandra Sarang
BIRMINGHAM - MUMBAI
Table of Contents
Preface
Chapter 1: Introduction to BPEL and SOA
Why Business Processes Matter 5 Automation of Business Processes 6
Exposing and Accessing the Functionality of Applications as Services 7 Enterprise Bus Infrastructure for Communication and Management of Services 7
Integration between Services and Applications 7 Composition of Exposed Services into Business Processes 7
Web Services 8 How Web Services Differ from their Predecessors 9
Web Services Technology Stack 9
Enterprise Service Bus 10
ESB Features 11 Service Oriented Architecture 12
SOA Concepts 12
Services 13 Interfaces 13 Messages 13 Synchronicity 13 Loose Coupling 14 Registries 14 Quality of Service 14 Composition of Services into Business Processes 14
Service Composition 16 BPEL for Service Composition 17
BPEL Features 18 Orchestration and Choreography 19
Executable and Abstract Processes 21 Relation of BPEL to Other Languages 22
ebXML BPSS 22
BPML 23 WSCI 24 WS-CDL 24
BPEL Servers Overview 25 Oracle BPEL Process Manager 27
Microsoft BizTalk 27 IBM WebSphere Business Integration Server Foundation 27
IBM BPWS4J 28 ActiveBPEL Engine and ActiveWebflow 28
OpenStorm Service Orchestrator 29
The Future of BPEL 29
Conclusion 30 Chapter 2: Web Services Technology Stack 31
E-Business Collaborations 31
WS-Security 34 Example 34 Binary Security Token 35
Referencing an External Security Token 35
Faults 36 Typical Business Transaction Scenario 36
WS-Coordination 37 The Framework 38 Scenario 38
CoordinationContext 40 CreateCoordinationContext 40 CreateCoordinationContextResponse 41
Register 41 RegisterResponse 41
Faults 41 Web Services Transaction Specifications 42
Atomic Transaction 42
Sharing Context Information 42 Coordination Protocols 43
Business Activity 44
Sharing the Context Information 45
Coordination Protocols 45
OASIS BTP 46 The BTP Stack 48 The BTP Model 48
Atomic Transactions 49 Cohesive Transactions 49
Table of Contents
Reliable Messaging 49 Messaging Model 50
Example 51 Requesting Acknowledgement 51
Delivery Assurances 51 Other Assertions 52
Faults 52
WS-Addressing 53 Endpoint Reference 53
Faults 55 WS-lnspection 55
Inspection Document Hierarchy 56
WS-Policy 56 Policy Outline 57
The <wsp:AII> Operator 57 The <wsp:ExactlyOne> Operator 57
The <wsp:OneOrMore> Operator 57 The <wsp:Policy> Operator 57
Policy Assertions 57
Example 58 Policy Inclusion 58
WS-Eventing 59 Event Subscription 59
Response to Event Subscription 60
Subscription Renewal 61
Unsubscribing 61 Subscription End Message 62
Conclusion 63 Chapter 3: Service Composition with BPEL 65
Developing Business Processes with BPEL 65
Core Concepts 67 Invoking Web Services 70
Invoking Asynchronous Web Services 71 Synchronous/Asynchronous Business Processes 72
Understanding Links to Partners 73
Partner Link Types 75 Defining Partner Links 77 BPEL Process Tag 78
Variables
Providing the Interface to BPEL Processes: <invoke>, <receive>, and
<reply>
Assignments Conditions
BPEL Business Process Example Involved Web Services
Employee Travel Status Web Service Airline Web Service
WSDL for the BPEL Process Partner Link Types
Business Process Definition
BPEL Process Outline Partner Links
Variables
BPEL Process Main Body
Asynchronous BPEL Example Modify the BPEL Process WSDL Modify Partner Link Types
Modify the BPEL Process Definition Conclusion
Chapter 4: Advanced BPEL
78 79 81 84 85 88
88 90
92 93 95
97 97 98 99
102 103 104 104 106 107
Advanced Activities 108 Activity Names 108
Loops 108 Delays 110
Deadline and Duration Expressions 110
Empty Activities 111 Process Termination 112 Fault Handling and Signaling 112
WSDL Faults 112 Signaling Faults 113
Signaling Faults to Clients in Synchronous Replies 114 Signaling Faults to Clients in Asynchronous Scenarios 115
Handling Faults 117
Selection of a Fault Handler 118 Synchronous Example 119 Asynchronous Example 121 Inline Fault Handling 122
Table of
Scopes 123 Example 125
First Scope 127 Second Scope 129 Third Scope 131
Serializable Scopes 132 Compensation 132
Compensation Handlers 133
Example 135
Invoking Compensation Handlers 136
Managing Events 137 Pick Activity 138
Message Events 138 Alarm Events 139 Example 139
Event Handlers 140
Example 142
Business Process Lifecycle 143 Correlation and Message Properties 145
Message Properties 145
Mapping Properties to Messages 146
Extracting Properties 147 Properties and Assignments 147
Correlation Sets 148 Using Correlation Sets 149 Concurrent Activities and Links 150
Sources and Targets 151
Example 151
Transition Conditions 157 Join Conditions and Link Status 158
Join Failures 159
Suppressing Join Failures 160
Dynamic Partner Links 161 Abstract Business Processes 162
Model Driven Approach: Generating BPEL from UML
Activity Diagrams 164 Conclusion
Chapter 5: Oracle BPEL Process Manager and BPEL Designer: Overview 167
Overview and Architecture 167
BPEL Server 169
Core BPEL Engine 169 WSDL Bindings 169 Integration Services 170
BPEL Console 170 BPEL Designer 171 Database 171 Process Deployment Example 171
Process Descriptor 172
Configuration Properties 174
Setting the Environment 175 BPEL Compiler and Revision Numbers 176
Deployment and Domains 177
Ant Utility 177
Process Management with the BPEL Console 178
Visual Flow 181 Instance Auditing 182 Debugging 182 Overview of Other BPEL Console Functions 184
Deploying Processes 186
Management 187 Performance Tuning 188
Domains and Administration 190
Administration of Server-Related Parameters 191
Managing BPEL Domains 192
Graphical Development with BPEL Designer 193
JDeveloper BPEL Designer 194
Importing Existing BPEL Processes 195 Partner Links and Web Services 195
Variables 196 Process Activities 198 Copy Rule Editor 199 XPath Expression Builder 200
XSLT Mapper 201 BPEL Validation Browser 203
Building and Deploying 204
Eclipse BPEL Designer 206
Partner Links and Web Services 207
Table of Contents
Variables 208 XML Type Browser 209
Process Map 210 Copy Rule Editor 211 Function Wizard 211 Building and Deploying 212
Summary 213 Chapter 6: Oracle BPEL Process Manager: Advanced Features 215
Extension Functions and Activities 215 Transformation and Query Support 217 Data and Array Manipulation 218
XML Manipulation 220 Date and Time Expressions 220
Process Identification 221 LDAP Access and User Management 221
Dynamic Parallel Flow 222 Dynamic Flow Example 223 Providing a List of Partner Links 224
Dynamic Parallel Invocation of Airline Services 224
Dynamic Partner Links 225 Offer Selection Loop 226 Deploying and Testing the Example 227
Web Services Invocation Framework 228
Advantages of WSIF 229 Java to XML Bindings 230
XML Facades 231
Invoking a Java Class through WSIF 233
Defining WSIF Bindings in WSDL 233 WSIF Bindings for Java Classes 234
Testing the Example 235
Exception Handling 237
User Exceptions in Java 238 Defining Faults in WSDL 238 Defining WSIF Binding for an Exception 239
Custom Exception Serializers 241
Invoking EJB through WSIF 243
WSDL for Session Bean 244 WSIF Binding for EJB 245
Generating WSIF Bindings from JDeveloper 247
Java Code Embedding 249 Invoking a Java Class from Embedded Code 250
Notification Service 253 Email Example 254
Notification Wizard 255 Review of Code 258 Testing the Example 258
Mail and JMS Services 259 Workflow Service 259
Workflow Patterns 260
Example 261
Checking User Outcome 267 Worklist Application to Approve Ticket 268
Identity Service 271 BPEL Server APIs 273
Summary 274 Chapter 7: MS BizTalk Server 275
Overview 275 Support for BPEL and XLANG/s 276
Architecture 276 Ports 277
Receive Locations 278
Adapters 278 Receive Pipelines 279
Message Contexts 280 Promoted Properties 280 Distinguished Fields 280
The MessageBox 281
How Publish-Subscribe works 281
Orchestrations 281
Maps 282 Business Rules Engine 283
Send Pipeline 283 Building a Sample Orchestration in BizTalk 284
Scenario 284 Implementation 285 Exporting Orchestration to BPEL 291
Importing BPEL Processes into BizTalk 294
Table of Contents
Do's and Don'ts for BPEL Compliance in BizTalk 305 Comparing BizTalk Orchestration Constructs with BPEL 306
Receive and Send Shapes (<receive>, <invoke>, <reply>) 307 Port and Role Link Shapes (<partnerLink>, <partnerLinkType>, <role>) 307
Expression and Message Assignment Shapes (<assign>, <copy>,
<from>, <to>) 308 Decide Shape (<switch>, <case>, <otherwise>) 309
Delay Shape (<wait>) 310 Parallel Actions Shape (<flow>) 310
Loop Shape (<while>) 311 Suspend Shape 311 Terminate Shape (<terminate>) 311
Advanced BPEL Functions using BizTalk 312 Listen Shape (<pick>, <onMessage>, <onAlarm>) 312
Scope Shape (<scope>) 313 Throw Exception Shape and Exception Handling (<throw>,
<faultHandler>, <catch>, <catchAII>) 314 Compensate Shape and Compensation Block (<compensate>,
<compensationHandler>) 315 Correlation (<correlations>, <correlationSets>) 316
Other BizTalk-Specific Features 316 Integration with other BizTalk Servers 316
Integration with Web Services 317 Integration with the .NET Framework 317
Human Workflow Services (HWS) 317 Business Activity Monitoring (BAM) 318 Health and Activity Tracking (HAT) 318 BizTalk Server 2006 and Beyond 318
Summary 319 Appendix A: BPEL Syntax Reference 321
Important BPEL Activities and Elements 321
<assign>, <copy>, <from>, <to> 321
<catch>, <catchAII> 322
<compensate> 323
<compensationHandler> 324
<correlations>, <correlation> 325
<correlationSets>, <correlationSet> 325
<empty> 325
<eventHandlers> 326
<faultHandlers>, <faultHandler> 326
<flow> 327
<invoke> 328
<links>, <link> 329
<onAlarm> 329
<onMessage> 330
<partnerLinks>, <partnerLink> 330
<partneii_inkType>, <role> 330
<partners> 331
<pick> 331
<process> 332
<property> 333
<propertyAlias> 333
<receive> 334
<reply> 334
<scope> 334
<sequence> 335
<source> 335
<switch>, <case> 336
<target> 337
<terminate> 337
<throw> 337
<variables>, <variable> 338
<wait> 338
<while> 338 BPEL Functions 339
getLinkStatusO 339 getVariableData() 340 getVariablePropertyO 340 Deadline and Duration Expressions 340
Standard Elements 341 Standard Attributes 341 Default Values of Attributes 342
Standard Faults 342 Namespaces 343
Index 345