EJB2WebService tool reference
You can use the EJB2WebService tool from a command line to generate a Web service from an EJB bean using the IBM WebSphere run-time environment. The EJB2WebService13 command supports EJB v2.0 and J2EE 1.3, while the EJB2WebService command supports EJB 2.1 and J2EE 1.4.
Syntax
Once you have set up your command line, you can use the following syntax and arguments to run the tool:
- Windows: EJB2WebService [<optional arguments>] -project <ProjectName> -ri <RemoteInterface> <EJB.ear>
- Linux: EJB2WebService.sh [<optional arguments>] -project <ProjectName> -ri <RemoteInterface> <EJB.ear>
Note: <EJB.ear> must be the final argument.
Arguments
Mandatory arguments:
- -project
- Specifies the project name. This is used to create a directory under the current working directory in which to store all the generated files. If the project name already exists, a backup copy of the existing EAR file is created. For example, if you have a project named MyWebService, then MyWebService.ear file would be renamed to MyWebService.ear.backup.
- -ri
- Specifies the name of the enterprise bean's remote interface. This must be a fully-qualified package name, for example, com.ibm.wsdk.testing.TestBeanRemote.
- <EJB.ear>
- Specifies the fully-qualified path name of the existing EAR file. This file contains at least one EJB module JAR file. Compile the EJB class using the -g option so that the part name attributes in the generated WSDL file will contain the correct parameter names for the methods.
Optional arguments:
- -methods <method list>
- Specifies which public, non-static methods in the enterprise bean to expose in the Web service. The default is to include all of these methods. The methods in the <method list> must be separated by spaces.
- -clientType <J2SE | Application | Servlet | EJB>
- Generates a skeleton implementation class for the type of client specified. You can only use this argument in conjunction with the -genMain argument. You cannot use this argument if you have already specified the -server-side-only argument.
- -genMain <name of main class>
- Specifies the name of the main class to generate. You can only use this argument in conjunction with the -clientType argument. You cannot use this argument if you have already specified the -server-side-only argument.
- -host <hostName:portNumber>
- Specifies the host name and port number. The default value is localhost:6080.
- -contextRoot <ContextRoot>
- Specifies the context root for the Web Service. The default value for this is <ProjectName>.
- -servicePortName <PortName>
- Specifies the port name for the Web Service. The default value for this is the name of the EJB bean.
Use the arguments -host, -contextRoot, and -servicePortName to specify the URL of the service endpoint. The format is as follows: http://hostName:portNumber/<ContextRoot>/services/<PortName>.
- -sei <interface.java>
- Specifies the fully-qualified path name of a prewritten Service Endpoint Interface (Java source code file). If a path name is not specified, the tool dynamically generates one at run time.
- -server-side-only
- Generates server-side helper classes only. The default is to generate server-side as well as client-side helper classes.
- -clientEJBName <EJB client filename>
- Uses the information in the client EJB file to configure the client-side webservicesclient.xml descriptor with the name of the client application. If you do not supply this argument, edit webservicesclient.xml manually before adding it to the client EJB file.
- -style <style type>
- Generates WSDL with style rpc, doc, or wrapped as specified by <style type>. The default style is Wrapped.
- -use <bindings>
- Generates WSDL with either literal or encoded bindings as specified by <bindings>. The default is literal.
- -splitWsdl
- Generates separate interface and implementation WSDL documents that are not deployed. The default is the creation of a single document combining both interface and implementation information.
Important: If you select to use this 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.
- - wsSecDir <directory>
- Specifies the full path to a directory containing templates to configure the generated deployment descriptors with WS-Security information. The directory must contain ibm-webservices-bnd.xmi and ibm-webservices-ext.xmi files, and also ibm-webservicesclient-bnd.xmi and ibm-webservicesclient-ext.xmi if generating client-side bindings.
- -PkgtoNS <package> <namespace>
- Indicates the mapping of a Java package to a namespace. If a package is found that does not have a namespace, a suitable namespace name is generated. This argument can be repeated to specify mappings for multiple packages.
- -voidReturn [ONEWAY | TWOWAY]
- Indicates whether you want a void return method to be a request/response operation (the default) or a one-way operation.
- -verbose
- Displays extra information as the tool runs.
- -help
- Displays the help information.
Note: The -deploy option is not supported.
Parent topic
Creating a Web service using the EJB2WebService tool
Related Tasks
Creating a Web service using the EJB2WebService toolRelated Reference
WSDL document.">Java2WSDL tool reference