Apache CXF Web Service Development


Apache CXF Web Service Development
eBook: $26.99
Formats: PDF, PacktLib, ePub and Mobi formats
$22.94
save 15%!
Print + free eBook + free PacktLib access to the book: $71.98    Print cover: $44.99
$44.99
save 37%!
Free Shipping!
UK, US, Europe and selected countries in Asia.
Also available on:
Overview
Table of Contents
Author
Reviews
Support
Sample Chapters
  • Design and develop web services using contract-first and code-first approaches
  • Publish web services using various CXF frontends such as JAX-WS and Simple frontend
  • Invoke services by configuring CXF transports
  • Create custom interceptors by implementing advanced features such as CXF Interceptors, CXF Invokers, and CXF Features
  • The first practical guide on Apache CXF with real-world examples

Book Details

Language : English
Paperback : 336 pages [ 235mm x 191mm ]
Release Date : December 2009
ISBN : 1847195407
ISBN 13 : 9781847195401
Author(s) : Naveen Balani, Rajeev Hathi
Topics and Technologies : All Books, Web Development, Open Source


Table of Contents

Preface
Chapter 1: Getting Familiar with CXF
Chapter 2: Developing a Web Service with CXF
Chapter 3: Working with CXF Frontends
Chapter 4: Learning about Service Transports
Chapter 5: Implementing Advanced Features
Chapter 6: Developing RESTful Services with CXF
Chapter 7: Deploying RESTful Services with CXF
Chapter 8: Working with CXF Tools
Appendix A: Getting Ready with Code Examples
Appendix B: Getting Started with Spring
Index
  • Chapter 1: Getting Familiar with CXF
    • Web service technology standards
      • XML
        • SOAP (Simple Object Access Protocol)
        • WSDL (Web Services Description language)
      • REST (Representational State Transfer)
      • Service Registry
    • Introducing web services
      • Approaches for web service development
      • Web service SOAP communication styles
    • Apache CXF
      • History of CXF
      • Why CXF?
        • Support for web service standards
        • Support for POJO (Plain Old Java Object)
        • Frontend programming APIs
        • Tools support
        • Support for RESTful services
        • Support for different transports and bindings
        • Support for non-XML binding
        • Ease of use
        • Flexible deployment
    • Setting up the environment
      • For ANT users
      • For Maven users
    • Summary
  • Chapter 2: Developing a Web Service with CXF
    • The Order Processing Application
    • Developing a service
      • Creating a Service Endpoint Interface (SEI)
      • Developing a service implementation class
      • Spring-based server bean
    • Developing a client
      • Developing a Spring-based client bean
      • Developing web service client code
    • Running the program
      • Building the code
      • Deploying the code
      • Executing the code
    • CXF architecture
      • Bus
      • Frontend
        • JAX-WS
        • Simple frontend
      • Messaging and Interceptors
      • Service model
      • Data binding
      • Protocol binding
      • Transports
    • Summary
  • Chapter 3: Working with CXF Frontends
    • JAX-WS frontend
      • Code-first development
        • Creating Service Endpoint Interface (SEI)
        • Adding Java annotations
        • Publishing the service
        • Developing a consumer
        • Running the Code-first example
      • Contract-first development
        • Generating service components
        • Implementing the service method
      • Publishing the web service
      • Invoking the web service
    • Using dynamic client
      • Creating a simple dynamic client
      • Running the dynamic client
      • Using the CXF service model for building dynamic client
        • Running the dynamic client which uses Service Model API
    • Provider and Dispatch services
      • Understanding messaging modes
        • Message mode
        • Payload mode
      • Understanding types of message objects
        • javax.xml.transform.Source
      • Implementing Provider service
      • Publishing the Provider service
      • Implementing the Dispatch service
      • Running the provider dispatch example
      • Web service context
      • Implementing Context in service
        • Running the web service context example
    • Simple frontend
      • Developing a simple frontend
        • Creating service implementation class and interface
        • Creating server implementation
        • Creating client
    • Running the simple frontend example
    • Summary
  • Chapter 4: Learning about Service Transports
    • Transport protocols in CXF
      • HTTP transport
        • SOAP over HTTP
        • HTTP only
        • HTTP Conduit
        • HTTP destination
      • HTTPs transport
        • Developing the service and implementation class
        • Generating crypto key
        • Creating client and server bean configuration
        • Configuring the server to support SSL
        • Developing the client component
        • Building and deploying
        • Configuring SSL for Jetty runtime
      • JMS transport
        • Developing the service and implementation class
        • Developing an embedded broker
        • Creating a server and client bean configuration
        • Developing a client component
        • Performing build and deployment
      • Local transport
        • Developing SEI and an implementation class
        • Developing a server
        • Creating client bean configuration
        • Developing a Client
        • Building and executing
    • Summary
  • Chapter 5: Implementing Advanced Features
    • Understanding CXF interceptors
      • Understanding interceptor phase and chain
      • Overview of the interceptor API
        • Interceptor interface
        • The PhaseInterceptor interface
        • The AbstractPhaseInterceptor class
    • Developing the custom interceptor
      • Developing the server side interceptor
      • Adding a server side interceptor to the Order Process service
      • Developing the client side interceptor
      • Adding a client side interceptor to the client code
      • Developing the standalone server for publishing the Order Process web service
      • Building and running the Order Process web service and interceptor
        • Building the code
        • Executing the code
      • Testing the custom interceptor for negative condition
    • Understanding CXF features
    • Applying the GZIP feature to the Order Process web service
      • Developing service and implementation class
      • Developing a server component
      • Creating the client bean configuration file
      • Creating a client component to consume the service
      • Building and executing the code
    • Understanding CXF Invoker
      • Overview of Invoker API
        • The Invoker interface
        • The AbstractInvoker class
    • Developing custom invoker
    • Summary
  • Chapter 6: Developing RESTful Services with CXF
    • Overview of REST and RESTful services
      • Java API for RESTful services
      • CXF JAX-RS implementation
    • Developing end-to-end RESTful services using CXF JAX-RS implementation
      • Developing the RESTful service
        • Creating Java data objects for Request and Response
        • Providing binding for the Request and Response data objects
        • Developing the implementation class
        • Creating the client
        • Running the program
        • Building the code
        • Deploying the code
        • Executing the code
      • Adding exception handling to RESTful service
    • Summary
  • Chapter 7: Deploying RESTful Services with CXF
    • Packaging the Book Shop application
      • Configuring CategoryService RESTful bean using Spring
      • Integrating Spring using web.xml
      • Building and deploying the WAR file
        • Building the code
        • Deploying the code
    • Invoking operations on the Book Shop RESTful application
      • Installing POSTER client
      • Invoking the Book Shop application using the the POSTER tool
        • Invoking the Get Category operation
        • Invoking the Add Category operation
        • Invoking the Update Category operation
        • Invoking the Add Books operation
        • Invoking the Get Books operation
        • Invoking the Update Category operation with invalid request
        • Invoking the Get Category operation with invalid request
        • Invoking the Delete Category operation
      • Invoking the Book Shop application using CXF APIs
    • Configuring JSON support for the Book Shop application
      • Incorporating JSON message format for the Book Shop application
        • Invoking the Get Category operation with JSON as the message format
        • Invoking the Add Category operation with JSON as the message format
      • Invoking the Book Shop application with JSON as the message format using CXF APIs
    • Intercepting messages for the Book Shop application
    • Deploying the Book Shop application in the application servers
    • Summary
  • Chapter 8: Working with CXF Tools
    • Invoking a web service using the Java client
      • Analyzing the service WSDL definition
      • Building and running the Java web service clients
        • Generate the web service clients
        • Analyzing the JAX-WS and client generated artifacts
        • Modifying the generated client
        • Building the client
        • Running the client
    • Invoking the web service using JavaScript
      • Building and running the Java web service clients
      • Generating the JavaScript client
        • Analyzing the generated artifacts
        • Creating the client
        • Running the client
    • Creating Service Implementation from the WSDL file
      • Generating and deploying the Service Implementation from the WSDL file
        • Generating the web Service Implementation
        • Analyzing the Service Implementation generated artifacts
        • Modifying the generated Service Implementation
        • Building the web service project
        • Deploying and publishing the web service
        • Invoking the web service
    • Validating WSDL files
    • Summary
  • Appendix A: Getting Ready with Code Examples
    • Downloading the source code
    • Downloading the software required for the book
    • Setting up the environment
    • Using Maven for Build management
      • Building chapter source code using Maven
  • Appendix B: Getting Started with Spring
    • Concept of POJO-based development
    • Understanding Inversion of Control
    • Overview of aspect-oriented programming
    • Introduction to Spring framework
      • The Spring IoC container
    • Creating a Spring IoC application
      • Creating the entity model
      • Creating services
      • Creating the application and wiring POJO
      • Creating the standalone client
      • Running the program
        • Building the code
        • Executing the code
    • Summary

