Java Reference
In-Depth Information
parameter list. This is not particularly clear in communicating your intent, and may end up
being confusing to clients.
So the second step is to customize the values that will be generated by your Java class when
the preprocessor creates the WSDL and other artifacts. For example, you might use the @We-
bService.serviceName property to indicate the value of the wsdl:service element in your
WSDL.
NOTE
The names and implementations of the code generation tools for creating portable client-side artifacts
are not standard. For example, if you are running Glassfish, you can create a client using the
wsimport tool. If you're using Axis, this tool is called WSDL2Java (or, going the other way,
Java2WSDL ).
You can use these tools manually from the command line, or you can automate code generation as
part of your build by writing customizations to affect how those generated artifacts are created.
Once you have used standard means to customize the values in your generated artifacts, you
may choose to branch out to external customizations. These include modifying how JAXB
code generates Java classes that will be used by your client.
At this point, you might be concerned that your web service has a larger scope than a regular
Java class, even more than an EJB component; you want to start really thinking of your ser-
vice as a service, and not a glorified Java class. Or you might realize that you don't want to
leak implementation details out into your WSDL, which some tools can do. You might want
to include schemas that you write by hand. This last point is particularly important if you're
going to create a canonical data model to represent common types throughout your organiza-
tion.
Not all data types in a given programming language map to interoperable types in XML.
Watch your tools carefully, to ensure that they do not introduce implementation-specific map-
pings or dependencies. For example, consider the Java2WSDL tool, which comes with Apache
Axis 1.2. It creates a WSDL from a Java service implementation, but it introduces custom
types in the Apache SOAP namespace that represent image data, an octet stream, and a few
others. Your generated WSDL could look like this:
<wsdl:definitions targetNamespace="http://example.org/ns";
xmlns:apachesoap="http://xml.apache.org/xml-soap";
//...
<element name="anImage">
<complexType>
<sequence>
Search WWH ::




Custom Search