org.apache.axis.wsdl.fromJava
Class Emitter

java.lang.Object
  |
  +--org.apache.axis.wsdl.fromJava.Emitter

public class Emitter
extends java.lang.Object

This class emits WSDL from Java classes. It is used by the ?WSDL Axis browser function and Java2WSDL commandline utility. See Java2WSDL and Java2WSDLFactory for more information.

Author:
Glen Daniels (gdaniels@macromedia.com), Rich Scheuerle (scheu@us.ibm.com)

Field Summary
static int MODE_ALL
           
static int MODE_DOC_WRAPPED
          DEPRECATED - Indicates style=wrapped use=literal
static int MODE_DOCUMENT
          DEPRECATED - Indicates style=document use=literal
static int MODE_IMPLEMENTATION
           
static int MODE_INTERFACE
           
static int MODE_RPC
          DEPRECATED - Indicates style=rpc use=encoded
 
Constructor Summary
Emitter()
          Construct Emitter.
 
Method Summary
 org.w3c.dom.Document emit(int mode)
          Generates a WSDL document for a given Class.
 void emit(java.lang.String filename)
          Generates a complete WSDL document for a given Class
 void emit(java.lang.String filename, int mode)
          Generates a WSDL document for a given Class.
 void emit(java.lang.String filename1, java.lang.String filename2)
          Generates WSDL documents for a given Class
 java.lang.String emitToString(int mode)
          Generates a String containing the WSDL for a given Class.
 java.util.Vector getAllowedMethods()
          Returns a vector of methods to export
 java.lang.String getBindingName()
          Returns the String representation of the binding name
 java.lang.Class getCls()
          Returns the Class to export
 TypeMapping getDefaultTypeMapping()
          Returns the default TypeMapping used by the service
 java.lang.String getDescription()
          Returns the service description
 java.util.Vector getDisallowedMethods()
          Return list of methods that should not be exported
 java.lang.Class[] getExtraClasses()
          Return the list of extra classes that the emitter will produce WSDL for.
 java.lang.Class getImplCls()
          Returns the implementation Class if set
 java.lang.String getImplNamespace()
          Returns the implementation namespace
 javax.wsdl.Definition getImplWSDL()
          Get implementation WSDL Definition for the current configuration parameters
 java.lang.String getImportUrl()
          Returns the String representation of the interface import location URL
 java.lang.String getInputSchema()
           
 java.lang.String getInputWSDL()
          Get the name of the input WSDL
 java.lang.String getIntfNamespace()
          Returns the interface namespace
 javax.wsdl.Definition getIntfWSDL()
          Get a interface WSDL Definition for the current configuration parameters
 java.lang.String getLocationUrl()
          Returns the String representation of the service endpoint URL
 int getMode()
          Deprecated. (use getStyle and getUse)
 java.util.Map getNamespaceMap()
          get the packagename to namespace map
 java.lang.String getPortTypeName()
          Returns the String representation of the portType name
 ServiceDesc getServiceDesc()
           
 java.lang.String getServiceElementName()
          Returns the String representation of the service element name
 java.lang.String getServicePortName()
          Returns the String representation of the service port name
 java.lang.String getSoapAction()
          Returns the soapAction option value
 java.util.ArrayList getStopClasses()
          Return the list of classes which stop inhertance searches
 Style getStyle()
          getStyle
 java.lang.String getTargetService()
          Returns the target service name
 TypeMapping getTypeMapping()
          Returns the TypeMapping used by the service
 Use getUse()
          getUse
 boolean getUseInheritedMethods()
          Indicates if the emitter will search classes for inherited methods
 javax.wsdl.Definition getWSDL()
          Get a Full WSDL Definition for the current configuration parameters
 void setAllowedMethods(java.lang.String text)
          Add a list of methods to export
 void setAllowedMethods(java.util.Vector allowedMethods)
          Add a Vector of methods to export
 void setBindingName(java.lang.String bindingName)
          Set the String representation of the binding name
 void setCls(java.lang.Class cls)
          Sets the Class to export
 void setCls(java.lang.String className)
          Sets the Class to export
 void setClsSmart(java.lang.Class cls, java.lang.String location)
          Sets the Class to export.
 void setDefaultTypeMapping(TypeMapping defaultTM)
          Sets the default TypeMapping used by the service
 void setDescription(java.lang.String description)
          Set the service description
 void setDisallowedMethods(java.lang.String text)
          Add a list of methods NOT to export
 void setDisallowedMethods(java.util.Vector disallowedMethods)
          Add a list of methods NOT to export
 void setExtraClasses(java.lang.Class[] extraClasses)
          Provide a list of classes which the emitter will produce WSDL type definitions for.
 void setExtraClasses(java.lang.String text)
          Provide a comma or space seperated list of classes which the emitter will produce WSDL type definitions for.
 void setImplCls(java.lang.Class implCls)
          Sets the implementation Class
 void setImplCls(java.lang.String className)
          Sets the implementation Class
 void setImplNamespace(java.lang.String ns)
          Set the implementation namespace
 void setImportUrl(java.lang.String importUrl)
          Set the String representation of the interface location URL for importing
 void setInputSchema(java.lang.String inputSchema)
          Set the name of the input schema
 void setInputWSDL(java.lang.String inputWSDL)
          Set the name of the input WSDL
 void setIntfNamespace(java.lang.String ns)
          Set the interface namespace
 void setLocationUrl(java.lang.String locationUrl)
          Set the String representation of the service endpoint URL
 void setMode(int mode)
          Deprecated. (use setStyle and setUse)
 void setNamespaceMap(java.util.Map map)
          Set the packagename to namespace map with the given map
 void setPortTypeName(java.lang.String portTypeName)
          Set the String representation of the portType name
 void setServiceDesc(ServiceDesc serviceDesc)
           
 void setServiceElementName(java.lang.String serviceElementName)
          Set the String representation of the service element name
 void setServicePortName(java.lang.String servicePortName)
          Set the String representation of the service port name
 void setSoapAction(java.lang.String value)
          Sets the soapAction option value
 void setStopClasses(java.util.ArrayList stopClasses)
          Adds a list of classes (fully qualified) that will stop the traversal of the inheritance tree if encounter in method or complex type generation
 void setStopClasses(java.lang.String text)
          Add a list of classes (fully qualified) that will stop the traversal of the inheritance tree if encounter in method or complex type generation
 void setStyle(java.lang.String value)
          setStyle
 void setStyle(Style value)
          setStyle
 void setTargetService(java.lang.String targetService)
          Set the target service name
 void setTypeMapping(TypeMapping tm)
          Sets the TypeMapping used by the service
 void setUse(java.lang.String value)
          setUse
 void setUse(Use value)
          setUse
 void setUseInheritedMethods(boolean useInheritedMethods)
          Turn on or off inherited method WSDL generation.
 java.lang.String writePartToMessage(javax.wsdl.Definition def, javax.wsdl.Message msg, boolean request, ParameterDesc param)
          Create a Part
 void writeWrapperPart(javax.wsdl.Definition def, javax.wsdl.Message msg, OperationDesc oper, boolean request)
          Write out the schema definition for a WRAPPED operation request or response.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