Naveen Balani

Naveen Balani works as a Software Architect with WebSphere Business Services Fabric (WBSF) Product out of IBM India Software Labs, Mumbai. He has over 9 years of industrial experience and has architected and implemented large scale BPM solutions. He started working with Web Services way back in 2001 and proposed the first MVC web services-based pattern (http://www.ibm.com/developerworks/library/ws-mvc/) in 2002. He is a Master Author with IBM developer works having published over 60 publications. He has co-authored books on Spring framework (published by Wrox) and Multiple IBM Redbooks on WebSphere Business Services Fabric and BPM 6.2 Product deployments.


Rajeev Hathi

Rajeev Hathi is a senior technology consultant specializing in J2EE architecture and design. He has more that 10 years of industry experience in the area of design and development of J2EE-based projects. He has attained various professional certifications in Java that include SCJP, SCWCD, SCBCD, and SCEA – Part 1. He has written several articles on Java and DB2 for IBM developerWorks portal. His hobbies are music and sports.

Code Downloads

Download the code and support files for this book.


Submit Errata

Please let us know if you have found any errors not listed on this list by completing our errata submission form. Our editors will check them and add them to this list. Thank you.


Errata

- 9 submitted: last submission 02 Apr 2013

Errata type: Grammar | Page number: 3

"By the end of this chapter the reader would be able utilize various CXF features for developing RESTful services and how to leverage Spring configuration for deploying RESTful service in the tomcat container." Should be "By the end of this chapter the reader would be able to utilize various CXF features for developing RESTful services and how to leverage Spring configuration for deploying RESTful service in the tomcat container."

 

Errata type: Grammar | Page number: 49

"Again the contract definitions can be made consistent with respect to data types so that it can be easily converted in Java objects without any portability issue." should be "Again the contract definitions can be made consistent with respect to data types so that it can be easily converted into Java objects without any portability issue.

 

Errata type: Grammar | Page number: 49 "The WSDL portion following shows the sample transport details:" Should be "The following WSDL portion shows the sample transport details:"

Errata type: Others | Page number: 51

"Web service development using the contract-first development approach" Should be "Web service development using the Contract-first development approach"

 

Errata type: Code | Page number: 59

System.out.println(«Starting Server»); should be System.out.println("Starting Server");

 

Errata type: Others | Page number: 59

String address = «http://localhost:8080/OrderProcess»; Should be String address = "http://localhost:8080/OrderProcess";

 

Errata type: Others | Page number: 106

"HTTP conduits are channels allow us to apply certain HTTP related properties or attributes which can affect the way messages are exchanged between endpoints." Should be "HTTP conduits are channels that allow us to apply certain HTTP related properties or attributes which can affect the way messages are exchanged between endpoints."

 

Errata type: Typo | Page number: 107

"for eample XML or JSON format, before sending the response over HTTP. CXF handles this mapping transparently behind the scenes by providing data binding components." Should be "for example XML or JSON format, before sending the response over HTTP.CXF handles this mapping transparently behind the scenes by providing data binding components."

 

Errata type: Code | Page number : 27

String processOrder(OrderprocessOrder(Order order); Should be: String processOrder( Order order );

Sample chapters

You can view our sample chapters and prefaces of this title on PacktLib or download sample chapters in PDF format.

Frequently bought together

Apache CXF Web Service Development +    Unity iOS Essentials =
50% Off
the second eBook
Price for both: £24.65

Buy both these recommended eBooks together and get 50% off the cheapest eBook.

What you will learn from this book

  • Become familiar with the different features of Apache CXF architecture and set up the CXF environment
  • Develop a simple web service using CXF-based Spring configuration
  • Build a web service using contract-first and code-first approaches in simple frontend APIs such as JAX-WS
  • Create dynamic web service clients by using various CXF frontend APIs
  • Develop web services with different transports by configuring various CXF transports such as HTTP, HTTP(S), JMS, and CXF Local
  • Create RESTful services that support JSON and XML as the message formats
  • Develop services with features such as Interceptors by implementing advanced CXF features
  • Attain configuration and dependency management by integrating web services with the de facto Spring framework
  • Unit test POJO services in a stand-alone environment as well as promote applications to the Tomcat container for production ready deployments
  • Speed-start developing web services by using CXF tools effectively
  • Basics of Spring framework and IOC container for readers who are not acquainted with Spring framework

In Detail

Apache CXF framework helps you to develop a standards-based programming model and also provides a flexible deployment model for deploying web services. Developing SOAP and RESTful applications can be made easy by using Apache CXF framework. However, getting started with developing web services using the Apache CXF framework is not easy.

This is the first book that gives details on how to use the Apache CXF framework for developing SOAP and REST web services. It is a hands-on practical guide that simplifies working with CXF framework as it covers all major aspects with real-world examples. The chapters cover the various CXF features in detail and each has systematic steps with practical, simple examples to implement these features on your web services.

The book introduces the Apache CXF framework and its features such as Frontend API, Data Bindings, Transports, Spring-based configuration, and CXF tools. It also has chapters on SOAP and RESTful services. It will help you create RESTful services that support XML as well as the widely accepted Java Script Object Notation (JSON) format. It explains the components of CXF architecture that help developers customize the Apache CXF framework to suit the target application. The book covers both code-first and contract-first approaches for service deployment. You will see how to develop services in a flexible deployment model offered by CXF, unit test them in a stand-alone environment, and finally promote them in an application server environment.

The instructions in this book will help developers to build their application according their requirements by using any of the frontends supported by Apache CXF framework. The various CXF frontend APIs covered in this book provide a wide variety of options in developing and deploying your application.

The book introduces some advanced concepts such as Interceptors and features that will add extra capability to your service component. It will help you take advantage of different transport features offered by the CXF runtime such as HTTP, HTTP(S), and JMS protocols.
Finally, the book mentions various tools that help developers creating web services as well as creating Java and JavaScript-based web services clients which invoke a real-world .NET web service. These tools are standard batch files that can be easily executed from the Windows command shell by following the instructions in the book.

A practical hands-on guide to show you how to develop and deploy SOAP and RESTful services using Apache CXF framework

Approach

This book provides a quick start in developing web services using the open source Apache CXF framework. Each chapter uses illustrations from an Order Processing Application and all the code examples are built using the ANT tool. These practical, simple, and easy-to-work-with illustrations are accompanied by step-by-step instructions.

As a developer you can take advantage of these practical scenarios to understand the CXF framework and also make use of them in real-life applications. After reading this book, you will be able to develop and deploy services using the CXF framework.

Who this book is for

This book is for developers who want to design and develop SOAP and RESTful services using Apache CXF framework and leverage various CXF features for service development. It is ideal for developers who have some experience in Java application development as well as some basic knowledge of web services, but it covers some of the basic fundamentals of web services and REST to get you acquainted with these technologies before using these concepts to develop services using the CXF framework.

Code Download and Errata
Packt Anytime, Anywhere
Register Books
Print Upgrades
eBook Downloads
Video Support
Contact Us
Awards Voting Nominations Previous Winners
Judges Open Source CMS Hall Of Fame CMS Most Promising Open Source Project Open Source E-Commerce Applications Open Source JavaScript Library Open Source Graphics Software
Resources
Open Source CMS Hall Of Fame CMS Most Promising Open Source Project Open Source E-Commerce Applications Open Source JavaScript Library Open Source Graphics Software