7-8 Programming Advanced Features of JAX-RPC Web Services for Oracle WebLogic Server
Follow these guidelines when programming the JWS interface file that implements the callback Web service. Code snippets of the guidelines are shown in bold in the
preceding example.
■
Import the required JWS annotation: import weblogic.jws.CallbackService;
■
Annotate the interface declaration with the CallbackService annotation to specify that the JWS file implements a callback service:
CallbackService public interface CallbackInterface {
■
Create a method that the target Web service explicitly invokes; this is the method that automatically sends a message back to the client service that originally
invoked the target Web service. Because this is a Java interface file, you do not provide an implementation of this method. Rather, the WebLogic Web services
runtime generates an implementation of the method via the jwsc Ant task.
public void callbackOperation String msg;
See JWS Annotation Reference in WebLogic Web Services Reference for Oracle WebLogic Server for additional information about the WebLogic-specific JWS annotations
discussed in this section.
7.7 Updating the build.xml File for the Client Web Service
When you run the jwsc Ant task against the JWS file that implements the client Web service, the task implicitly also generates the callback Web service, as described in this
section.
You update a build.xml file to generate a client Web service that invokes the target Web service by adding taskdefs and a build-clientService target that looks
something like the following example. See the description after the example for details.
taskdef name=jwsc classname=weblogic.wsee.tools.anttasks.JwscTask
target name=build-clientService jwsc
srcdir=src destdir={clientService-ear-dir}
jws file=exampleswebservicescallbackCallbackClientImpl.java clientgen
wsdl=http:{wls.hostname}:{wls.port}callbackTargetService?WSDL packageName=examples.webservices.callback
serviceName=TargetService
jws
Note: Although the example shows the callback method returning
void and annotated with the Oneway annotation, this is not a requirement.
Using Callbacks to Notify Clients of Events 7-9
jwsc target
Use the taskdef Ant task to define the full classname of the jwsc Ant tasks. Update the jwsc Ant task that compiles the client Web service to include a
clientgen child element of the jws element so as to generate and compile the
JAX-RPC stubs for the deployed TargetService Web service. The jwsc Ant task automatically packages them in the generated WAR file so that the client Web service
can immediately access the stubs. You do this because the CallbackClientImpl JWS file imports and uses one of the generated classes.
Because the WSDL of the target Web service includes an additional service element that describes the callback Web service which the target Web service
invokes, the clientgen child element of the jwsc Ant task also generates and compiles the callback Web service and packages it in the same EAR file as the client
Web service.
7-10 Programming Advanced Features of JAX-RPC Web Services for Oracle WebLogic Server
8
Using JMS Transport as the Connection Protocol 8-1
8
Using JMS Transport as the Connection Protocol
The following sections provide information about using JMS transport as the connection protocol:
■
Section 8.1, Overview of Using JMS Transport