How-To: Developing a Web Service From a Web Service Description
Language (WSDL) Document
The Oracle Application Server provides the facilities for generating a
web service from an existing Web Service Description Language (WSDL)
document. This top-down approach, although not as simple as the
bottom-up approach (exposing an existing class as a web service), is
preferable for a number of reasons:
Careful consideration of the operations and messages you will
expose leads to much more usable and maintainable web services.
Implementation artifacts are much less likely to be exposed by
the web service, and
Interoperability with other web services is much more likely
given that the developer has much more control over the WSDL.
The process of generating a web service from a WSDL document and
creating an
associated client application involves:
Generating a service endpoint interface (SEI) from the
WSDL. This interface exposes the
functionality and operations defined in the WSDL.
Creating a service implementation comprised of an SEI
implementation class and supporting classes. These classes simply
provide implementations for each of the methods declared in the
service interface. In this example the implementation class will
instantiate, and delegate method calls to, an underlying bank object.
Packaging the service as an application module. The service
classes and all associated generated artifacts are packaged up as
standard J2EE deployment modules.
Deploying the service. The service module is deployed to
the Oracle Application Server.
Generating the client proxies. Client proxies/stubs are
generated from the WSDL file for the deployed service.
Writing a client application. An application is written
that leverages the client proxies to invoke remote service operations.
Admittedly, the argument could be made that it may be simpler to simply
modify the underlying implementation class and expose it directly as a
web service
by having it implement the SEI (removing the requirement for creating
the service implementation class
as noted above). Although that is a possibility the more general,
and potentially more frequent, case is that the existing class can not
be modified. Rather, the functionality provided by the existing
class needs to be exposed to remote clients without alteration to the
target class. It is this scenario we will explore in the
following sample.