You are previewing Service Oriented Architecture with Java.
O'Reilly logo
Service Oriented Architecture with Java

Book Description

Using SOA and web services to build powerful Java applications

  • Build effective SOA applications with Java Web Services

  • Quick reference guide with best-practice design examples

  • Understand SOA concepts from core with examples

  • Design scalable inter-enterprise communication

In Detail

Service Oriented Architecture provides a way for applications to work together over the Internet. Usually, SOA applications are exposed through web services.

Web services have been around for a while, but complex adoption processes and poor standardization hampered their use at first. However, with the adoption of new, simpler protocols such as REST, and major companies supporting SOA, the time is now right to adopt these standards.

This book will show you how to build SOA, web services-based applications using Java. You will find out when SOA is the best choice for your application, how to design a sound architecture, and then implement your design using Java.

The book covers the important web services protocols: XML-over-HTTP, REST, and SOAP. You will learn how to develop web services at all levels of complexity and for all kinds of business situations.

This book shows how to use SOA and web services to build powerful applications in Java. It teaches the concepts and the implementation with best-practice real-world examples. You will learn to design a sound architecture for successful implementation of any business solution, the different types of architecture, and various tenets of SOA. The book explains the fundamentals and the advantages of using the Service Oriented Architecture in designing your business solution.

