You can use an Ant task instead of the web services wizards
to generate a Java™ web service
for the IBM® WebSphere® JAX-WS runtime environment. Ant
tasks support both bottom-up and top-down web services development.
Before you begin
Before creating a web service, you must complete the following
prerequisites:
- Create a server and web project for your web service: Creating a JAX-WS enabled WebSphere server
- Import the Ant task and properties files into your workspace: Importing Ant files for your JAX-WS web service
- Customize the Ant properties files for your web service:
- Locate or create files, or import them into a folder of the web
project that you created, according to the type of web service that
you want to create:
- If you want to create a bottom-up service, create or import a Java bean into the src folder
- If you want to create a top-down service, locate or create a WSDL
file, or import one into the project that you created.
About this task
To create the web service, modify the Ant properties file
of the service. The name of the Ant properties file depends on the
type of web service that you want to create:
- If you want to create a bottom-up service, the name of the Ant
properties file is was_jaxws_bujava.properties.
- If you want to create a top-down service, the name of the Ant
properties file is was_jaxws_tdjava.properties.
- If you want to create a client, the name of the Ant properties
file is was_jaxws_client.properties.
Procedure
Run your Ant task in one of two
ways: - If you want to run the task in the product workspace:
- Right-click the imported web services generation XML file and
select .
- In the dialog box, click the JRE tab and
select Run in the same JRE as the workspace.
- Click Apply and then click Run.
- If you want to run the task in a command line:
- Close your workspace before running the tasks.
- Enter the following in the command line:
- Windows: wsant.bat workspace_path wsgen_path
- Linux: wsant.sh workspace_path wsgen_path
where workspace_path is the fully-qualified path to your
workspace, and wsgen_path is the fully qualified path to the
location where your web services generation file was imported. For
example your command might look like: wsant.bat D:\RationalAppDeveloper\workspace1 D:\RationalAppDeveloper\workspace1\TestProj\wsgenTemplates\was_jaxws_tdjava.xml
After your web service is generated, the console or command
line displays a
Build Successful message.
Results
When your web service is generated, the following files
will be created depending on the options you have selected and the
type of web service generated:
- Top-down: The Service Endpoint Interface (SEI). The SEI is the
annotated Java representation
of the WSDL file for the web service. This interface is used for implementing JavaBeans endpoints or creating
dynamic proxy client instances. Data types references in the SEI.
- Bottom-up: The delegate class. This is a wrapper that contains
all the methods from the Java bean
as well as the JAX-WS annotation the runtime recognizes as a web service.
Note that if you already have a bean with the @javax.jws.WebService
annotation before running the ant task that this bean will be used
as-is and new annotations will not be added.
- Request/Response/Exception wrapper classes.
Tip: The
wsant.bat file
is installed in the product's bin directory. On some systems,
this directory may be read-only. In these cases, the ant task will
not be able to create the output and the web service creation will
fail. There are two ways to correct this:
- Set your PATH to point to the bin folder, and then change to a
directory where you have write permission and run the script from
there.
- Copy the wsant.bat file to a writeable directory.