WsGen is a new JOnAS tool that works in the same way as GenIC. It takes an archive file (EJB-JAR, WAR, JAR client, or EAR) and generates all the necessary Web Services files:
Creates vendor-specific Web Services deployment files for the server side and, when needed, the client side (Axis will use its own WSDD format).
Creates a Web Application for each EJB-JAR exposing Web Service.
Generates and compiles client-side artifacts (Services and Port Bindings implementation classes).
For example, to provide an EJB-exposing method as a Web Service, a developer creates a webservices.xml file packaged in EJB-JAR's META-INF directory. WsGen automatically creates a configured Web Application (using an Axis servlet) and wraps it (ejbjar + webapp) in an EAR file.
With a JaxRpc class, WsGen adds a servlet (an Axis servlet) inside the existing web deployment descriptor and generates an Axis-specific configuration file.
When using service-ref (from EJB-JARs, Web Applications, or clients), WsGen automatically generates a stub from WSDL (if a generated service interface name is provided).
WsGen is used usually from an ant build file. Simply add this taskdef under the EJB-JAR taskdef:
<taskdef name="wsgen" classname="org.objectweb.jonas.ant.WsGenTask" classpath="${jonas.root}/lib/common/ow_jonas_ant.jar" /> <wsgen srcdir="${temp.dir}" destdir="${dist.dir}" verbose="false" debug="false"> <include name="webapps/wswarsample.war"/> </wsgen> |
See the $JONAS_ROOT/examples/webservices samples for complete build scripts.
Note that the EJB-JAR/Web Application/client archive must include WSDL, jax-rpc-mappings used in service-ref, or webservices.xml. When these files are used from a service-ref, they are added into the generic EJB-JAR with the EJB-JAR Ant task of JOnAS; you must ensure that they have been placed inside the srcdir given to the EJB-JAR task (otherwise, the EJB-JAR task cannot find them and will produce an error).
This task is a directory-based task and, as such, forms an implicit fileset (see http://ant.apache.org/manual/index.html. This defines which files, relative to the srcdir, will be processed. The WsGen task supports all the attributes of fileset to refine the set of files to be included in the implicit fileset.
Attribute | Description | Required |
---|---|---|
srcdir | Directory where file archive (EJB-JAR, WAR, Client, EAR) can be found. | Yes |
destdir | Directory where generated files will be placed | No |
verbose | Verbose mode (Defaults to false) | No |
debug | Debug mode (Defaults to false) | No |
javacopts | List of options given to the Java compiler | No |
jonasroot | Directory where JOnAS is installed | No |
jonasbase | Directory where JOnAS configuration is stored | No |
Table 29-1. wsgen Task Support
Wsgen is also usable from the command line with WsGen script (available on *nix and Windows).