|
|||||||||
| Home >> All >> org >> apache >> axis >> tools >> ant >> [ wsdl overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
org.apache.axis.tools.ant.wsdl
Class Wsdl2javaAntTask

java.lang.Objectorg.apache.tools.ant.ProjectComponent
org.apache.tools.ant.Task
org.apache.axis.tools.ant.wsdl.Wsdl2javaAntTask
- public class Wsdl2javaAntTask
- extends org.apache.tools.ant.Task
Create Java classes from local or remote WSDL. Mappings from namespaces to packages can be provided as nested <mapping> elements.
Proxy settings are taken from the java runtime settings of http.ProxyHost, http.ProxyPort, etc. The Ant task <setProxy> can set these. As well as the nested mapping elements, this task uses the file NStoPkg.properties in the project base directory for namespace mapping
This task does no dependency checking; files are generated whether they need to be or not. The exception to this is the Impl class, which is not overwritten if it exists. This is a safety measure. However, all other classes are generated overwriting anything that exists.
The safe way to use this task is to have it generate the java source in a build directory, then have a <copy> task selectively copy the files you need into a safe location. Again, copying into the source tree is dangerous, but a separate build/src tree is safe. Then include this separate tree in the <javac> task's src attribute to include it in the build. Implement your own implementation classes of the server stub and the test cases using the generated templates. If you want to add methods to autogenerated data types, consider subclassing them, or write helper classes.
Tip: if you <get> the wsdl, and use the <filesmatch> condition to compare the fetched wsdl with a catched copy, you can make the target that calls the axis-wsd2ljava task conditional on the WSDL having changed. This stops spurious code regeneration and follow-on rebuilds across the java source tree.
| Fields inherited from class org.apache.tools.ant.Task |
description, location, target, taskName, taskType, wrapper |
| Fields inherited from class org.apache.tools.ant.ProjectComponent |
project |
| Constructor Summary | |
Wsdl2javaAntTask()
|
|
| Method Summary | |
void |
addMapping(NamespaceMapping mapping)
add a mapping of namespaces to packages |
void |
addMappingSet(MappingSet mappingset)
add a mapping of namespaces to packages |
void |
addSysproperty(org.apache.tools.ant.types.Environment.Variable sysp)
Adds a system property that tests can access. |
org.apache.tools.ant.types.Path |
createClasspath()
set the classpath |
protected org.apache.axis.wsdl.toJava.Emitter |
createEmitter()
This factory method makes it easier to extend this Ant task with a custom Emitter, if necessary. |
org.apache.axis.wsdl.toJava.NamespaceSelector |
createNsExclude()
Adds an additional namespace to the list to be excluded from source code generation. |
org.apache.axis.wsdl.toJava.NamespaceSelector |
createNsInclude()
Adds an additional namespace to the list to be included in source code generation. |
org.apache.axis.wsdl.toJava.FactoryProperty |
createProperty()
Adds a property name/value pair for specialized JavaGeneratorFactories. |
protected org.apache.axis.wsdl.toJava.NamespaceSelector |
createSelector()
|
void |
execute()
The method executing the task |
void |
setAll(boolean parameter)
flag to generate code for all elements, even unreferenced ones default=false; |
void |
setAllowInvalidUrl(boolean b)
Set the allowInvalidURL flag. |
void |
setDebug(boolean debug)
flag for debug output; default=false |
void |
setDeployScope(java.lang.String scope)
add scope to deploy.xml: "Application", "Request", "Session" optional; |
void |
setFactory(java.lang.String parameter)
name of the Java2WSDLFactory class for extending WSDL generation functions |
void |
setFailOnNetworkErrors(boolean failOnNetworkErrors)
should the task fail the build if there is a network error? optional: defaults to false |
void |
setHelperGen(boolean parameter)
Turn on/off Helper class generation; default is false |
void |
setImplementationClassName(java.lang.String implementationClassName)
Set the name of the class implementing the web service. |
void |
setNamespaceMappingFile(java.io.File namespaceMappingFile)
set the mapping file. |
void |
setNoImports(boolean parameter)
only generate code for the immediate WSDL document, and not imports; default=false; |
void |
setNoWrapped(boolean noWrapped)
Set the noWrapped flag. |
void |
setOutput(java.io.File parameter)
output directory for emitted files |
void |
setPassword(java.lang.String password)
set any password required for BASIC authenticated access to the WSDL; optional; only used if username is set |
void |
setPrintStackTraceOnFailure(boolean printStackTraceOnFailure)
should we print a stack trace on failure? Optional, default=true. |
void |
setProtocolHandlerPkgs(java.lang.String handlerPkgs)
append any protocol handler pkgs specified with the task |
void |
setQuiet(boolean quiet)
flag for quiet output; default=false |
void |
setServerSide(boolean parameter)
emit server-side bindings for web service; default=false |
void |
setSkeletonDeploy(boolean parameter)
deploy skeleton (true) or implementation (false) in deploy.wsdd. |
void |
setTestCase(boolean parameter)
flag for automatic Junit testcase generation default is false |
void |
setTimeout(long parameter)
timeout in milliseconds for URL retrieval; default is 45 seconds. |
void |
setTypeMappingVersion(TypeMappingVersionEnum parameter)
the default type mapping registry to use. |
void |
setURL(java.lang.String parameter)
URL to fetch and generate WSDL for. |
void |
setUsername(java.lang.String username)
set any username required for BASIC authenticated access to the WSDL; optional. |
void |
setVerbose(boolean verbose)
flag for verbose output; default=false |
void |
setWrapArrays(boolean wrapArrays)
Set the wrap arrays flag - if true this will make new classes like "ArrayOfString" for literal "wrapped" arrays. |
private void |
traceNetworkSettings(int logLevel)
|
void |
traceParams(int logLevel)
trace out parameters |
private void |
traceSystemSetting(java.lang.String setting,
int logLevel)
|
protected void |
validate()
validation code |
| Methods inherited from class org.apache.tools.ant.Task |
getDescription, getLocation, getOwningTarget, getRuntimeConfigurableWrapper, getTaskName, getTaskType, getWrapper, handleErrorFlush, handleErrorOutput, handleFlush, handleInput, handleOutput, init, isInvalid, log, log, maybeConfigure, perform, reconfigure, setDescription, setLocation, setOwningTarget, setRuntimeConfigurableWrapper, setTaskName, setTaskType |
| Methods inherited from class org.apache.tools.ant.ProjectComponent |
getProject, setProject |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
verbose
private boolean verbose
debug
private boolean debug
quiet
private boolean quiet
server
private boolean server
skeletonDeploy
private boolean skeletonDeploy
testCase
private boolean testCase
noImports
private boolean noImports
all
private boolean all
helperGen
private boolean helperGen
noWrapped
private boolean noWrapped
allowInvalidURL
private boolean allowInvalidURL
factory
private java.lang.String factory
namespaceMap
private java.util.HashMap namespaceMap
output
private java.lang.String output
protocolHandlerPkgs
private java.lang.String protocolHandlerPkgs
deployScope
private java.lang.String deployScope
url
private java.lang.String url
typeMappingVersion
private java.lang.String typeMappingVersion
timeout
private long timeout
namespaceMappingFile
private java.io.File namespaceMappingFile
mappings
private MappingSet mappings
username
private java.lang.String username
password
private java.lang.String password
classpath
private org.apache.tools.ant.types.Path classpath
nsIncludes
private java.util.List nsIncludes
nsExcludes
private java.util.List nsExcludes
properties
private java.util.List properties
implementationClassName
private java.lang.String implementationClassName
commandline
private org.apache.tools.ant.types.CommandlineJava commandline
printStackTraceOnFailure
private boolean printStackTraceOnFailure
- do we print a stack trace when something goes wrong?
failOnNetworkErrors
private boolean failOnNetworkErrors
- what action to take when there was a failure and the source was some
URL
wrapArrays
private boolean wrapArrays
| Constructor Detail |
Wsdl2javaAntTask
public Wsdl2javaAntTask()
| Method Detail |
validate
protected void validate()
throws org.apache.tools.ant.BuildException
- validation code
traceParams
public void traceParams(int logLevel)
- trace out parameters
execute
public void execute()
throws org.apache.tools.ant.BuildException
- The method executing the task
setVerbose
public void setVerbose(boolean verbose)
- flag for verbose output; default=false
setDebug
public void setDebug(boolean debug)
- flag for debug output; default=false
setQuiet
public void setQuiet(boolean quiet)
- flag for quiet output; default=false
setServerSide
public void setServerSide(boolean parameter)
- emit server-side bindings for web service; default=false
setSkeletonDeploy
public void setSkeletonDeploy(boolean parameter)
- deploy skeleton (true) or implementation (false) in deploy.wsdd.
Default is false. Assumes server-side="true".
setTestCase
public void setTestCase(boolean parameter)
- flag for automatic Junit testcase generation
default is false
setHelperGen
public void setHelperGen(boolean parameter)
- Turn on/off Helper class generation;
default is false
setFactory
public void setFactory(java.lang.String parameter)
- name of the Java2WSDLFactory class for
extending WSDL generation functions
setNoImports
public void setNoImports(boolean parameter)
- only generate code for the immediate WSDL document,
and not imports; default=false;
setOutput
public void setOutput(java.io.File parameter) throws org.apache.tools.ant.BuildException
- output directory for emitted files
setProtocolHandlerPkgs
public void setProtocolHandlerPkgs(java.lang.String handlerPkgs)
- append any protocol handler pkgs specified with the task
setDeployScope
public void setDeployScope(java.lang.String scope)
- add scope to deploy.xml: "Application", "Request", "Session"
optional;
setURL
public void setURL(java.lang.String parameter)
- URL to fetch and generate WSDL for.
Can be remote or a local file.
setAll
public void setAll(boolean parameter)
- flag to generate code for all elements, even unreferenced ones
default=false;
setTypeMappingVersion
public void setTypeMappingVersion(TypeMappingVersionEnum parameter)
- the default type mapping registry to use. Either 1.1 or 1.2.
Default is 1.1
setTimeout
public void setTimeout(long parameter)
- timeout in milliseconds for URL retrieval; default is 45 seconds.
Set this to -1 to disable timeouts altogether: other negative values
are not allowed)
addMapping
public void addMapping(NamespaceMapping mapping)
- add a mapping of namespaces to packages
addMappingSet
public void addMappingSet(MappingSet mappingset)
- add a mapping of namespaces to packages
setNamespaceMappingFile
public void setNamespaceMappingFile(java.io.File namespaceMappingFile)
- set the mapping file. This is a properties file of
package=namespace order. Optional, default is to look for
a file called NStoPkg.properties in the project directory.
setFailOnNetworkErrors
public void setFailOnNetworkErrors(boolean failOnNetworkErrors)
- should the task fail the build if there is a network error?
optional: defaults to false
setPrintStackTraceOnFailure
public void setPrintStackTraceOnFailure(boolean printStackTraceOnFailure)
- should we print a stack trace on failure?
Optional, default=true.
setUsername
public void setUsername(java.lang.String username)
- set any username required for BASIC authenticated access to the WSDL;
optional.
setPassword
public void setPassword(java.lang.String password)
- set any password required for BASIC authenticated access to the WSDL;
optional; only used if username is set
setNoWrapped
public void setNoWrapped(boolean noWrapped)
- Set the noWrapped flag.
setAllowInvalidUrl
public void setAllowInvalidUrl(boolean b)
- Set the allowInvalidURL flag.
setImplementationClassName
public void setImplementationClassName(java.lang.String implementationClassName)
- Set the name of the class implementing the web service.
This is especially useful when exporting a java class
as a web service using Java2WSDL followed by WSDL2Java.
setWrapArrays
public void setWrapArrays(boolean wrapArrays)
- Set the wrap arrays flag - if true this will make new classes
like "ArrayOfString" for literal "wrapped" arrays. Otherwise it
will use "String []" and generate appropriate metadata.
createClasspath
public org.apache.tools.ant.types.Path createClasspath()
- set the classpath
createNsInclude
public org.apache.axis.wsdl.toJava.NamespaceSelector createNsInclude()
- Adds an additional namespace to the list to be included
in source code generation.
createNsExclude
public org.apache.axis.wsdl.toJava.NamespaceSelector createNsExclude()
- Adds an additional namespace to the list to be excluded
from source code generation.
createProperty
public org.apache.axis.wsdl.toJava.FactoryProperty createProperty()
- Adds a property name/value pair for specialized
JavaGeneratorFactories.
createEmitter
protected org.apache.axis.wsdl.toJava.Emitter createEmitter()
- This factory method makes it easier to extend this Ant task
with a custom Emitter, if necessary.
createSelector
protected org.apache.axis.wsdl.toJava.NamespaceSelector createSelector()
traceSystemSetting
private void traceSystemSetting(java.lang.String setting, int logLevel)
traceNetworkSettings
private void traceNetworkSettings(int logLevel)
addSysproperty
public void addSysproperty(org.apache.tools.ant.types.Environment.Variable sysp)
- Adds a system property that tests can access.
|
|||||||||
| Home >> All >> org >> apache >> axis >> tools >> ant >> [ wsdl overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
JAVADOC