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

Determining a Service Development Model

Problem

You need to start developing the web services for your SOA solution, but there are so many different pieces to put in place that you are not sure where to begin. You need to determine what has to be written by hand and what doesn’t.

Solution

Use one of the three basic development models accounted for in the specifications: “Start from Java,” “Start from WSDL,” or “Start from WSDL and Java.” There is also a corollary development model, which I’ll refer to as “Start from Schema.” You need to write different items depending on what starting point you choose.

Discussion

In this section, we’ll discuss the four development models just listed.

Start from Code (Java)

Using this development model, the Java developer writes a single Java class that represents the web service implementation. Using special web services annotations on the implementation, you can have Java generate for you the many other web services-related artifacts, such as schemas, the WSDL, and deployment descriptors.

Here are the basic steps to using a code-first approach:

  1. Write a plain old Java class, servlet, or EJB, and annotate it with the @WebService annotation.

  2. Deploy it to a JAX-WS-compliant container.

  3. The JAX-WS runtime will generate a WSDL for you, and handle the translations between Java and SOAP/XML.

This is probably the easiest way for Java developers to start, as most of the manual work is performed using the tools and APIs we already know.

But the more you work with all of ...

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