wsdl2Java  Security commands

Chapter 8: Using wstool, wstkeytool, wstant, and wstkeytoolant

java2Wsdl

Description

Generates code for client side artifacts from the Java class file, where locationURL and JavaClassName are the URL and name of the Java class file from which the WSDL is being generated.

Syntax

Command line:

java2wsdl 
[-binding binding_name ] 
[-classpath path ] 
[-exposeMethods m1, m2, m3 ] 
[-extraClass class1, class2, class3 ] 
[-importURL wsdl_interface ] 
[-impINS implementation_namespace ] 
[-implWSDL implementation_wsdl_filename ] 
[-implClass class_name ] 
[-inheritMethods  true | false] 
[-inputSchema file_or_url ] 
[-inputWSDL WSDL_file ] 
[-intfNS interface_namespace ] 
[-outputWsdl file_name ] 
[-pkg2ns package_namespace ] 
[-portName port_name ] 
[-portTypeName class_name ] 
[-serviceName service_name ] 
[-soapAction Default | Operation | None ] 
[-stopClasses class1, class2, class3 ] 
[-style Document | RPC | Wrapped ] 
[-tm argument ] 
[-typeMappingVer 1.1 | 1.2 ] 
[-use Literal | Encoded] 
[-wsdlMode All | Interface | Implemenation ] 
[-xcludeMethods m1, m2, m3 ] 
-locationURL<service location URL> javaClassName

Ant build file:

<taskdef name="wst_antTask" classname="com.sybase.wst.wstool.ant.AntTask"/>
<target name="java2wsdl" > <wst_antTask command="java2wsdl"
[binding=“binding_name”] 
[classpath=”path] 
[exposeMethods=“m1, m2, m3 ”] 
[extraClass=“class1, class2, class3”] 
[importURL=“wsdl_interface] 
[impINS=“implementation_namespace”] 
[implWSDL=“implementation_wsdl_filename”] 
[implClass=“class_name] 
[inheritMethods=“true | false”] 
[inputSchema=“file_or_url] 
[inputWSDL=“WSDL_file”] 
[intfNS=“interface_namespace”] 
[outputWsdl=“file_name] 
[pkg2ns=“package_namespace] 
[portName=“port_name”] 
[porTypetName=“class_name”] 
[serviceName=“service_name”] 
[soapAction=“Default | Operation | None] 
[stopClasses=“class1, class2, class3 ”] 
[style=“Document | RPC | Wrapped”] 
[tm=“argument”] 
[typeMappingVer=“1.1 | 1.2”] 
[use=“Literal | Encoded”] 
[wsdlMode=“All | Interface | Implemenation”] 
[xcludeMethods=“m1, m2, m3”] 
locationURL<service location URL>=“javaClassName” >

Where:

Option

Description

binding

The binding name. The default is servicePortName value “SOAPBinding.”

classpath

Specify the classpath in quotes.

exposeMethods

A comma-separated list of methods to expose.

extraClasses

A comma-separated list of classes to be added to the type section.

importURL

The location of the interface URL.

implNS

The target namespace for the implementation WSDL.

intfNS

The target namespace.

inputWSDL

input WSDL filename.

implWSDL

The output implementation WSDL file name. Setting this option causes the wsdlMode option to be ignored.

implClass

An optional class that contains implementation of methods in class-of-portType. The debug information in the class is used to obtain the method parameter names, which are used to set the WSDL part names.

inputWsdl

The input WSDL file name.

outputWsdl

The output WSDL file name.

pkg2NS

The package to namespace value pair, in the form package=namespace.

portName

The service port name. The default is obtained from the locationURL.

portTypeName

The port type name. The default is class-of-portType.

serviceName

The service name. The default is servicePortName value “Service.”

inheritMethods

True or false. If true, expose allowed methods in inherited classes.

xcludeMethods

A comma-separated list of methods not to expose.

stopClasses

A comma-separated list of class names that stops the inheritance search even if the inheritMethods option is specified.

tm

specify the Type mapping file name, if any custom data types are being exposed. For example, the type mapping file myTMfile.map has the following contents:

t1.QName = nonbeansample:Book 
t1.Serializer =  nonbeansample.BookSerializer
t1.Deserializer =  nonbeansample.BookDeserializer
t1.SerializerFactory =  nonbeansample.BookSerFactory 
t1.DeserializerFactory =   nonbeansample.BookDeserFactory 
t1.TypeName =  nonbeansample.Book 
t1.EncodingType = http://schemas.xmlsoap.org/soap/encoding/ 
# Specify the webservice if the type 
# mappings are on the server t1.ServiceName =  myCollection/myService

typeMappingVer

The type mapping version. Valid options are 1.1 (the default) and 1.2.

soapAction

The value of the operations soapAction field. Valid values are:

Default – causes the soapAction to be set according to operations in the metadata.

Operation – forces soapAction to the name of the operation.

None – forces the soapAction to blank, which is the default.

style

The style of the binding in the WSDL. Options are “Document,” “Wrapped,” or “RPC” (the default).

use

Defines the use of the items in the binding. Options are “Literal” or “Encoded” (the default).

wsdlMode

The output WSDL mode. Valid options are All (default), Interface, or Implementation.

inputSchema

A file or URL that points to the XML schema used during WSDL generation.

Examples

Example 1

This example uses nonBeanSample as input and generates the CodeGenTest.wsdl output file:

wstool java2wsdl  -locationURL "http://localhost:8080/nonBean/services/nonBeanSample"  -pkg2ns "nonbeansample=nonbeansample" -tm tmfile.map -outputwsdl CodeGenTest.wsdl  -classpath d:\wstool\test\tm\classes nonbeansample.TestBookServiceIntf

Ant build example:

<wst_antTask command="java2wsdl" locationURL="http://${wst.host}/${wst.port}/nonBean/services/nonBeanSample" 
tm="d:\wstool\test\tm\tmfile.map" 
classpath="d:\wstool\test\classes" 
entity="nonbeansample.TestBookServiceIntf"/>




Copyright © 2005. Sybase Inc. All rights reserved. Security commands