MODE_ALL

public static final int MODE_ALL
See Also:
Constant Field Values

MODE_INTERFACE

public static final int MODE_INTERFACE
See Also:
Constant Field Values

MODE_IMPLEMENTATION

public static final int MODE_IMPLEMENTATION
See Also:
Constant Field Values

MODE_RPC

public static final int MODE_RPC
DEPRECATED - Indicates style=rpc use=encoded

See Also:
Constant Field Values

MODE_DOCUMENT

public static final int MODE_DOCUMENT
DEPRECATED - Indicates style=document use=literal

See Also:
Constant Field Values

MODE_DOC_WRAPPED

public static final int MODE_DOC_WRAPPED
DEPRECATED - Indicates style=wrapped use=literal

See Also:
Constant Field Values
Constructor Detail

Emitter

public Emitter()
Construct Emitter. Set the contextual information using set* methods Invoke emit to emit the code

Method Detail

emit

public void emit(java.lang.String filename1,
                 java.lang.String filename2)
          throws java.io.IOException,
                 javax.wsdl.WSDLException,
                 org.xml.sax.SAXException,
                 javax.xml.parsers.ParserConfigurationException
Generates WSDL documents for a given Class

Parameters:
filename1 - interface WSDL
filename2 - implementation WSDL
Throws:
java.io.IOException
javax.wsdl.WSDLException
org.xml.sax.SAXException
javax.xml.parsers.ParserConfigurationException

emit

public void emit(java.lang.String filename)
          throws java.io.IOException,
                 javax.wsdl.WSDLException,
                 org.xml.sax.SAXException,
                 javax.xml.parsers.ParserConfigurationException
Generates a complete WSDL document for a given Class

