Free Sample
+ Collection

Spring Web Services 2 Cookbook

Cookbook
Hamidreza Sattari, Shameer Kunjumohamed

In this book you’ll discover over sixty recipes, giving you a first-hand understanding of how to implement Spring Web Services 2. Ideal as both a newcomer’s learning tool and an expert’s reference manual.
$29.99
$49.99
RRP $29.99
RRP $49.99
eBook
Print + eBook

Want this title & more?

$16.99 p/month

Subscribe to PacktLib

Enjoy full and instant access to over 2000 books and videos – you’ll find everything you need to stay ahead of the curve and make sure you can always get the job done.

Book Details

ISBN 139781849515825
Paperback322 pages

About This Book

  • Create contract-first Web services
  • Explore different frameworks of Object/XML mapping
  • Secure Web Services by Authentication, Encryption/Decryption and Digital
    Signature
  • Learn contract-last Web Services using Spring Remoting and Apache CXF
  • Implement automated functional and load testing
  • Develop RESTful Web-Services
  • Log and trace SOAP messages

Who This Book Is For

This book is for Java/J2EE developers. As the books covers a variety of topics in Web-Service development, it will serve as a reference guide to those already familiar with Web-Services. Beginners can also use this book to gain real-world experience of Web-Service development.

Table of Contents

Chapter 1: Building SOAP Web-Services
Introduction
Using Maven for building and running a Spring-WS project
Creating a data contract
Setting up a Web-Service using DispatcherServlet
Simplifying the creation of a Web-Service using MessageDispatcherServlet
Setting up a Web-Service on JMS transport
Setting up a Web-Service on E-mail transport
Setting up a Web-Service on embedded HTTP transport
Setting up Spring-WS on XMPP transport
Setting up a contract-first Web-Service
Setting up a simple endpoint mapping for the Web-Service
Setting up an endpoint by annotating the payload-root
Setting up a transport-neutral WS-Addressing endpoint
Setting up an endpoint using an XPath expression
Handling the incoming XML messages using DOM
Handling the incoming XML messages using JDOM
Handling the incoming XML messages using JAXB2
Validating the XML messages at the server side using an interceptor
Chapter 2: Building Clients for SOAP Web-Services
Introduction
Setting up a Web-Service client development environment within Eclipse
Setting up a Web-Service client development environment using Maven
Creating a Web-Service client on HTTP transport
Creating a Web-Service client on JMS transport
Creating a Web-Service client on E-mail transport
Setting up a Web-Service on XMPP transport
Creating a Web-Service client using XPath expressions
Creating a Web-Service client for a WS-Addressing endpoint
Transforming a Web-Service message using XSLT
Chapter 3: Testing and Monitoring Web-Services
Introduction
Integration testing using Spring-JUnit support
Server-side integration testing using MockWebServiceClient
Client-side integration testing using MockWebServiceServer
Monitoring TCP messages of a Web-Service using TCPMon
Monitoring and load/functional testing of a Web-Service using soapUI
Chapter 4: Exception/SOAP Fault Handling
Introduction
Handling server-side exceptions by returning the exception's message as a SOAP fault string
Mapping exception class names to SOAP faults
Annotating exception classes with @SOAPFault
Writing your own exception resolvers in Spring-WS
Chapter 5: Logging and Tracing of SOAP Messages
Introduction
Logging message payload manually
Logging both request and response SOAP Envelopes using log4j
Logging both request and response using Spring-WS's Interceptors
Using Eclipse IDE to debug a Spring-WS
Chapter 6: Marshalling and Object-XML Mapping (OXM)
Introduction
Marshalling with JAXB2
Marshalling with XMLBeans
Marshalling with JiBX
Marshalling with XStream
Marshalling with MooseXML
Creating a custom marshaller using XPath for conditional XML parsing
Chapter 7: Securing SOAP Web-Services using XWSS Library
Introduction
Authenticating a Web-Service call using plain/digested username token
Authenticating a Web-Service call using Spring security to authenticate a username token with a plain/digested password
Authenticating a Web-Service call using a JAAS service to authenticate a username token
Preparing pair and symmetric keystores
Securing SOAP messages using digital signature
Authenticating a Web-Service call using X509 certificate
Encrypting/decrypting of SOAP messages
Chapter 8: Securing SOAP Web-Services using WSS4J Library
Introduction
Authenticating a Web-Service call using a username token with a plain/digest password
Authenticating a Web-Service call using Spring security to authenticate a username token with a plain/digest password
Securing SOAP messages using a digital signature
Authenticating a Web-Service call using an X509 certificate
Encrypting/decrypting SOAP messages
Chapter 9: RESTful Web-Services
Introduction
Setting up a Spring RESTful Web-Service using RESTful features in Spring MVC
Using the REST Client tool to access Spring RESTful Web-Service
Setting up a Spring RESTful Web-Service using HTTP message conversion
Creating a WS Client for the Spring RESTful Web-Service using Spring template classes
Chapter 10: Spring Remoting
Introduction
Setting up Web-Services using RMI
Setting up a servlet-based Web-Service using Hessian/Burlap, exposing business beans
Setting up Web-Services using JAX-WS
Exposing servlet-based Web-Services using Apache CXF
Exposing Web-Services using JMS as the underlying communication protocol

What You Will Learn

  • Setting up SOAP Web-Services using various protocols such as HTTP, JMS, XMPP, Email and so on
  • Implementing Web-Service's Endpoint using technologies such as DOM, JDOM, XPATH, and Marshaller
  • Testing Web-Services using latest features of Spring-WS
  • Creating and monitoring automated testing using tools such as soapUI and TCPMon
  • Marshalling and Un-Marshalling using Jaxb2, XMLbeans, Xstream and other technologies
  • Securing your Spring Web Service through encryption, decryption, digital signature authentication and authorization
  • Implement a Web-Service using Spring-Remoting on RMI, Hessian/Burlap, JAX-WS, JMS technologies and a Web-Service using Apache CXF on JAXWS front-end
  • Developing REST Web-Service server and client using Spring RESTful Support

In Detail

Spring Web Services is a product of the Spring community focused on creating document-driven Web services.

Spring Web Services aims to facilitate contract-first SOAP service development, allowing for the creation of flexible web services using one of the many ways to manipulate XML payloads.

This comprehensive guide -- which provides professional expertise on a variety of technical topics right from setting-up a contract-first Web-Service, creating client of a Web-Service to serialization, monitoring, testing and security using Spring-WS -- helps you enhance your skills in Spring Web Services.

Spring Web Services 2 Cookbook includes a wide variety of recipes that covers most important topics used in real-world applications. It is a well-rounded guide covering a lot of ground in the Spring Web Services domain using systematic arranged chapters and focused recipes.

The book begins with setting up a contract first Web Service over various protocols such as JMS, XMPP, and Email. The next chapter targets creating clients for SOAP Web Services. We then learn how to test and monitor the Web Service using tools like soapUI and TCPMon. Building on, logging, tracing and exception handling are detailed in the subsequent chapter. The book then covers marshalling and unmarshalling using different technologies like JAXB2, XMLBeans, JibX, XStream, MooseXML etc. Securing WebServices through authentication, authorization, encryption and decryption and digital signature using Spring-WS features based on XWSS and WSS4J Libraries is outlined in the next chapter two chapters. The book then tackles development of RESTful Web Services. Finally, Setting up Web Services using Spring Remoting based on various technologies like HTTP , RMI, JMS, JAXWS and a Web Service using Apache CXF on JAX-WS front-end are explained.

This book will help relatively new developers in accelerating their learning process and experienced developers in expanding their skills sets of Spring Web Services.

Authors

Read More