Before you begin
Note: There are two versions of the EJB2WebService tool. If
you run the
EJB2WebService command, the command
will use J2EE 1.4. Alternately you can use the
EJB2WebService13 command
which will use J2EE 1.3. For any of the commands below you can substitute
EJB2WebService13 instead
of
EJB2WebService if you want to create a web
service that uses J2EE 1.3.
About this task
To create a web service using the EJB2WebService tool,
enter the following in the command prompt:
Procedure
- Windows: EJB2WebService [<optional arguments>] -project <ProjectName>
-ri <RemoteInterface> <EJB.ear>
- Linux: EJB2WebService.sh
[<optional arguments>] -project <ProjectName> -ri <RemoteInterface> <EJB.ear>
Results
Note: <EJB.ear> must be the final argument.
See The EJB2WebService tool for
a list of optional and mandatory arguments.
Hints: - It is recommended that you specify the optional argument: -host <hostname:port>.
The default port for the command is 6080, but the default WebSphere Application Server
port is 9080.
- Note the command line test directory path and the name that you
specify for -project. You will need this information to deploy
and test your web service.
Example
This is an example of how to use
the EJB2WebService tool:
EJB2WebService -host localhost:9080 -ri MyEJB.remoteInterface -project MyEJBProject MyEJB.ear
The main output of the EJB2WebService tool is a modified
version of the original EAR file called <ProjectName>EAR.ear in
the root of the generated directory structure. The META-INF directory
is also generated under <ProjectName>. This directory holds the
generated WSDL file, Java™ classes,
and so on. If you do not specify the -server-side-only argument, a
client-side directory that contains some extra Java files, including serializer and deserializer
classes for your complex types, will also be created.
Once you
have generated an EAR file, you can deploy it to a server to make
it available to others.
What to do next
Important: If you select to use the -splitWsdl
argument the EAR file will be generated but an exception will occur
during server start-up once it is imported to the workspace and deployed
to the Unit Test Environment or a remote server. This exception is
caused by a missing WSDL in the router Web project. To counteract
this error do any of the following:
- Deploy to a stand-alone WebSphere Application
Server using the Admin Console.
- Use a monolithic WSDL - that is, do not use the -splitWsdl argument.
- Manually copy all WSDL files under the META-INF/wsdl directory
in the EJB project to the WEB-INF/wsdl of the
router Web project.