Parameters:
filename - WSDL
Throws:
java.io.IOException
javax.wsdl.WSDLException
org.xml.sax.SAXException
javax.xml.parsers.ParserConfigurationException

emit

public org.w3c.dom.Document emit(int mode)
                          throws java.io.IOException,
                                 javax.wsdl.WSDLException,
                                 org.xml.sax.SAXException,
                                 javax.xml.parsers.ParserConfigurationException
Generates a WSDL document for a given Class. The WSDL generated is controlled by the mode parameter mode 0: All mode 1: Interface mode 2: Implementation

Parameters:
mode - generation mode - all, interface, implementation
Returns:
Document
Throws:
java.io.IOException
javax.wsdl.WSDLException
org.xml.sax.SAXException
javax.xml.parsers.ParserConfigurationException

emitToString

public java.lang.String emitToString(int mode)
                              throws java.io.IOException,
                                     javax.wsdl.WSDLException,
                                     org.xml.sax.SAXException,
                                     javax.xml.parsers.ParserConfigurationException
Generates a String containing the WSDL for a given Class. The WSDL generated is controlled by the mode parameter mode 0: All mode 1: Interface mode 2: Implementation

Parameters:
mode - generation mode - all, interface, implementation
Returns:
String
Throws:
java.io.IOException
javax.wsdl.WSDLException
org.xml.sax.SAXException
javax.xml.parsers.ParserConfigurationException

emit

public void emit(java.lang.String filename,
                 int mode)
          throws java.io.IOException,
                 javax.wsdl.WSDLException,
                 org.xml.sax.SAXException,
                 javax.xml.parsers.ParserConfigurationException
Generates a WSDL document for a given Class. The WSDL generated is controlled by the mode parameter mode 0: All mode 1: Interface mode 2: Implementation

Parameters:
filename - WSDL
mode - generation mode - all, interface, implementation
Throws:
java.io.IOException
javax.wsdl.WSDLException
org.xml.sax.SAXException
javax.xml.parsers.ParserConfigurationException

getWSDL

public javax.wsdl.Definition getWSDL()
                              throws java.io.IOException,
                                     javax.wsdl.WSDLException,
                                     org.xml.sax.SAXException,
                                     javax.xml.parsers.ParserConfigurationException
Get a Full WSDL Definition for the current configuration parameters

Returns:
WSDL Definition
Throws:
java.io.IOException
javax.wsdl.WSDLException
org.xml.sax.SAXException
javax.xml.parsers.ParserConfigurationException

getIntfWSDL

public javax.wsdl.Definition getIntfWSDL()
                                  throws java.io.IOException,
                                         javax.wsdl.WSDLException,
                                         org.xml.sax.SAXException,
                                         javax.xml.parsers.ParserConfigurationException
Get a interface WSDL Definition for the current configuration parameters

Returns:
WSDL Definition
Throws:
java.io.IOException
javax.wsdl.WSDLException
org.xml.sax.SAXException
javax.xml.parsers.ParserConfigurationException

getImplWSDL

public javax.wsdl.Definition getImplWSDL()
                                  throws java.io.IOException,
                                         javax.wsdl.WSDLException,
                                         org.xml.sax.SAXException,
                                         javax.xml.parsers.ParserConfigurationException
Get implementation WSDL Definition for the current configuration parameters

Returns:
WSDL Definition
Throws:
java.io.IOException
javax.wsdl.WSDLException
org.xml.sax.SAXException
javax.xml.parsers.ParserConfigurationException

writeWrapperPart

public void writeWrapperPart(javax.wsdl.Definition def,
                             javax.wsdl.Message msg,
                             OperationDesc oper,
                             boolean request)
                      throws AxisFault
Write out the schema definition for a WRAPPED operation request or response.

Parameters:
oper -
request -
AxisFault

writePartToMessage

public java.lang.String writePartToMessage(javax.wsdl.Definition def,
                                           javax.wsdl.Message msg,
                                           boolean request,
                                           ParameterDesc param)
                                    throws javax.wsdl.WSDLException,
                                           AxisFault
Create a Part

Parameters:
def -
msg -
request - message is for a request
param - ParamRep object
Returns:
The parameter name added or null
Throws:
javax.wsdl.WSDLException
AxisFault

getCls

public java.lang.Class getCls()
Returns the Class to export

Returns:
the Class to export

setCls

public void setCls(java.lang.Class cls)
Sets the Class to export

Parameters:
cls - the Class to export

setClsSmart

public void setClsSmart(java.lang.Class cls,
                        java.lang.String location)
