3-8 Getting Started With JAX-RPC Web Services for Oracle WebLogic Server
■
WSDLC_Generated_JAR refers to the JAR file generated by the wsdlc Ant task that contains the JWS SEI and data binding artifacts that correspond to an existing
WSDL file.
■
WebService_type specifies the type of Web Service. This value can be set to
JAXWS or JAXRPC. The required taskdef element specifies the full class name of the jwsc Ant task.
Only the srcdir and destdir attributes of the jwsc Ant task are required. This means that, by default, it is assumed that Java files referenced by the JWS file such as
JavaBeans input parameters or user-defined exceptions are in the same package as the JWS file. If this is not the case, use the sourcepath attribute to specify the top-level
directory of these other Java files. See jwsc in Oracle Fusion Middleware WebLogic Web Services Reference for Oracle WebLogic Server for more information.
3.6.1 Examples of Using jwsc
The following build.xml excerpt shows a basic example of running the jwsc Ant task on a JWS file:
taskdef name=jwsc classname=weblogic.wsee.tools.anttasks.JwscTask
target name=build-service jwsc
srcdir=src destdir=outputhelloWorldEar
jws file=exampleswebserviceshello_worldHelloWorldImpl.java
type=JAXRPC jwsc
target
In the example:
■
The Enterprise application will be generated, in exploded form, in outputhelloWorldEar
, relative to the current directory.
■
The JWS file is called HelloWorldImpl.java, and is located in the srcexampleswebserviceshello_world
directory, relative to the current directory. This implies that the JWS file is in the package
examples.webservices.helloWorld .
■
A JAX-RPC Web Service is generated. The following example is similar to the preceding one, except that it uses the
compiledWsdl attribute to specify the JAR file that contains wsdlc-generated
artifacts for the starting with WSDL use case: taskdef name=jwsc
classname=weblogic.wsee.tools.anttasks.JwscTask target name=build-service
jwsc srcdir=src
destdir=outputwsdlcEar jws
Note: You specify this attribute only in the starting from WSDL use
case; this procedure is described in Section 3.4, Developing WebLogic
Web Services Starting From a WSDL File: Main Steps.
Developing WebLogic Web Services 3-9
file=exampleswebserviceswsdlcTemperaturePortTypeImpl.java compiledWsdl=outputcompiledWsdlTemperatureService_wsdl.jar
type=JAXRPC jwsc
target
In the preceding example, the TemperaturePortTypeImpl.java file is the stubbed-out JWS file that you updated to include your business logic. Because the
compiledWsdl attribute is specified and points to a JAR file, the jwsc Ant task does
not regenerate the artifacts that are included in the JAR. To actually run this task, type at the command line the following:
prompt ant build-service
3.6.2 Advanced Uses of jwsc
This section described two very simple examples of using the jwsc Ant task. The task, however, includes additional attributes and child elements that make the tool very
powerful and useful. For example, you can use the tool to:
■
Process multiple JWS files at once. You can choose to package each resulting Web Service into its own Web application WAR file, or group all of the Web Services
into a single WAR file.
■
Specify the transports HTTPHTTPSJMS that client applications can use when invoking the Web Service, possibly overriding any existing WLXXXTransport
annotations.
■
Automatically generate the JAX-RPC client stubs of any other Web Service that is invoked within the JWS file.
■
Update an existing Enterprise Application or Web application, rather than generate a completely new one.
See jwsc in the Oracle Fusion Middleware WebLogic Web Services Reference for Oracle WebLogic Server for complete documentation and examples about the jwsc Ant task.
3.7 Running the wsdlc WebLogic Web Services Ant Task