Book Image

Apache CXF Web Service Development

By : Naveen Balani, Rajeev Hathi
Book Image

Apache CXF Web Service Development

By: Naveen Balani, Rajeev Hathi

Overview of this book

<p>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.<br /><br />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. <br /><br />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.<br /><br />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.<br /><br />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.<br />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.</p>
Table of Contents (16 chapters)
Apache CXF Web Service Development
Credits
About the Authors
About the Reviewer
Preface
Index

Setting up the environment


Once the the software is installed, we go about setting up the following environment variables:

Environment Variable

Description

JAVA_HOME

Set this to point to JDK 1.5 installation root folder, for example C:\jdk1.5.0_12

CATALINA_HOME

Set this to point to Tomcat installation root folder, for example C:\Program Files\Tomcat 6.0

ANT_HOME

Set this to point to ANT installation root folder, for example C:\apache-ant-1.7.1

CXF_HOME

Set this to point to CXF installation root folder, for example C:\apache-cxf-2.2.3

MAVEN_HOME

Set this to point to Maven installation root folder, for example. C:\apache-maven-2.2.1

PATH

Set this to point to the above respective 'HOME' bin folder, for example %JAVA_HOME%\bin. Make sure that you do not overwrite the existing PATH variable content. You will need to add to the existing PATH.

The environment setup can also be automated using batch script. The script, under Windows environment, might look like the following:

@echo off
rem ---------------------------------------------------------------
rem CXF Environment Setup script
rem ---------------------------------------------------------------
set JAVA_HOME=C:\jdk1.5.0_12
set CATALINA_HOME=C:\Program Files\Tomcat 6.0
set ANT_HOME=C:\apache-ant-1.7.1
set CXF_HOME=C:\apache-cxf-2.2.3
set MAVEN_HOME= C:\apache-maven-2.2.1
set PATH=%PATH%;%JAVA_HOME%\bin;%CATALINA_HOME%\bin;%ANT_HOME%\bin;%CXF_HOME%\bin;%MAVEN_HOME%\bin
rem ---------------------------------------------------------------

Alternatively, Windows users can make use of Control Panel to set up the environment variable. From Control Panel, select System Properties and select the Advanced tab. Under the Advanced tab, click on the Environment Variables button, and set the appropriate environment variable.

Once the environment is set up, refer to the relevant chapter on how to develop, build and run the source code.