Sets the Class to export.

Parameters:
cls - the Class to export

setCls

public void setCls(java.lang.String className)
            throws java.lang.ClassNotFoundException
Sets the Class to export

Parameters:
className - the name of the Class to export
java.lang.ClassNotFoundException

getImplCls

public java.lang.Class getImplCls()
Returns the implementation Class if set

Returns:
the implementation Class or null

setImplCls

public void setImplCls(java.lang.Class implCls)
Sets the implementation Class

Parameters:
implCls - the Class to export

setImplCls

public void setImplCls(java.lang.String className)
Sets the implementation Class

Parameters:
className - the name of the implementation Class

getIntfNamespace

public java.lang.String getIntfNamespace()
Returns the interface namespace

Returns:
interface target namespace

setIntfNamespace

public void setIntfNamespace(java.lang.String ns)
Set the interface namespace

Parameters:
ns - interface target namespace

getImplNamespace

public java.lang.String getImplNamespace()
Returns the implementation namespace

Returns:
implementation target namespace

setImplNamespace

public void setImplNamespace(java.lang.String ns)
Set the implementation namespace

Parameters:
ns - implementation target namespace

getAllowedMethods

public java.util.Vector getAllowedMethods()
Returns a vector of methods to export

Returns:
a space separated list of methods to export

setAllowedMethods

public void setAllowedMethods(java.lang.String text)
Add a list of methods to export


setAllowedMethods

public void setAllowedMethods(java.util.Vector allowedMethods)
Add a Vector of methods to export

Parameters:
allowedMethods - a vector of methods to export

getUseInheritedMethods

public boolean getUseInheritedMethods()
Indicates if the emitter will search classes for inherited methods


setUseInheritedMethods

public void setUseInheritedMethods(boolean useInheritedMethods)
Turn on or off inherited method WSDL generation.


setDisallowedMethods

public void setDisallowedMethods(java.util.Vector disallowedMethods)
Add a list of methods NOT to export

Parameters:
disallowedMethods - vector of method name strings

setDisallowedMethods

public void setDisallowedMethods(java.lang.String text)
Add a list of methods NOT to export

Parameters:
text - space separated list of method names

getDisallowedMethods

public java.util.Vector getDisallowedMethods()
Return list of methods that should not be exported


setStopClasses

public void setStopClasses(java.util.ArrayList stopClasses)
Adds a list of classes (fully qualified) that will stop the traversal of the inheritance tree if encounter in method or complex type generation

Parameters:
stopClasses - vector of class name strings

setStopClasses

public void setStopClasses(java.lang.String text)
Add a list of classes (fully qualified) that will stop the traversal of the inheritance tree if encounter in method or complex type generation

Parameters:
text - space separated list of class names

getStopClasses

public java.util.ArrayList getStopClasses()
Return the list of classes which stop inhertance searches


getNamespaceMap

public java.util.Map getNamespaceMap()
get the packagename to namespace map

Returns:
Map

setNamespaceMap

public void setNamespaceMap(java.util.Map map)
Set the packagename to namespace map with the given map

Parameters:
map - packagename/namespace Map

getInputWSDL

public java.lang.String getInputWSDL()
Get the name of the input WSDL

Returns:
name of the input wsdl or null

setInputWSDL

public void setInputWSDL(java.lang.String inputWSDL)
Set the name of the input WSDL

Parameters:
inputWSDL - the name of the input WSDL

getInputSchema

public java.lang.String getInputSchema()
Returns:
the name of the input schema, or null

setInputSchema

public void setInputSchema(java.lang.String inputSchema)
Set the name of the input schema

Parameters:
inputSchema - the name of the input schema

getLocationUrl

public java.lang.String getLocationUrl()
Returns the String representation of the service endpoint URL

Returns:
String representation of the service endpoint URL

setLocationUrl

public void setLocationUrl(java.lang.String locationUrl)
Set the String representation of the service endpoint URL

Parameters:
locationUrl - the String representation of the service endpoint URL

getImportUrl

public java.lang.String getImportUrl()
Returns the String representation of the interface import location URL

Returns:
String representation of the interface import location URL

setImportUrl

public void setImportUrl(java.lang.String importUrl)
Set the String representation of the interface location URL for importing

Parameters:
importUrl - the String representation of the interface location URL for importing

getServicePortName

public java.lang.String getServicePortName()
Returns the String representation of the service port name

Returns:
String representation of the service port name

setServicePortName

public void setServicePortName(java.lang.String servicePortName)
Set the String representation of the service port name

