Hands-on CXF Web Services Training
Learn Apache CXF web services development with training from an expert in the field who is also a CXF committer. Apache CXF builds on the JAXB, JAX-WS, and JAX-RS standards, but supports many added features for usability and versatility. This training covers everything from the basics of REST and SOAP web services on CXF to the darkest reaches of WS-Security and related extension technologies, with options for in-depth coverage of web service design, XML schema usage, and more.
Your team will learn how to use CXF for both direct execution and deployment to web servers such as Apache Tomcat (or optionally, to an OSGi container). In-class assignments are supplied with both Maven console builds and Eclipse project files, and Eclipse is used for coding demonstrations. Optimum class size is 6-12 developers, though somewhat larger numbers can be accommodated with pair programming.
The basic CXF introduction that covers using CXF for both REST and SOAP web services, with a range of configuration and deployment options, can be delivered in 2 days time. Coverage of advanced features such as WS-Security and related standards, WS-ReliableMessaging, Apache Camel integration, and XML schema design take the class up to 4 days or more, depending on the options chosen. You can also combine the CXF training with the full Web Services Security material, rather than the abbreviated version shown in the outline below.
Course Objectives
- Learn to work with JAXB, JAX-RS, and JAX-WS for web services in Java
- Understand how CXF processes JSON and XML messages
- Understand the pros and cons of REST vs. SOAP web services
- Learn how to configure and monitor CXF operation, both directly and using Spring
- Understand the structure and role of WSDL, WADL, and XML schema in web services
- Understand and know how to apply security in web services
- Get practical experience in applying all this to real web service projects
Attainment of course objectives is measured by performance on in-class assignments and snap quizes for each module. Certificates of completion are available for attendees who demonstrate their grasp of the material and ability to apply it to practical problems.
Course Prerequisites
- Intermediate Java programming experience
- Basic knowledge of XML and HTTP (can be covered in more depth in class if appropriate)
Core Course Outline
Part I - Getting started
- Web services in a SOA world
- XML and JSON data exchange
- XML Schema basics
- JAXB to and from schema
- Schema limitations and concerns
Assignments:
- Specifying data for exchange
- Working with JAXB code generation
Part II - CXF REST web services
- Principles of REST
- JAX-RS client and server in CXF
- Deploying and controlling CXF service
- JSON vs. XML data exchange
- Monitoring and debugging message exchanges
- CXF interceptor architecture and configuration
- Added CXF extensions for REST
- REST pros and cons
Assignments:
- REST client and server implementation
- Monitoring and debugging client and server
- Defining and using REST exceptions
Part III - CXF SOAP web services
- SOAP message structure
- WSDL structure and usage
- JAX-WS client and server in CXF
- Understanding CXF message flows
- WS-Addressing purpose and usage
- SOAP pros and cons
Assignments:
- SOAP client and server implementation
- Adding Fault handling to implementation
- Adding WS-Addressing to message exchanges
Part IV - Starting from existing code (optional)
- Using JAXB and JAX-WS standard annotations
- Jibx2Wsdl usage:
- Operation and features
- Customizations structure
- Building clean WSDL+schema from code
- Issues with code-first approach
Assignments:
- Generating WSDL and schema from JAXB/JAX-WS annotations
- Jibx2Wsdl service creation
- Customizing Jibx2Wsdl generation
- Implementing CXF JAXB/JAX-WS service and client
Part V - CXF architecture
- Understanding the Bus
- Using and implementing interceptors
- Transport configuration and usage
- Asynchronous SOAP services
- SOAP extension technologies in CXF
Assignments:
- Implementing and using a custom interceptor
- Configuring HTTP/HTTPS transport options
- Implementing asynchronous client operation
Part VI - Dealing with performance
- REST vs. SOAP performance
- Structuring operations and XML for performance:
- Reducing the number of message exchanges
- Reducing message sizes
- Using attachments for large data items
Assignments:
- Restructuring service and XML for performance
- Adding attachment support to client and server
Part VII - Securing web services (basic version - see Web Services Security)
- Understanding keys and certificates
- SSL for point-to-point security
- WS-Security:
- Basis in XML encryption and signature
- Understanding WS-Policy and WS-SecurityPolicy
- Implementing common options
- Performance costs of security
- Choosing appropriate security
Assignments:
- Implementing transport security on server
- Passing client identification to server (UsernameToken)
- Enabling WS-Security message signing and encryption
Part VIII - Advanced stack features
- OSGi service deployment
- Apache Camel integration for message routing and mediation:
- Routing requests to CXF service
- JMS transport through Camel
- Implementing extended processing
- WS-ReliableMessaging:
- WS-ReliableMessaging principles
- Configuring and using WS-ReliableMessaging
Assignments:
- Deploying services to OSGi
- Routing requests using Camel
- WS-ReliableMessaging client implementation