Rajesh is also Sun Certified Java Enterprise Architect and BEA
Certified Weblogic Administrator.
Rajesh is currently working with Emirates Airlines IT Division based in Dubai and
his work is mainly in Consulting, Application Framework development, Technology
Evaluations and SOA related topics.
All my thanks goes to my wife Saritha for supporting me and loving
me even though I booked a lot of personal time to review this book.
Rajesh Warrier, currently working as one of the lead system architects in Emirates
Group IT, has around 10 years experience in the industry working with companies
like Sun Microsystems. He has been responsible for architecting and designing
many mission critical enterprise applications using cutting edge technologies. He is
currently working as an architect and mentor for the new generation cargo system
for the emirates airlines, developed completely using JEE.
Table of Contents
Preface 1
Chapter 1: Why Enterprise Service Bus 7
Boundary-Less Organization 8
Multiple Systems 8
No Canonical Data Format 8
Autonomous, but Federated 9
Intranet versus Internet 10
Trading Partners 10
Integration 11
Enterprise Application Integration 12
Integration Architectures 12
Point-to-Point Solution 13
Hub-and-Spoke Solution 13
Enterprise Message Bus Integration 15
Enterprise Service Bus Integration 16
Enterprise Service Bus versus Message Bus 17
Similarities and Differences 17
Maturity and Industry Adoption 19
Making the Business Case for ESB 20
How many Channels 20
Volatile Interfaces 22
New Systems Introducing Data Redundancy 22
Service Reuse 23
System Management and Monitoring 23
Enterprise Service Bus 23
Service in ESB 23
Abstraction beyond Interface 24
Service Aggregation 25
Service Enablement 26
Service Consolidation 26
Table of Contents
[ ii ]
Service Sharing 27
Linked Services 28
Virtualization of Services 29
Services Fabric 30
Summary 30
Chapter 2: Java Business Integration 31
SOA??”the Motto 31
Why We Need SOA 32
What is SOA? 32
SOA and Web Services 33
Service Oriented Integration (SOI) 36
JBI in J2EE??”How they Relate 36
Servlets, Portlets, EJB, JCA, and so on 37
JBI and JCA??”Competing or Complementing 37
JBI??”a New Standard 38
JBI in Detail 39
JSR 208 39
JBI Nomenclature 40
Provider??”Consumer Contract 42
Detached Message Exchange 44
Provider??”Consumer Role 45
Message Exchange 47
Service Invocation 47
Message Exchange Patterns (MEP) 47
In-Only MEP 48
Robust In-Only MEP 48
In-Out MEP 50
In-Optional-Out MEP 52
ESB??”Will it Solve all Our Pain Points 55
Summary 56
Chapter 3: JBI Container??”ServiceMix 57
ServiceMix??”Under the Hood 58
Salient Features 58
ServiceMix Architecture 58
Architecture Diagram 58
Normalized Message Router Flows 59
Other ESBs 63
Mule 63
Celtix 63
Iona Artix 64
Table of Contents
[ iii ]
PEtALS 64
ChainBuilder 64
Installing ServiceMix 65
Hardware Requirements 65
OS Requirements 65
Run-time Environment 65
Installing ServiceMix in Windows 66
Installing ServiceMix in Unix 67
Configuring ServiceMix 67
Starting ServiceMix 67
Stopping ServiceMix 67
Resolving classpath Issues 67
ServiceMix Components??”a Synopsis 68
Standard JBI Components 68
Lightweight JBI Components 69
Your First JBI Sample??”Binding an External HTTP Service 70
Servlet-based HTTP Service 71
Configure the HTTP Service in ServiceMix 74
Run ServiceMix Basic JBI Container 76
Run a Client against ServiceMix 78
What Just Happened in ServiceMix 78
Spring XML Configuration for ServiceMix 79
Summary 81
Chapter 4: Binding??”The Conventional Way 83
Binding??”What it Means 83
Binding 84
Endpoints 84
Apache SOAP Binding 84
A Word about Apache SOAP 85
Apache SOAP Format and Transports 85
RPC and Message Oriented 86
Binding Services 86
Sample Bind a Stateless EJB Service to Apache SOAP 88
Sample Scenario 88
Code Listing 89
Running the Sample 91
Deploying the EJB 91
Bind EJB to SOAP 92
Run the Client 93
What Just Happened 94
How the Sample Relates to ServiceMix 96
Table of Contents
[ iv ]
Summary 97
Chapter 5: Some XFire Binding Tools 99
Binding in XFire 100
XFire Transports 100
JSR181 and XFire 101
Web Service Using XFireConfigurableServlet 101
Sample Scenario 101
Code Listing 102
Running the Sample 104
Web Service using XFire Spring XFireExporter 106
Sample Scenario 106
Code Listing 106
Running the Sample 109
Web Service Using XFire Spring Jsr181 Handler 109
Sample Scenario 109
Code Listing 110
Running the Sample 113
XFire Export and Bind EJB 113
Sample Scenario 114
Code Listing 115
Running the Sample 119
XFire for Lightweight Integration 120
Summary 121
Chapter 6: JBI Packaging and Deployment 123
Packaging in ServiceMix 124
Installation Packaging 124
Service Assembly Packaging 125
Service Unit Packaging 126
Deployment in ServiceMix 126
Standard and JBI compliant 126
Lightweight 127
Packaging and Deployment Sample 127
Phase One??”Component Development 128
Phase Two??”Component Packaging 129
Running the Packaging and Deployment Sample 132
Summary 134
Chapter 7: Developing JBI Components 135
Need for Custom JBI Components 135
ServiceMix Component Helper Classes 136
MessageExchangeListener 137
Table of Contents
[ v ]
TransformComponentSupport 137
Create, Deploy, and Run JBI Component 140
Code HttpInterceptor Component 140
Configure HttpInterceptor Component 141
Package HttpInterceptor Component 142
Deploy HttpInterceptor Component 143
Build and Run the Sample 144
Summary 145
Chapter 8: Binding EJB in a JBI Container 147
Component versus Services 147
Coexisting EJB Components with Services 148
Indiscrimination at Consumer Perspective 148
Binding EJB Sample 149
Step One??”Define and Deploy the EJB Service 149
Step Two??”Bind EJB to ServiceMix 150
Step Three??”Deploy and Invoke EJB Binding in ServiceMix 155
Step Four??”Access WSDL and Generate Axis-based
Stubs to Access EJB Outside Firewall 156
Reconciling EJB Resources 160
Summary 160
Chapter 9: POJO Binding Using JSR181 161
POJO 161
What are POJOs 161
Comparing POJO with other Components 162
ServiceMix servicemix-jsr181 162
JSR 181 162
servicemix-jsr181 162
servicemix-jsr181 Deployment 163
servicemix-jsr181 Endpoint 164
POJO Binding Sample 164
Sample Use Case 164
POJO Code Listing 166
XBean-based POJO Binding 166
Deployment Configuration 167
Deploying and Running the Sample 169
Access WSDL and Generate Axis-based Stubs to
Access POJO Remotely 169
Accessing JBI Bus Sample 173
Sample Use Case for Accessing JBI Bus 175
Sample Code Listing 177
Table of Contents
[ vi ]
Build, Deploy, and Run the Sample 179
Summary 179
Chapter 10: Bind Web Services in
ESB??”Web Services Gateway 181
Web Services 181
Binding Web Services 182
Why Another Indirection? 182
HTTP 182
ServiceMix's servicemix-http 183
servicemix-http in Detail 183
Consumer and Provider Roles 184
servicemix-http XBean Configuration 185
servicemix-http Lightweight Configuration 188
Web Service Binding Sample 189
Sample Use Case 189
Deploy the Web Service 190
XBean-based servicemix-http Binding 193
Deploying and Running the Sample 193
Access WSDL and Generate Axis Stubs to Access the Web Service
Remotely 194
Summary 198
Chapter 11: Access Web Services Using the JMS Channel 199
JMS 199
Web Service and JMS 200
Specifications for Web Service Reliable Messaging 200
SOAP over HTTP versus SOAP over JMS 201
JMS in ServiceMix 203
Servicemix-jms 203
Consumer and Provider Roles 204
servicemix-jms XBean Configuration 204
servicemix-jms Lightweight Configuration 206
Protocol Bridge 207
Web Service in the JMS Channel Binding Sample 208
ServiceMix Component Architecture for the JMS Web Service 209
Deploy the Web Service 210
XBean-based servicemix-jms Binding 211
XBean-based servicemix-eip Pipeline Bridge 212
XBean-based servicemix-http Provider Destination 212
Deploying the Sample and Starting ServiceMix 213
Test Web Service Using JMS Channel 214
Table of Contents
[ vii ]
Summary 219
Chapter 12: Java XML Binding using XStream 221
Java XML Binding 222
JAXB 223
XStream 223
ServiceMix and XStream 225
XStream in a Normalized Message Router Sample 226
Sample Use Case 226
Code HTTPClient 228
Unmarshalling to Transfer Objects 228
HttpInterceptor Component 230
XStreamInspector Component 232
Configure Interceptor and Inspector Components 232
Package Interceptor and Inspector Components 234
Deploy Interceptor and Inspector Components 234
Build and Run the Sample 235
Summary 236
Chapter 13: JBI Proxy 237
Proxy??”A Primer 238
Proxy Design Pattern 238
JDK Proxy Class 239
Sample JDK Proxy Class 240
ServiceMix JBI Proxy 243
JBI Proxy Sample Implementing Compatible Interface 244
Proxy Code Listing 245
XBean-based JBI Proxy Binding 246
Deployment Configuration 247
Deploying and Running the Sample 247
JBI Proxy Sample implementing In-Compatible interface 248
Proxy Code Listing 248
XBean-based JBI Proxy Binding 250
Deployment Configuration 251
Deploying and Running the Sample 251
Invoke External Web Service from the ServiceMix Sample 252
Web Service Code Listing 252
Axis Generated Client Stubs 253
XBean-based JBI Proxy Binding 256
Deployment Configuration 258
Deploying and Running the Sample 258
Proxy and WSDL Generation 259
Table of Contents
[ viii ]
Summary 260
Chapter 14: Web Service Versioning 261
Service Versioning??”A Means to SOA 261
Services are Autonomous 262
Change is the Only Constant Thing 262
All Purpose Interfaces 262
SOA Versioning??”Don't Touch the Anti-Pattern 263
Types can Inherit??”Why not My Schemas 265
If Not Versions, Then What 265
Strategy to Version Web Service 265
Which Level to Version 266
Version Control in a Schema 266
targetNamespace for WSDL 267
Version Parameter 267
Web Service Versioning Approaches 268
Covenant 268
Multiple Endpoint Addresses 269
Web Service Versioning Sample using ESB 270
Sample Use Case 270
Configure Components in ESB 274
Deploy and Run the Sample 285
Web Service Versioning Operational Perspective 287
Summary 287
Chapter 15: Enterprise Integration Patterns in ESB 289
Enterprise Integration Patterns 289
What are EAI Patterns? 290
EAI Patterns Book and Site 290
ServiceMix EAI Patterns 291
Why ServiceMix for EAI Patterns? 291
ServiceMix EAI Patterns Configuration 293
EAI Patterns??”Code and Run Samples in ESB 294
Content-based Router 294
Notation 294
Explanation 295
Illustrative Design 295
Sample Use Case 296
Sample Code and Configuration 297
Deploy and Run the Sample 301
Content Enricher 303
Notation 303
Explanation 303
Table of Contents
[ ix ]
Illustrative Design 303
Sample Use Case 304
Sample code and configuration 305
Deploy and Run the Sample 307
XPath Splitter 308
Notation 309
Explanation 309
Illustrative Design 309
Sample Use Case 310
Sample Code and Configuration 311
Deploy and Run the Sample 312
Static Recipient List 313
Notation 314
Explanation 314
Illustrative Design 314
Sample Use Case 315
Sample Code and Configuration 316
Deploy and Run the Sample 318
Wiretap 319
Notation 319
Explanation 320
Illustrative Design 320
Sample Use Case 320
Sample Code and Configuration 321
Deploy and Run the Sample 323
Message Filter 323
Notation 324
Explanation 324
Illustrative Design 324
Sample Use Case 325
Sample Code and Configuration 326
Deploy and Run the Sample 328
Split Aggregator 329
Notation 329
Explanation 329
Illustrative Design 330
Sample Use Case 330
Sample Code and Configuration 331
Deploy and Run the Sample 332
Pipeline 334
Notation 334
Explanation 335
Illustrative Design 335
Sample Use Case 336
Sample Code and Configuration 337
Deploy and Run the Sample 339
Static Routing Slip 339
Notation 340
Table of Contents
[ x ]
Explanation 340
Illustrative Design 340
Sample Use Case 341
Sample Code and Configuration 342
Deploy and Run the Sample 344
Summary 345
Chapter 16: Sample Service Aggregation 347
Provision Service Order??”Business Integration Sample 347
Solution Architecture 348
JBI-based ESB Component Architecture 350
Understanding the Message Exchange 351
Deploying and Running the Sample 365
Summary 366
Chapter 17: Transactions, Security, Clustering, and JMX 367
Cross Cutting Concerns??”Support Inside ServiceMix 368
Transactions 368
Security 371
Clustering 373
JMX 377
Sample Demonstrating Transaction 377
Sample Use Case 378
Configure Transaction in ServiceMix 379
Deploy and Run the Sample 382
Sample demonstrating Security 383
Sample Use Case 384
Configure Basic Authorization in servicemix-http 384
Deploy and Run the Sample 387
Sample Demonstrating Clustering 388
Sample Use Case 389
Configure ServiceMix Cluster 391
Deploy and run the sample 395
Sample demonstrating JMX 397
Enable JMX in ServiceMix Application 397
Initialize JMX Console??”MC4J 398
Retrieve WSDL through JMX 400
Summary 402
Index 403
Preface
You're all in the business of software development.
Pages:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25