O'Reilly logo

Java SOA Cookbook by Eben Hewitt

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Configuring Standard Custom Bindings

Problem

You want to customize the binding between Java and WSDL in order to enable asynchronous operations, dictate client Java package names, specify MIME content, or enable wrapper style.

Solution

Write your custom bindings either inline within the WSDL or in an external binding file. Your generated SEI will provide asynchronous methods based on the methods defined. If you are using SAAJ, asynchronous methods are defined already for you on Dispatch<T>. These are:

Response<T> invokeAsync(T msg)

Future<?> invokeAsync(T msg, AsyncHandler<T> handler)

Discussion

There are four standard customizations that the JAX-WS specification defines out of the box:

package

Used to dictate to clients the name of the Java package for the target namespace indicated in the wsdl:definitions element, and to insert package-level JavaDoc text for a client package-info.java file

enableWrapperStyle

Turns on wrapper style processing for all qualifying operations

enableAsyncMapping

Allows clients to invoke specified operations asynchronously

enableMIMEContent

Enables use of MIME content by default for all specified operations

Because a client’s only view of your service is the WSDL, that’s where you have to indicate whether your service supports any of these capabilities. JAX-WS defines a separate binding element for each of these items, and you tie them to your WSDL using one of two methods: an external binding file that your WSDL imports, or inline elements, directly within your WSDL. ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required