You are previewing Service Oriented Java Business Integration: Enterprise Service Bus integration solutions for Java developers.
O'Reilly logo
Service Oriented Java Business Integration: Enterprise Service Bus integration solutions for Java developers

Book Description

In Detail The goal of Java Business Integration (JBI) is to allow components and services to be integrated in a vendor-independent way, allowing users and vendors to plug and play. Java Business Integration (JBI) is a specification aiming to define a Service Provider Interface for integration containers so that integration components written for these containers are portable across containers and also integrate with other components or services using standard protocols and formats. JBI is based on JSR 208, which is an extension of Java 2 Enterprise Edition (J2EE). This book first discusses the various integration approaches available and introduces the Enterprise Service Bus (ESB), a new architectural pattern that facilitates integrating services. ESB provides mediation services including routing and transformation. Java Business Integration (JBI) provides a collaboration framework that provides standard interfaces for integration components and protocols to plug into, thus allowing the assembly of Service-Oriented Integration (SOI) frameworks following the ESB pattern. Once JBI and ESB are introduced, we look at how we have been doing service integration without either of these using traditional J2EE. The book then slowly introduces ESB and, with the help of code, showcases how easily things can be done using JBI. What you will learn from this book?

  • Assembling services and porting them across containers using JBI

  • Exposing EJB as a WSDL-compliant service across firewalls

  • Binding remote services to ESB to be consumed internally

  • Exposing local components in ESB like POJO as externally accessible WSDL-compliant services

  • Providing a web service gateway for external consumers

  • Accessing web services over a reliable transport channel like JMS

  • Implementing web service versioning using ESB

  • Implementing service aggregation at ESB

  • Transactions, Security, Clustering, and JMX in ESB

Approach The book covers all concepts with examples that can be built, deployed, and run by readers using the Apache Ant tool in Apache ServiceMix, which is an open-source Enterprise Service Bus that combines the functionality of a Service Oriented Architecture (SOA) and an Event Driven Architecture (EDA). The aim of this book is to prepare an architect or developer for building integration solutions using ESB. To that end, this book takes a practical approach, emphasizing how to get things done in ServiceMix with code. When needed, it delves into the theoretical aspects of ESB, and such discussions are supplemented with working samples. The book, thus, distils some of the knowledge that has emerged over the last decade in the realm of Java Integration. Who this book is written for? This book is aimed at Java developers and integration architects who want to become proficient with the Java Business Integration (JBI) standard. Readers should have some experience with Java and have developed and deployed applications in the past, but need no previous knowledge of JBI. The book can also be useful to anyone who is struggling to understand ESB and how it differs from other architectures and to understand its position in SOA. This book primarily targets IT professionals in the field of SOA and Integration solutions--in other words, intermediate to advanced users. You are likely to find the book useful if you fall into any of the following categories:
  • A programmer, designer, or architect in Java who wants to learn and code in JBI or ESB.

  • A programmer, designer, or architect who doesn't normally code in Java can still benefit from this book, since we 'assemble integration components' using XML with little to no Java code.

  • An IT Manager or an Officer who knows well about SOA or SOI but want to see something in code (you can adorn your flashy presentations with some live code too).

