You can use Ant in the Eclipse workspace to generate an
EJB (Enterprise Java™ Bean) web
service for the IBM® WebSphere® JAX-RPC 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:
- Complete the prerequisites listed for Using Ant tasks to create IBM WebSphere JAX-RPC runtime environment web services and clients.
- Locate or create files, or import them into a folder of the EJB
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 an
EJB session bean into the ejbModule 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 file and the Ant
properties file of the service. The name of the web services generation
file and Ant properties file depends on the type of web service that
you want to create:
| Scenario of web service |
Web Service Generation
File |
Properties File |
| Bottom-up EJB |
was_jaxrpc_buejb.xml |
was_jaxrpc_buejb.properties |
| Top-down EJB |
was_jaxrpc_tdejb.xml |
was_jaxrpc_tdejb.properties |
Procedure
- Edit the Ant properties file that you imported as a prerequisite
for this task:
- Ensure that the ScenarioType parameter
is set to service.
- Ensure that the Service.TypeID parameter
is set to the type of web service that you want to create, either Bottom
Up EJB or Top Down EJB.
- Set the InitialSelection parameter
to the location of your WSDL file or the Java implementation
file for your EJB session bean. (The Java implementation
file is defined as the 'ejb-class' in the ejb-jar.xml file.)
- All of the other parameters are optional. The default
values for the remaining parameters will be retrieved from the settings
and preferences for your EJB project. (For more information about
setting these parameters, see the related topics.)
Save any changes that you made to the Ant properties file.
- Run your Ant task in one of two
ways:
- If you want to run the task in the product workspace:
- Right-click the Web service generation 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_jaxrpc_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 WSDL file for the
service is created and placed in the
META-INF\wsdl folder
of your EJB project. Several deployment descriptors are placed under
the
META-INF folder:
- webservices.xml
- ibm-webservices-bnd.xmi
- ibm-webservices-ext.xmi
In addition, other deployment descriptors and Java files may be created and placed in your
EJB project, depending on the type of web service that you created.
For
more information, see the related topics: