|
WebLogic Server 7.0 Code Examples, BEA Systems, Inc. | |||||
See:
Description
| Class Summary | |
| Client | This class illustrates how to use the JAX-RPC API to dynamically invoke a
WebLogic Web service implemented with both a handler chain and the
EchoString Java class. |
| EchoString | Java class that implements the backend component of the EchoString Web service. |
| LogHandler | Class that implements a handler in the handler chain, used to access the SOAP request and response message. |
This example shows how to create a WebLogic Web service based on a handler chain and a Java backend component.
The handler chain contains a single handler called LogHandler.
This handler implements the javax.xml.rpc.handler.Handler
interface. It implements the init method with code to create
a new weblogic.logging.NonCatalogLogger object, then implements
the handleRequest and handleResponse methods to
write the request and response SOAP messages to the log file.
The Java class, EchoString, defines a single method called
echoString that takes as input a String and simply returns the same
String.
The handler chain and the Java backend component are combined in a single
Web service operation called echoString. When a client application
invokes this operation, the LogHandler handler first handles the
SOAP request by logging the SOAP message to a log file, then the
echoString method is invoked, then the handler chain takes the SOAP
response and logs it to a log file, and finally the response is sent back to the
client application.
This example does not use servicegen to generate the
web-services.xml file, but rather shows an already created deployment
descriptor that defines the LogHandler handler, the
echoString Java class backend components, and the public operation
that combines the handler chain and the backend component.
The build.xml file compiles, assembles, packages, deploys, and
runs the example.
Client.java is a dynamic client application that does not
use the WebLogic-generated client JAR file to invoke the Web service. Rather,
the client application dynamically discovers the public operations, using the
javax.xml.rpc.Call JAX-RPC API, based on the URL of the Web service.
| Additional Resources for examples.webservices.handler.log | |
| web-services.xml | The Web services deployment descriptor file that describes the handler chain,
the single handler, LogHandler, the Java backend component, and
the echoString operation that combines the handler chain and Java
component into a single public operation.
|
| application.xml | The application deployment descriptor. |
| build.xml | The Java Ant build script that compiles the handler and Java classes, creates a WAR file that contains the web-services.xml file, then packages all these components into a deployable EAR file. The build file also compiles the dynamic client application. |
The following sections describe how to build and run the example.
Before you run this example, you need:
prompt> ant
prompt> ant run
http://localhost:port/handler_log/EchoString
where
From the Web Service Home Page you can view the generated WSDL, and test the Web service to make sure it's working correctly.
|
Documentation is available at http://e-docs.bea.com/wls/docs70 |
|||||