Using Client-Side SOAP Message Handlers: Main Steps

9-18 Programming Advanced Features of JAX-RPC Web Services for Oracle WebLogic Server Similar to the server-side SOAP handler programming, you use an XML file to specify to the clientgen Ant task that you want to invoke client-side SOAP message handlers. However, the XML Schema of this XML file is slightly different, as described in the following procedure.

9.8.1 Using Client-Side SOAP Message Handlers: Main Steps

The following procedure describes the high-level steps to add client-side SOAP message handlers to the client application that invokes a Web service operation. It is assumed that you have created the client application that invokes a deployed Web service, and that you want to update the client application by adding client-side SOAP message handlers and handler chains. It is also assumed that you have set up an Ant-based development environment and that you have a working build.xml file that includes a target for running the clientgen Ant task. For more information, see Invoking a Web Service from a Stand-alone Client: Main Steps in Getting Started With JAX-RPC Web Services for Oracle WebLogic Server. 1. Design the client-side SOAP handlers and the handler chain which specifies the order in which they execute. This step is almost exactly the same as that of designing the server-side SOAP message handlers, except the perspective is from the client application, rather than a Web service. See Section 9.3, Designing the SOAP Message Handlers and Handler Chains . 2. For each handler in the handler chain, create a Java class that extends the javax.xml.rpc.handler.GenericHandler abstract class. This step is very similar to the corresponding server-side step, except that the handler executes in a chain in the client rather than the server. See Section 9.4, Creating the GenericHandler Class for details about programming a handler class. See Section 9.8.2, Example of a Client-Side Handler Class for an example. 3. Create the client-side SOAP handler configuration file. This XML file describes the handlers in the handler chain, the order in which they execute, and any initialization parameters that should be sent. See Section 9.8.3, Creating the Client-Side SOAP Handler Configuration File . 4. Update the build.xml file that builds your client application, specifying to the clientgen Ant task the name of the SOAP handler configuration file. Also ensure that the build.xml file compiles the handler files into Java classes and makes them available to your client application. See Section 9.8.5, Specifying the Client-Side SOAP Handler Configuration File to clientgen . 5. Rebuild your client application by running the relevant task: prompt ant build-client When you next run the client application, the SOAP messaging handlers listed in the configuration file automatically execute before the SOAP request message is sent and after the response is received. Creating and Using SOAP Message Handlers 9-19

9.8.2 Example of a Client-Side Handler Class