Parameters:
servicePortName - the String representation of the service port name

getServiceElementName

public java.lang.String getServiceElementName()
Returns the String representation of the service element name

Returns:
String representation of the service element name

setServiceElementName

public void setServiceElementName(java.lang.String serviceElementName)
Set the String representation of the service element name

Parameters:
serviceElementName - the String representation of the service element name

getPortTypeName

public java.lang.String getPortTypeName()
Returns the String representation of the portType name

Returns:
String representation of the portType name

setPortTypeName

public void setPortTypeName(java.lang.String portTypeName)
Set the String representation of the portType name

Parameters:
portTypeName - the String representation of the portType name

getBindingName

public java.lang.String getBindingName()
Returns the String representation of the binding name

Returns:
String representation of the binding name

setBindingName

public void setBindingName(java.lang.String bindingName)
Set the String representation of the binding name

Parameters:
bindingName - the String representation of the binding name

getTargetService

public java.lang.String getTargetService()
Returns the target service name

Returns:
the target service name

setTargetService

public void setTargetService(java.lang.String targetService)
Set the target service name

Parameters:
targetService - the target service name

getDescription

public java.lang.String getDescription()
Returns the service description

Returns:
service description String

setDescription

public void setDescription(java.lang.String description)
Set the service description

Parameters:
description - service description String

getSoapAction

public java.lang.String getSoapAction()
Returns the soapAction option value

Returns:
the String DEFAULT, NONE or OPERATION

setSoapAction

public void setSoapAction(java.lang.String value)
Sets the soapAction option value

Parameters:
value - must be DEFAULT, NONE, or OPERATION

getTypeMapping

public TypeMapping getTypeMapping()
Returns the TypeMapping used by the service

Returns:
the TypeMapping used by the service

setTypeMapping

public void setTypeMapping(TypeMapping tm)
Sets the TypeMapping used by the service

Parameters:
tm - the TypeMapping used by the service

getDefaultTypeMapping

public TypeMapping getDefaultTypeMapping()
Returns the default TypeMapping used by the service

Returns:
the default TypeMapping used by the service

setDefaultTypeMapping

public void setDefaultTypeMapping(TypeMapping defaultTM)
Sets the default TypeMapping used by the service

Parameters:
defaultTM - the default TypeMapping used by the service

getStyle

public Style getStyle()
getStyle

Returns:
Style setting (Style.RPC, Style.DOCUMENT, Style.WRAPPED, etc.)

setStyle

public void setStyle(java.lang.String value)
setStyle

Parameters:
value - String representing a style ("document", "rpc", "wrapped") Note that the case of the string is not important. "document" and "DOCUMENT" are both treated as document style. If the value is not a know style, the default setting is used. See org.apache.axis.enum.Style for a description of the interaction between Style/Use
NOTE: If style is specified as "wrapped", use is set to literal.

setStyle

public void setStyle(Style value)
setStyle

Parameters:
value - Style setting

getUse

public Use getUse()
getUse

Returns:
Use setting (Use.ENCODED, Use.LITERAL)

setUse

public void setUse(java.lang.String value)
setUse

Parameters:
value - String representing a use ("literal", "encoded") Note that the case of the string is not important. "literal" and "LITERAL" are both treated as literal use. If the value is not a know use, the default setting is used. See org.apache.axis.enum.Style for a description of the interaction between Style/Use

setUse

public void setUse(Use value)
setUse

Parameters:
value - Use setting

setMode

public void setMode(int mode)
Deprecated. (use setStyle and setUse)

setMode (sets style and use)


getMode

public int getMode()
Deprecated. (use getStyle and getUse)

getMode (gets the mode based on the style setting)

Returns:
returns the mode (-1 if invalid)

getServiceDesc

public ServiceDesc getServiceDesc()

setServiceDesc

public void setServiceDesc(ServiceDesc serviceDesc)

getExtraClasses

public java.lang.Class[] getExtraClasses()
Return the list of extra classes that the emitter will produce WSDL for.


setExtraClasses

public void setExtraClasses(java.lang.Class[] extraClasses)
Provide a list of classes which the emitter will produce WSDL type definitions for.


setExtraClasses

public void setExtraClasses(java.lang.String text)
                     throws java.lang.ClassNotFoundException
Provide a comma or space seperated list of classes which the emitter will produce WSDL type definitions for. The classes will be added to the current list.

java.lang.ClassNotFoundException


Copyright © 2003 Apache Web Services Project. All Rights Reserved.