The Types Supported by JAX-RPC

printer-friendly version of this section  Print  e-mail this section  E-Mail  add a public, group or private note  Add Note  add a bookmark about this section  Add Bookmark    

Java APIs for XML Kick Start
By Aoyon Chowdhury, Parag Choudhary

Table of Contents
Chapter 11.  Working with JAX-RPC


As you learned previously, the xrpcc tool automatically creates the mapping between the Java types and the XML data types used in the WSDL document. However, not all Java types are directly supported by the JAX-RPC mechanism. Therefore, you need to know the Java types that are supported by the JAX-RPC.

The JAX-RPC specification ensures support for a number of J2SE classes and primitive data types, user-defined classes, and Java beans. The specification also provides a mechanism to support the classes that are not directly supported by JAX-RPC. We'll examine each of them now in greater detail.

Java Types Support

The Java types supported by JAX-RPC are a combination of J2SE classes and primitive data types:

  • String

  • Boolean

  • Byte

  • Double

  • Float

  • Integer

  • Long

  • Short

  • BigDecimal

  • BigInteger

  • Calendar

  • Date

  • boolean

  • byte

  • double

  • float

  • int

  • long

  • Arrays of these classes and primitive types

Application Classes

In addition to these J2SE classes and primitive data types, JAX-RPC also provides support for the application classes of your application. For example, you might have a Java application dealing with car parts inventory. In the application, you might have classes such as EngineSpecs, EngineOrder, and so on. You can use such classes while developing Web services; they're called value types in the JAX-RPC specification. However, for a Java class to be supported by the JAX-RPC specification, it must follow the following rules:

  • It must have a public default constructor.

  • It must not implement (directly or indirectly) the java.rmi.Remote interface. However, other than the java.rmi.Remote interface, it can implement any other interface or extend other Java classes.

  • It can contain public, private, protected, and package-level fields. However, for the value of a public field to be passed, it must be a supported JAX-RPC type as specified earlier, and should not be final or transient.

  • It may contain any type of methods.

  • It may contain static or transient fields.

  • If the Java class is a JavaBean component, it must have the getter and setter methods defined for each of the bean properties. Additionally, the bean properties must consist of the data types supported by JAX-RPC.

Unsupported Java Classes

There are several classes, such as the classes of the Java Collections Framework, that are not directly supported by JAX-RPC. However, the specification provides a method by which you can use pluggable serializers and deserializers to provide support for such unsupported classes. The discussion of how to provide support for these unsupported Java classes is beyond the scope of this book; for more information on this, refer to the JAX-RPC specification.

So far in this chapter, you have learned about how the JAX-RPC mechanism works along with the other necessary background details. Now you will create a simple Web service and a client that performs RPCs over the Internet using JAX-RPC as the building blocks.


printer-friendly version of this section  Print  e-mail this section  E-Mail  add a public, group or private note  Add Note  add a bookmark about this section  Add Bookmark    
Top

[0672324342/ch11lev1sec6]

 
 


JavaT APIs for XML Kick Start
JAX: Java APIs for XML Kick Start
ISBN: 0672324342
EAN: 2147483647
Year: 2002
Pages: 133

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net