Apache CXF Web Service Development

Apache CXF Web Service Development

Develop and deploy SOAP and RESTful Web Services

  • 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

In Detail

The Apache CXF framework helps you to develop web services using 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.

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

Table of contents

Chapter 1: Getting Familiar with CXF revisits web service concepts and provides an introduction to CXF framework and its usage, and prepares the CXF environment for the following chapters. By the end of this chapter the reader will be able to understand the core concepts of CXF.

Chapter 2: Developing a Web Service with CXF focuses on getting the reader quickly started with the CXF framework by developing a simple web service and running it under the Tomcat container. By the end of this chapter the reader will be able to develop a simple web service using CXF.

Chapter 3: Working with CXF Frontends illustrates the use of different frontends, like JAX-WS and CXF simple fronted API, and shows how to apply code-first and contract-first development approaches for developing web services. We will look at how to create dynamic web service clients, the use of web service context, and how to work directly with XML messages using Provider and Dispatch implementation. By the end of this chapter the reader will be able to apply different frontends to develop a web service.

Chapter 4: Learning about Service Transports explains basic transport protocols for a service and shows you how to configure HTTP, HTTP(s), JMS, and Local protocol for web services communication. You will get introduced to the concept of HTTP conduit, which enables the client program to apply policies or properties to HTTP and HTTPs protocols, and how to generate a crypto key and a key store for HTTPs based service communication. You will learn how to use JMS protocol for web services communication and how to facilitate web services message exchange using CXF Local service transport. By the end of this chapter the reader will be able develop services with different transports.

Chapter 5: Implementing Advanced Features will explain advanced concepts using CXF Features, Interceptors, and Invokers, and how to integrate these concepts in existing applications. By the end of this chapter the reader will be able develop services with features like Interceptors and Invokers.

Chapter 6: Developing RESTful Services with CXF explains the concept of REST technology and JAX-RS specifications, how CXF realizes the JAX-RS specification, and demonstrates additional features for developing enterprise RESTful services. We will look at how to design, develop, and unit test the RESTful Service by taking a real world example using CXF JAX-RS implementation. You will also look at how to enable exception handling for RESTful services. By the end of this chapter the reader will be able to design, develop, and unit test the RESTful service.

Chapter 7: Deploying RESTful Services with CXF will explain how to deploy REST services in a container like Tomcat using Spring configuration, and how to test out the various operations exposed by the RESTful application using CXF RESTful client API and using a web service development tool. We will look at how to enable JSON message support, and logging support for RESTful applications using CXF framework. 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.

Chapter 8: Working with CXF Tools will explain some of the commonly used CXF tools that assist us in web services development. We will look at how to invoke a real world .NET service over the internet using a Java client and JavaScript, create web service implementation from WSDL files, generate WSDL files from web service implementation, and validate the WSDL file for compliance. By the end of this chapter the reader will be able to use different CXF tools to develop a service.

Appendix A : Getting Ready with Code Examples deals with how to set up the CXF environment, provides details on how the source code for each chapter is organized, and shows how to run the source code examples using the ANT tool and Maven Tool.

Appendix B: Getting Started with Spring provides an explanation of the basics of the Spring framework and IoC concepts, along with an end-to-end example which utilizes Spring IoC concepts. By the end of this Appendix chapter the reader will have a good understanding of Spring capabilities used in the context of CXF web services development in this book.


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 written 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.

List Price: $ 44.99

Price: {price-updating}