Designing a Service's Interaction Layer
Java primitive types
with their corresponding wrapper Java classes
Standard Java classes:
Java arrays with JAX RPC supported Java types as members
JAX RPC value types user defined Java classes, including classes with
component like properties
When designing parameters for method calls in a Web service interface,
choose parameters that have standard type mappings. (See Figure 3.3.) Always
keep in mind that the portability and interoperability of your service is reduced
when you use parameter types that by default are not supported.
As Figure 3.3 shows, parameters that have standard type mappings are bound
implicitly. However, the developer must do more work when using parameters
that do not have standard type mappings. See Handling Nonstandard Type
Parameters on page 76 for more details on using nonstandard Java types and pos
sible side effects of such use.
Here are some additional helpful points to consider when you use Java objects
with standard type mappings as parameters.
1. Many applications and services need to pass lists of objects. However, utilities
for handling lists, such as
, to name a few, are not
supported standard types. Instead, Java arrays provide equivalent functional
ity, and have a standard mapping provided by the platform.
2. JAX RPC value types are user defined Java classes with some restrictions.
They have constructors and may have fields that are public, private, protected,
static, or transient. JAX RPC value types may also have methods, including set
and get methods for setting and getting Java class fields.
However, when mapping JAX RPC value types to and from XML, there is no
standard way to retain the order of the parameters to the constructors and other
methods. Hence, avoid setting the JAX RPC value type fields through the con
structor. Using the get and set methods to retrieve or set value type fields
avoids this mapping problem and ensures portability and interoperability.
3. The J2EE platform supports nested JAX RPC value types; that is, JAX RPC
value types that reference other JAX RPC value types within themselves. For