Table of Contents

  1. Service Oriented Java Business Integration
  2. Credits
  3. About the Author
  4. Acknowledgement
  5. About the Reviewers
  6. Preface
    1. What This Book Covers
    2. What You Need for This Book
    3. Who is This Book for
    4. Conventions
    5. Reader Feedback
    6. Customer Support
      1. Downloading the Example Code for the Book
      2. Errata
      3. Questions
  7. 1. Why Enterprise Service Bus
    1. Boundary-Less Organization
      1. Multiple Systems
      2. No Canonical Data Format
      3. Autonomous, but Federated
      4. Intranet versus Internet
      5. Trading Partners
    2. Integration
      1. Enterprise Application Integration
    3. Integration Architectures
      1. Point-to-Point Solution
      2. Hub-and-Spoke Solution
      3. Enterprise Message Bus Integration
      4. Enterprise Service Bus Integration
    4. Enterprise Service Bus versus Message Bus
      1. Similarities and Differences
      2. Maturity and Industry Adoption
    5. Making the Business Case for ESB
      1. How many Channels
      2. Volatile Interfaces
      3. New Systems Introducing Data Redundancy
      4. Service Reuse
      5. System Management and Monitoring
    6. Enterprise Service Bus
      1. Service in ESB
      2. Abstraction beyond Interface
      3. Service Aggregation
      4. Service Enablement
      5. Service Consolidation
      6. Service Sharing
      7. Linked Services
      8. Virtualization of Services
      9. Services Fabric
    7. Summary
  8. 2. Java Business Integration
    1. SOA—The Motto
      1. Why We Need SOA
      2. What is SOA
      3. SOA and Web Services
        1. WSDL
        2. SOAP
      4. Service Oriented Integration (SOI)
    2. JBI in J2EE—How they Relate
      1. Servlets, Portlets, EJB, JCA, and so on
      2. JBI and JCA—Competing or Complementing
      3. JBI—a New Standard
    3. JBI in Detail
      1. JSR 208
      2. JBI Nomenclature
    4. Provider—Consumer Contract
      1. Detached Message Exchange
      2. Provider—Consumer Role
      3. Message Exchange
      4. Service Invocation
    5. Message Exchange Patterns (MEP)
      1. In-Only MEP
      2. Robust In-Only MEP
      3. In-Out MEP
      4. In-Optional-Out MEP
    6. ESB—Will it Solve all Our Pain Points
    7. Summary
  9. 3. JBI Container—ServiceMix
    1. ServiceMix—Under the Hood
      1. Salient Features
    2. ServiceMix Architecture
      1. Architecture Diagram
      2. Normalized Message Router Flows
    3. Other ESBs
      1. Mule
      2. Celtix
      3. Iona Artix
      4. PEtALS
      5. ChainBuilder
    4. Installing ServiceMix
      1. Hardware Requirements
      2. OS Requirements
      3. Run-time Environment
      4. Installing ServiceMix in Windows
      5. Installing ServiceMix in Unix
      6. Configuring ServiceMix
      7. Starting ServiceMix
      8. Stopping ServiceMix
      9. Resolving classpath Issues
    5. ServiceMix Components—a Synopsis
      1. Standard JBI Components
      2. Lightweight JBI Components
    6. Your First JBI Sample—Binding an External HTTP Service
      1. Servlet-based HTTP Service
      2. Configure the HTTP Service in ServiceMix
      3. Run ServiceMix Basic JBI Container
      4. Run a Client against ServiceMix
      5. What Just Happened in ServiceMix
      6. Spring XML Configuration for ServiceMix
    7. Summary
  10. 4. Binding— The Conventional Way
    1. Binding—What it Means
      1. Binding
      2. Endpoints
    2. Apache SOAP Binding
      1. A Word about Apache SOAP
      2. Apache SOAP Format and Transports
      3. RPC and Message Oriented
      4. Binding Services
    3. Sample Bind a Stateless EJB Service to Apache SOAP
      1. Sample Scenario
      2. Code Listing
      3. Running the Sample
        1. Deploying the EJB
        2. Bind EJB to SOAP
        3. Run the Client
      4. What Just Happened
      5. How the Sample Relates to ServiceMix
    4. Summary
  11. 5. Some XFire Binding Tools
    1. Binding in XFire
      1. XFire Transports
      2. JSR181 and XFire
    2. Web Service Using XFireConfigurableServlet
      1. Sample Scenario
      2. Code Listing
      3. Running the Sample
    3. Web Service using XFire Spring XFireExporter
      1. Sample Scenario
      2. Code Listing
      3. Running the Sample
    4. Web Service Using XFire Spring Jsr181 Handler
      1. Sample Scenario
      2. Code Listing
      3. Running the Sample
    5. XFire Export and Bind EJB
      1. Sample Scenario
      2. Code Listing
      3. Running the Sample
    6. XFire for Lightweight Integration
    7. Summary
  12. 6. JBI Packaging and Deployment
    1. Packaging in ServiceMix
      1. Installation Packaging
      2. Service Assembly Packaging
      3. Service Unit Packaging
    2. Deployment in ServiceMix
      1. Standard and JBI compliant
      2. Lightweight
    3. Packaging and Deployment Sample
      1. Phase One—Component Development
      2. Phase Two—Component Packaging
    4. Running the Packaging and Deployment Sample
    5. Summary
  13. 7. Developing JBI Components
    1. Need for Custom JBI Components
    2. ServiceMix Component Helper Classes
      1. MessageExchangeListener
      2. TransformComponentSupport
    3. Create, Deploy, and Run JBI Component
      1. Code HttpInterceptor Component
      2. Configure HttpInterceptor Component
      3. Package HttpInterceptor Component
      4. Deploy HttpInterceptor Component
      5. Build and Run the Sample
    4. Summary
  14. 8. Binding EJB in a JBI Container
    1. Component versus Services
      1. Coexisting EJB Components with Services
      2. Indiscrimination at Consumer Perspective
    2. Binding EJB Sample
      1. Step One—Define and Deploy the EJB Service
      2. Step Two—Bind EJB to ServiceMix
      3. Step Three—Deploy and Invoke EJB Binding in ServiceMix
      4. Step Four—Access WSDL and Generate Axis-based Stubs to Access EJB Outside Firewall
    3. Reconciling EJB Resources
    4. Summary
  15. 9. POJO Binding Using JSR181
    1. POJO
      1. What are POJOs
      2. Comparing POJO with other Components
    2. ServiceMix servicemix-jsr181
      1. JSR 181
      2. servicemix-jsr181
      3. servicemix-jsr181 Deployment
      4. servicemix-jsr181 Endpoint
    3. POJO Binding Sample
      1. Sample Use Case
      2. POJO Code Listing
      3. XBean-based POJO Binding
      4. Deployment Configuration
      5. Deploying and Running the Sample
      6. Access WSDL and Generate Axis-based Stubs to Access POJO Remotely
    4. Accessing JBI Bus Sample
      1. Sample Use Case for Accessing JBI Bus
      2. Sample Code Listing
      3. Build, Deploy, and Run the Sample
    5. Summary
  16. 10. Bind Web Services in ESB—Web Services Gateway
    1. Web Services
      1. Binding Web Services
      2. Why Another Indirection?
    2. HTTP
    3. ServiceMix's servicemix-http
      1. servicemix-http in Detail
      2. Consumer and Provider Roles
      3. servicemix-http XBean Configuration
      4. servicemix-http Lightweight Configuration
    4. Web Service Binding Sample
      1. Sample Use Case
      2. Deploy the Web Service
      3. XBean-based servicemix-http Binding
      4. Deploying and Running the Sample
      5. Access WSDL and Generate Axis Stubs to Access the Web Service Remotely
    5. Summary
  17. 11. Access Web Services Using the JMS Channel
    1. JMS
    2. Web Service and JMS
      1. Specifications for Web Service Reliable Messaging
      2. SOAP over HTTP versus SOAP over JMS
    3. JMS in ServiceMix
      1. Servicemix-jms
      2. Consumer and Provider Roles
      3. servicemix-jms XBean Configuration
      4. servicemix-jms Lightweight Configuration
    4. Protocol Bridge
    5. Web Service in the JMS Channel Binding Sample
      1. ServiceMix Component Architecture for the JMS Web Service
      2. Deploy the Web Service
      3. XBean-based servicemix-jms Binding
      4. XBean-based servicemix-eip Pipeline Bridge
      5. XBean-based servicemix-http Provider Destination
      6. Deploying the Sample and Starting ServiceMix
      7. Test Web Service Using JMS Channel
    6. Summary
  18. 12. Java XML Binding using XStream
    1. Java XML Binding
      1. JAXB
      2. XStream
      3. ServiceMix and XStream
    2. XStream in a Normalized Message Router Sample
      1. Sample Use Case
      2. Code HTTPClient
      3. Unmarshalling to Transfer Objects
      4. HttpInterceptor Component
      5. XStreamInspector Component
      6. Configure Interceptor and Inspector Components
      7. Package Interceptor and Inspector Components
      8. Deploy Interceptor and Inspector Components
      9. Build and Run the Sample
    3. Summary
  19. 13. JBI Proxy
    1. Proxy—A Primer
      1. Proxy Design Pattern
      2. JDK Proxy Class
      3. Sample JDK Proxy Class
    2. ServiceMix JBI Proxy
    3. JBI Proxy Sample Implementing Compatible Interface
      1. Proxy Code Listing
      2. XBean-based JBI Proxy Binding
      3. Deployment Configuration
      4. Deploying and Running the Sample
    4. JBI Proxy Sample implementing In-Compatible interface
      1. Proxy Code Listing
      2. XBean-based JBI Proxy Binding
      3. Deployment Configuration
      4. Deploying and Running the Sample
    5. Invoke External Web Service from the ServiceMix Sample
      1. Web Service Code Listing
      2. Axis Generated Client Stubs
      3. XBean-based JBI Proxy Binding
      4. Deployment Configuration
      5. Deploying and Running the Sample
      6. Proxy and WSDL Generation
    6. Summary
  20. 14. Web Service Versioning
    1. Service Versioning—A Means to SOA
      1. Services are Autonomous
      2. Change is the Only Constant Thing
      3. All Purpose Interfaces
      4. SOA Versioning—Don't Touch the Anti-Pattern
      5. Types can Inherit—Why not My Schemas
      6. If Not Versions, Then What
    2. Strategy to Version Web Service
      1. Which Level to Version
      2. Version Control in a Schema
      3. targetNamespace for WSDL
      4. Version Parameter
    3. Web Service Versioning Approaches
      1. Covenant
      2. Multiple Endpoint Addresses
    4. Web Service Versioning Sample using ESB
      1. Sample Use Case
      2. Configure Components in ESB
      3. Deploy and Run the Sample
    5. Web Service Versioning Operational Perspective
    6. Summary
  21. 15. Enterprise Integration Patterns in ESB
    1. Enterprise Integration Patterns
      1. What are EAI Patterns?
      2. EAI Patterns Book and Site
    2. ServiceMix EAI Patterns
      1. Why ServiceMix for EAI Patterns?
      2. ServiceMix EAI Patterns Configuration
    3. EAI Patterns—Code and Run Samples in ESB
      1. Content-based Router
        1. Notation
        2. Explanation
        3. Illustrative Design
        4. Sample Use Case
        5. Sample Code and Configuration
        6. Deploy and Run the Sample
      2. Content Enricher
        1. Notation
        2. Explanation
        3. Illustrative Design
        4. Sample Use Case
        5. Sample code and configuration
        6. Deploy and Run the Sample
      3. XPath Splitter
        1. Notation
        2. Explanation
        3. Illustrative Design
        4. Sample Use Case
        5. Sample Code and Configuration
        6. Deploy and Run the Sample
      4. Static Recipient List
        1. Notation
        2. Explanation
        3. Illustrative Design
        4. Sample Use Case
        5. Sample Code and Configuration
        6. Deploy and Run the Sample
      5. Wiretap
        1. Notation
        2. Explanation
        3. Illustrative Design
        4. Sample Use Case
        5. Sample Code and Configuration
        6. Deploy and Run the Sample
      6. Message Filter
        1. Notation
        2. Explanation
        3. Illustrative Design
        4. Sample Use Case
        5. Sample Code and Configuration
        6. Deploy and Run the Sample
      7. Split Aggregator
        1. Notation
        2. Explanation
        3. Illustrative Design
        4. Sample Use Case
        5. Sample Code and Configuration
        6. Deploy and Run the Sample
      8. Pipeline
        1. Notation
        2. Explanation
        3. Illustrative Design
        4. Sample Use Case
        5. Sample Code and Configuration
        6. Deploy and Run the Sample
      9. Static Routing Slip
        1. Notation
        2. Explanation
        3. Illustrative Design
        4. Sample Use Case
        5. Sample Code and Configuration
        6. Deploy and Run the Sample
    4. Summary
  22. 16. Sample Service Aggregation
    1. Provision Service Order—Business Integration Sample
      1. Solution Architecture
      2. JBI-based ESB Component Architecture
      3. Understanding the Message Exchange
      4. Deploying and Running the Sample
    2. Summary
  23. 17. Transactions, Security, Clustering, and JMX
    1. Cross Cutting Concerns—Support Inside ServiceMix
      1. Transactions
      2. Security
      3. Clustering
      4. JMX
    2. Sample Demonstrating Transaction
      1. Sample Use Case
      2. Configure Transaction in ServiceMix
      3. Deploy and Run the Sample
    3. Sample demonstrating Security
      1. Sample Use Case
      2. Configure Basic Authorization in servicemix-http
      3. Deploy and Run the Sample
    4. Sample Demonstrating Clustering
      1. Sample Use Case
      2. Configure ServiceMix Cluster
      3. Deploy and run the sample
    5. Sample demonstrating JMX
      1. Enable JMX in ServiceMix Application
      2. Initialize JMX Console—MC4J
      3. Retrieve WSDL through JMX
    6. Summary