Java SOA Cookbook

Book description

Java SOA Cookbook offers practical solutions and advice to programmers charged with implementing a service-oriented architecture (SOA) in their organization. Instead of providing another conceptual, high-level view of SOA, this cookbook shows you how to make SOA work. It's full of Java and XML code you can insert directly into your applications and recipes you can apply right away.

The book focuses primarily on the use of free and open source Java Web Services technologies -- including Java SE 6 and Java EE 5 tools -- but you'll find tips for using commercially available tools as well.

Java SOA Cookbook will help you:

  • Construct XML vocabularies and data models appropriate to SOA applications
  • Build real-world web services using the latest Java standards, including JAX-WS 2.1 and JAX-RS 1.0 for RESTful web services
  • Integrate applications from popular service providers using SOAP, POX, and Atom
  • Create service orchestrations with complete coverage of the WS-BPEL (Business Process Execution Language) 2.0 standard
  • Improve the reliability of SOAP-based services with specifications such as WS-Reliable Messaging
  • Deal with governance, interoperability, and quality-of-service issues

The recipes in Java SOA Cookbook will equip you with the knowledge you need to approach SOA as an integration challenge, not an obstacle.

Table of contents

  1. A Note Regarding Supplemental Files
  2. Preface
    1. Overview
    2. Intended Audience
    3. What This Book Covers
    4. How to Read This Book
    5. Using Code Examples
    6. Hang in There!
    7. Conventions Used in This Book
    8. Safari® Books Online
    9. How to Contact Us
    10. Dedication
    11. Acknowledgments
  3. I. SOA Fundamentals
    1. 1. Introduction to SOA
      1. Introduction
      2. Defining a Service
      3. Defining SOA
      4. Identifying Service Candidates
      5. Identifying Different Kinds of Services
      6. Modeling Services
      7. Making a Service Composable
      8. Supporting Your SOA Efforts
      9. Selecting a Pilot Project
      10. Establishing Governance
      11. Summary
    2. 2. XML Schema and the SOA Data Model
      1. Introduction
      2. Designing Schema for SOA
      3. Creating Canonical Data Model
      4. Using Chameleon Namespace Design
      5. Versioning Schemas
      6. Reference Schemas
      7. Common Schema Types
      8. Validating an XML Document Against a Schema
      9. Validating an XML Document Against Multiple Schemas
      10. Restricting Schema Types with Regular Expressions
      11. Using Schema Enumerations
      12. Generating Java Classes from Schema
      13. Generating a Schema from Java
      14. Generating Java Source Files from XML Schema in Ant
      15. Generating an XML Document Instance from a Schema
      16. Customizing How a Java Class Is Generated from Schema
      17. Validating Against a Schema During Marshaling and Unmarshaling
      18. Collecting Schema Validation Events During Marshaling and Unmarshaling
      19. Summary
    3. 3. Working with XML and Java
      1. Introduction
      2. Reading an XML Data Stream
      3. Writing XML Data Streams
      4. Filtering Data in an XML Stream
      5. Selecting Values from an XML Document
      6. Updating a Value in an XML Document
      7. Converting a Java Object into an XML Document Instance
      8. Converting an XML Document Instance into a Java Object
      9. Generating a Schema from an XML Document
      10. Converting XML to Java Without JAXB
      11. Customizing Code Generation in JAXB
      12. Finding the JAR That Contains a Given Class on Linux
      13. Transparently Substituting XML Files
      14. Summary
  4. II. Web Services
    1. 4. Getting Started
      1. Introduction
      2. Using Publicly Available Web Services to Test Against
      3. Installing Metro
      4. Installing Oracle WebLogic
      5. Creating and Deploying the Simplest Web Service
      6. Creating and Deploying a Service to WebLogic
      7. Setting Up a Maven 2 Service and Client Project
      8. Understanding WSDL
      9. Using References in NetBeans to Generate Web Service Clients
      10. Monitoring SOAP Traffic with Metro
      11. Monitoring SOAP Traffic with TCPMon
    2. 5. Web Services with SAAJ
      1. Introduction
      2. Creating a SOAP Element with a Qualified Name
      3. Creating a Complete SOAP Message
      4. Writing a SOAP Response to an Output Stream
      5. Creating a Web Service Client Based on an Existing SOAP Envelope
      6. Extracting Content from a SOAP Message
      7. Creating a Web Service Client Using Raw XML Source and DOM
      8. Adding a MIME Header
      9. Adding Namespace Declarations
      10. Specifying SOAPAction
      11. Adding an Attribute to an Element
      12. Removing a Header from a SOAP Message
      13. Adding Headers to a SOAP Request
      14. Accessing All SOAP Header Elements
      15. Adding an Attachment to an Outbound SOAP Message
      16. Accessing Inbound Attachment Data
      17. Connecting to a SAAJ Endpoint Without a WSDL
      18. Working with SOAP Actors
      19. Asynchronous Invocation with Dispatch
      20. Validating Your Payload Against a Schema on the Client
      21. Providing a Web Service with SAAJ
      22. Sending and Receiving SOAP Faults
      23. Summary
    3. 6. Creating Web Service Applications with JAX-WS
      1. Introduction
      2. Calling a Web Service from the Command Line
      3. Using JAX-WS Annotation Name Properties
      4. Invoking the Simplest Web Service
      5. Creating a Client Proxy
      6. Consuming a Web Service from a Servlet or EJB
      7. Consuming a Web Service from a JSP
      8. Using a JAXB-Annotated Instance in a SOAP Message
      9. Using wsimport in a Maven Project
      10. Dealing with Version Errors in wsgen and wsimport
      11. Adding Headers to a SOAP Request
      12. Intercepting the Request to Perform Protocol-Specific Work
      13. Intercepting the Request to Perform Work on Your Payload
      14. Sharing Data Between Handler Invocations
      15. Passing Binary Data in a Request
      16. Using Binary Data in a SOAP Message
      17. Enabling Binary Optimization on the Client
      18. Validating a SOAP Payload Against a Schema with Metro
      19. Making Asynchronous Calls with a JAX-WS Client
      20. Overriding the Endpoint Address in an SEI
      21. Summary
    4. 7. Providing SOAP-Based Web Services
      1. Introduction
      2. Assembling a Service for Deployment
      3. Determining a Service Development Model
      4. Choosing Encoding, Use, and Parameter Styles
      5. Generating a WSDL and Portable Artifacts Based on a Java Service Endpoint Implementation
      6. Creating a Basic Web Service
      7. Specifying Namespaces
      8. Creating a Web Service Operation
      9. Specifying a Web Service Message Part
      10. Specifying an Operation Return Value
      11. Defining Zero-Argument Operations
      12. Defining Operations with Void Return Type
      13. Creating a Web Service That Uses Complex Types Based on Custom WSDL and a Custom Schema
      14. Specifying the SOAP Binding Style, Use, and Parameter Style
      15. Configuring Standard Custom Bindings
      16. Excluding a Public Method from a Service
      17. Creating a Service Provider with an XML View
      18. Implementing Server-Side Handler Chains
      19. Providing Stateful Services
      20. Adding a Header with a Method Parameter
      21. Accessing Incoming Header Parameters in a Service
      22. Providing a Value for SOAP Action or WS-Addressing Action
      23. Optimizing Transmission of Binary Content on the Server
      24. Getting and Sharing Data About Users and the Request
      25. Using Header References with Holder<T>
      26. Summary
    5. 8. RESTful Web Services
      1. Introduction
      2. Creating a POX over HTTP Service with Servlets
      3. A RESTful Service with JAX-WS
      4. Creating a Client for a RESTful Service Using Sockets
      5. Application: Using SSL, Atom Publishing, and the Google Finance REST API
      6. Setting Up the Jersey JAX-RS Implementation
      7. Creating a Jersey Project with Eclipse and Tomcat
      8. Creating Hello World with Jersey
      9. Creating a Single Path for Variable Resources of the Same Type
      10. Restricting the Structure of Values in a Path Template
      11. Accessing Query Parameters
      12. Marshaling a Custom Type to XML in a Response
      13. Offering Different Representations of the Same Resource
      14. Creating a Resource
      15. Working with Forms and URIs
      16. Using SAAJ to Access a RESTful Service
      17. Setting Metadata on Representations
      18. Deleting a Resource
      19. Redirecting to Another Service
      20. Accessing HTTP Headers
      21. Working with Cookies
      22. Working with Exceptions and Response Status Codes
      23. Working with WADL
      24. Interacting with a Resource Using a Custom Reader and Writer
      25. Summary
  5. III. Business Processes
    1. 9. Service Orchestrations with BPEL
      1. Introduction
      2. Determining a Process Design Method
      3. Selecting a Business Process Language
      4. Getting Apache ODE BPEL Engine
      5. Deploying a Process to Apache ODE
      6. Understanding BPEL Process Basics
      7. Using a Free Graphical Designer to Create BPEL Processes
      8. Creating a BPEL Process That Invokes a Partner
      9. Deploying a BPEL Process to OpenESB’s BPEL Service Engine
      10. Testing a Deployed BPEL Process
      11. Installing Active Endpoints BPEL Designer
      12. Installing Active Endpoints BPEL Engine
      13. Creating a BPEL Process in Active Endpoints Designer
      14. Deploying a Process to Active Endpoints Server
      15. Using Web Service Partners
      16. Invoking a Partner Service from a BPEL Process
      17. Manipulating Data with BPEL Variables
      18. Using Literals
      19. Concatenating Values
      20. Choosing an Activity to Execute Based on Runtime Conditions
      21. Executing Multiple Activities in a Sequence
      22. Using Logical Divisions to Group Activities
      23. Summary
    2. 10. Advanced Orchestrations with BPEL
      1. Introduction
      2. Executing Activities in Parallel
      3. Synchronizing Activities Executing in Parallel
      4. Doing Nothing
      5. Executing an Activity at a Specific Point in Time
      6. Executing an Activity After a Specific Delay
      7. Selective Event Processing
      8. Handling Faults
      9. Explicitly Throwing a Fault
      10. Stopping a Process
      11. Performing an XSL Transformation on BPEL Message Data
      12. Validating Inbound Message Data
      13. Correlation Sets
      14. Looping
      15. Adding Human Tasks to a Business Process
      16. Invoking a RESTful Web Service from BPEL
      17. Summary
    3. 11. SOA Governance
      1. Introduction
      2. Assigning Roles
      3. Creating a SOA Roadmap
      4. Keeping Track of Your Services
      5. Determining a Data Ownership Scheme for Services
      6. Handling Legacy Programs and Heterogeneity Within Your SOA
      7. Documenting Services
      8. Setting Up a Service Registry
      9. Packaging Related Services
      10. Retiring a Service
      11. Browsing a UDDI Registry
      12. Querying a UDDI Registry Programmatically
      13. Understanding SOA ROI
  6. IV. Interoperability and Quality of Service
    1. 12. Web Service Interoperability
      1. Introduction
      2. Dealing with Arrays
      3. Abstracting Addressing
      4. Using Addressing in a Java Service
      5. Explicitly Enabling Addressing on the Client
      6. Explicitly Disabling Addressing on the Client
      7. Abstracting Addressing in the Transport Layer from WSDL
      8. Addressing Faults
      9. Creating a .NET Web Service Client in Visual Studio
      10. Creating a .NET Web Service Client in C#
      11. Creating a .NET Web Service
      12. Creating a Ruby Client for a Web Service
      13. Creating a Ruby Client for a .NET Service
      14. Conforming to the Basic Profile
      15. Automating Testing for Basic Profile Conformance
      16. Interoperability Best Practices
      17. Using Modular WSDLs
    2. 13. Quality of Service
      1. Introduction
      2. Understanding Reliable Messaging
      3. Configuring a Java Web Service with Reliable Messaging
      4. Configuring a Java Client with Reliable Messaging
      5. Configuring a Java Web Service with Reliable Messaging on WebLogic
      6. Using a WebLogic Reliable Messaging Error Handler
    3. 14. Enterprise Service Bus
      1. Introduction
      2. What Is ESB?
      3. ESB As a Set of Patterns
      4. JBI
      5. Commercial ESBs
      6. Open Source ESBs
      7. Summary
  7. Index
  8. About the Author
  9. Colophon
  10. Copyright

Product information

  • Title: Java SOA Cookbook
  • Author(s): Eben Hewitt
  • Release date: March 2009
  • Publisher(s): O'Reilly Media, Inc.
  • ISBN: 9780596520724