Java Reference
In-Depth Information
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 devel-
opment 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 implementa-
tion, 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 annota-
tion.
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 your web service artifacts, especially when it's time to ad-
vertise your service to others, you may find that you are not entirely happy with the default
values that have been generated for you. For instance, by default the names of method para-
meters get generated into a WSDL as arg0 , arg1 , and so on according to their index in the
Search WWH ::




Custom Search