Book Image

Mastering Spring Application Development

By : Anjana Mankale
Book Image

Mastering Spring Application Development

By: Anjana Mankale

Overview of this book

Table of Contents (19 chapters)
Mastering Spring Application Development
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Writing a client application for Spring Web Services using JAXB unmarshalling for request


Let us write a simple client application for the author service. The org.springbyexample.ws.service package is scanned for beans and will find the AuthorServiceClient, and inject the web service template into it. The JAXB marshaller/umarshaller is defined and set on this template.

The import of the jetty-context.xml isn't relevant to creating a client, but it creates an embedded Jetty instance that loads the spring-ws-context.xml and its services. The client in the unit test is then able to run in isolation.

AuthorServiceClientTest.xml:

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xmlns:p="http://www.springframework.org/schema/p"
  xmlns:context="http://www.springframework.org/schema/context"
  xsi:schemaLocation="http://www.springframework.org/schema/beans 
  http://www.springframework...