Bean2WebService tool reference

You can use the Bean2WebService tool from a command line to generate a Web service from a Java™ bean using the IBM® WebSphere® run-time environment.

Syntax

Once you have set up your command line, you can use the following syntax and arguments to run the tool: 

Note: <BeanName> must be the final argument.

Arguments

Mandatory arguments:

-project <ProjectName>
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 the MyWebService.ear file would be renamed MyWebService.ear.backup.
-cp <ClassPath>
Specifies a list of JAR files and directories (separated by the platform-specific path delimiter character) that contains the Java bean and all of the dependencies required to make it run.
<BeanName>
Specifies the fully-qualified package name of the compiled Java class that will be exposed as a Web service. Compile the Java class using the
-g option so that the part name attributes in the generated WSDL file is to contain the correct parameter names for the methods.

Optional arguments:

-methods <method list>
Specifies which public, non-static methods in the Java 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.
-voidReturn [ONEWAY | TWOWAY]
Indicates whether you want a void return method to be a request/response operation (the default) or a one-way operation.
-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 is <ProjectName>.
-servicePortName <PortName>
Specifies the port name for the Web service. The default value is the name of the Java 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 <endpoint interface>
Specifies the fully-qualified path name of a prewritten Service Endpoint Interface (Java source code file). If none is 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 option, you must 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. Note that if you set -style=DOC unwrapped WSDL will be generated.
-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.
- 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.
-verbose
Displays extra information as the tool runs.
-help
Displays the help information.

Note: the -deploy option is not supported.


Feedback