Table of Contents

  1. Service Oriented Architecture with Java
  2. Credits
  3. About the Authors
  4. About the Reviewer
  5. Preface
    1. What This Book Covers
    2. Conventions
    3. Reader Feedback
    4. Customer Support
      1. Downloading the Example Code for the Book
      2. Errata
      3. Questions
  6. 1. The Mantra of SOA
    1. Architecture
    2. Application Architecture
      1. Client-Server Architecture
        1. 1-Tier Application
        2. 2-Tier Application
        3. 3-Tier Application
        4. N-Tier application
    3. Enterprise Computing or Architecture
      1. Business
      2. Application
      3. Information
      4. Technical
      5. The Design
      6. Security
      7. Administration
    4. EA for Managers
    5. EA for Developers
      1. Analogy of SOA
        1. Web Services for SOA
        2. 'Orientation' of Web Services
      2. History of SOA
        1. The SOA Bandwagon
      3. Why SOA?
      4. How SOA...
          1. Service
          2. Messaging
          3. Nodes
          4. RPC Style
          5. Message Path
    6. Summary
  7. 2. Web Services and SOA
    1. The SOA Approach
    2. XML — Advantages and Disadvantages
      1. XML Pitfalls
            1. Listing 1 — Stateful Approach
            2. Listing 2 — Stateless Approach
    3. Introduction to Web Services, RESTful Services, and Other Transport with XML
      1. Basic SOA With XML Over HTTP Protocol
        1. Create
        2. Read
        3. Update
        4. Delete
        5. Generic CRUD Action
        6. Non-CRUD Action
        7. Web Service Decoupling
      2. A Basic Java Implementation of POX-over-HTTP
        1. Listing 3 — XML Binding Annotations
        2. Listing 4 — ItemCrudService Server Implementation
        3. Listing 5 — ItemCrudService Client Request
        4. Listing 6 — findAllItems Service Implementation
        5. Listing 7 — ItemList Binding
        6. Listing 8 — findAllItems Service Client Request
      3. REST — Exploiting the HTTP Protocol
        1. Listing 9 — Outcome Binding
        2. Listing 10 — REST CREATE Server Implementation
        3. Listing 11 — REST CREATE Client Request
        4. Listing 12 — servlet Mapping Section in web.xml
        5. Listing 13 — REST READ Service Implementation
      4. SOAP
        1. Listing 14 — JAX-WS Annotations
        2. Listing 15 — JAX-WS Sample Client
    4. RPC and Document Based-WS: How to Communicate, Pros and Cons of the Two Approach
      1. Listing 16 — SOAP XML Request
      2. Listing 17 — SOAP XML Response
      3. RPC / Literal
        1. Listing 18 — SOAP RPC Style
        2. Listing 19 — SOAP RPC Request
        3. Listing 20 — SOAP RPC WSDL
        4. Listing 21 — SOAP RPC XSD
      4. Document / Literal
        1. Listing 22 — SOAP Document style
        2. Listing 23 — Request Wrapper
        3. Listing 24 — Web Service Using the Defined Wrapper
        4. Listing 25 — SOAP Document Client Request
        5. Listing 26 — SOAP Document XML Request
        6. Listing 27 — SOAP Document WSDL
        7. Listing 28 — SOAP Document XSD
      5. Document / Literal Wrapped
        1. Listing 29 — SOAP Document Wrapped Style
        2. Listing 30 — SOAP Document Wrapped Web Service
        3. Listing 31 — SOAP Document Wrapped XML Request
    5. Why We Should Use Doc-WS?
      1. The RPC Inheritance
      2. The Document-Oriented Way
        1. Document Style
          1. Self-Containing Documents and Asynchronous Models
          2. Validating Capabilities
          3. Loose Coupling
          4. Interoperability
    6. Implementations: JAX-WS 2, Axis2, Spring-WS, and XFire/CXF 2.0
      1. JAX-WS 2
      2. Axis 2
      3. Spring-WS
      4. XFire / CXF
    7. Summary
  8. 3. Web Service Implementations
    1. Web Service Using JAX-WS 2.0
      1. JAX-WS 2.0 — A Primer
      2. Web Service Implementation in Java SE 6
        1. Code Server and Client
          1. IHello.java
          2. HelloImpl.java
          3. HelloServer.java
          4. HelloClient.java
        2. Run the Server and Client
      3. Web Service Implementation in Java EE Server
        1. Install and Start the Server
        2. Code Server and Client
          1. HelloWebService.java
          2. Client.java
        3. Run the Server and Client
    2. Web Service Using Apache Axis
      1. Contract-First versus Contract-Last
      2. Web Service Implementation in Axis
        1. Code Server and Client
          1. IHelloWeb.java
          2. HelloWebService.java
          3. build.xml
          4. RpcClient.java
          5. CallClient.java
        2. Run the Server and Client
    3. Web Service Using Spring
      1. Spring-WS — A Primer
      2. Web Service Implementation in Spring
        1. Code Server and Client
          1. IHello.java
          2. IHelloWeb.java
          3. HelloWebService.java
          4. Hello.java
          5. applicationContext.xml
        2. web.xml
          1. Client.java
          2. ClientObject.java
          3. applicationContextClient.xml
        3. Run the Server and Client
    4. Web Service Using XFire
      1. Web Service Implementation in XFire
        1. Code Server and Client
          1. IHello.java
          2. HelloServiceImpl
          3. web.xml
          4. services.xml
        2. Run the Server and Client
    5. Summary
  9. 4. Data and Services — All Roads Lead to Enterprise Service Bus
    1. JDO
      1. Why JDO?
      2. JPOX — Java Persistent Objects
      3. JDO Sample Using JPOX
        1. BDOM for the Sample
        2. Code BDOM Entities for JDO
          1. OrderList.java
          2. LineItem.java
          3. package.jdo
          4. jpox.PROPERTIES
          5. Main.java
        3. Build and Run the JDO Sample
    2. Data Services
    3. Service Data Objects
      1. Why SDO?
      2. SDO Architecture
      3. Apache Tuscany SDO
      4. SDO Sample Using Tuscany SDO
        1. Code the Sample Artifacts
          1. hr.xsd
          2. hr.xml
          3. ReadEmployees.java
          4. CreateEmployees.java
        2. Build and Run the SDO Sample
    4. Service Component Architecture
      1. What is SCA?
      2. Apache Tuscany SCA Java
      3. SCA Sample Using Tuscany SCA Java
        1. Code the Sample Artifacts
          1. Code Fine-Grained Service Components
            1. FlightServiceComponent
            2. HotelServiceComponent
            3. CabServiceComponent
          2. Code BookingAgent Service Component
          3. Code BookingAgent Client
        2. Build and Run the SCA Sample
    5. Message-Oriented Middleware
      1. What is MOM?
      2. Benefits of Using MOM
    6. Enterprise Service Bus
      1. EAI and ESB
      2. Java Business Integration
      3. OpenESB
    7. Summary
  10. 5. Traditional Integration Technology
    1. Case Study #1 — Based on EAI
      1. Customer Information
      2. Business Need
      3. Solution
        1. Hub and Spoke Architecture
          1. Step One — Identifying Applications (Spokes)
          2. Step Two — Messaging Hub
          3. Step Three — Identifying Adapter
      4. Goals Achieved
        1. Goal #1 — Integration between Internal Business Processes and Business Partners
        2. Goal #2 — Avoid Duplicity
        3. Goal #3 — Achieve Re-Usability, Flexibility, and Scalability
        4. Goal #4 — Platform Independence
        5. Goal #5 — Setting up Messaging Exchange
        6. Goal #6 — Less Manual Intervention
        7. Goal #7 — Cost Effective
      5. EAI Drawbacks
        1. Proprietary Architecture
        2. Messaging Bottlenecks
        3. Tight Coupling
        4. Non-Flexible Architecture
        5. Manpower
      6. SOA to Rescue
    2. Case Study #2 — Based on SOA
      1. Step One — Defining Organization Assets
      2. Step Two — Generate Services
        1. Information is eXtensible
        2. Information Represented in Textual Form
        3. Information is Structured
        4. Platform Independency
      3. Step Three — Model
        1. Co-relation of Events
        2. Co-relation of Services and Information
      4. Step Four — Integrate
        1. ESB — Enterprise Service Bus
      5. Goals Achieved
        1. Goal #1 — Proprietary Architecture
        2. Goal #2 — Eliminating Messaging Bottlenecks
        3. Goal #3 — Loose Coupling of Applications
        4. Goal #4 — Flexible Architecture
        5. Goal #5 — Return On Investment (ROI)
    3. Summary
  11. 6. Goals We Can Achieve with SOA
    1. Loose Coupling
    2. Reusability
    3. Seamless Integration
    4. Return on Investment (ROI)
    5. Summary