The following discussion assumes a basic understanding of
Web services.
When a web service is invoked in a request/response
paradigm, the flow of control is as follows:
The arguments are marshalled (serialized) at the client side and sent through
the wire
The SOAP RPC Servlet unmarshalls (deserializes) the argument and calls
the Web service implementation
The Web service implementation processes the arguments and returns a response
The SOAP RPC Servlet marshalls the response and returns the response to
the caller
On the client side, the response is unmarshalled.
Now we will discuss about how to write web services with complex
mapping.
Description
Consider a Web service that takes a custom type as parameter called
CarBookingDetails. You can find the implementation of this service here.
public void bookCar(CarBookingDetails details){
...
}
where the definition of CarBookingDetails is as follows.
public class CarBookingDetails implements java.io.Serializable{
public int m_hotelID; // Hotel from where the car is booked
public Date m_startDate; // Arrival Date
public Date m_endDate; // End Date
public int m_carType; // Room Type
....
}
You can find the complete listing of the CarBookingDetails
type here.
The part of the exposed WSDL consisting the complex type is shown
below.
where oracle_utils_CarBookingDetails is the package definition of
the CarBookingDetails class. You can find the complete listing of the WSDL
here.
This WSDL is automatically generated by Oracle9iAS by entering the URI
of the Web service and passing in the parameter of WSDL. In this example,
a sample URI might be xxx and the WSDL could be generated by entering http://<Your_Server>:<Port>/<webbinding>/endpointuri?wsdl
in
your favorite browser.
Oracle9iAS J2EE Web services doesn't require the application developers
to write serializers for custom/complex data types. Nor only does Oracle9iAS
provides server side serialization for complex datatypes, but also provides
help for client side developers. It helps by generating a Java client that
serializes complex types from the client side into SOAP messages. This
can be done by entering http://<Your_Server>:<Port>/<webbinding>/endpointuri?proxy_source
in your browser. As how a simple web service is deployed as a standard
J2EE EAR file, a web service using complex data types can also be deployed
as a standard J2EE EAR file.
Deployment of Web services can be done using standard command line tools
or through Oracle9i JDeveloper. From JDeveloper 9.0.3, developers can build
Web services using complex data types with ease. For building Web services
using complex types with Oracle9i JDeveloper 9.0.2, please look at the
online help document
available on OTN.
Now the service is available for consumption. At the client side, stubs
are required to access this Web service. You can find a fully functional
Web service sample using complex data types here.
Click on Examples -> Oracle9iAS Web Services.
Note : Oracle9i JDeveloper makes development of Web services
simpler. It also facilitates the generation of WSDL files, stubs through
a wizard based interface. You can download Oracle9i JDeveloper from here.