public class Wsdl2javaAntTask
extends org.apache.tools.ant.Task
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.
Type | Property and Description |
---|---|
FactoryProperty |
create
Adds a property name/value pair for specialized
JavaGeneratorFactories.
|
Constructor and Description |
---|
Wsdl2javaAntTask() |
Modifier and Type | Method and Description |
---|---|
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 Emitter |
createEmitter()
This factory method makes it easier to extend this Ant task
with a custom Emitter, if necessary.
|
NamespaceSelector |
createNsExclude()
Adds an additional namespace to the list to be excluded
from source code generation.
|
NamespaceSelector |
createNsInclude()
Adds an additional namespace to the list to be included
in source code generation.
|
FactoryProperty |
createProperty()
Adds a property name/value pair for specialized
JavaGeneratorFactories.
|
protected 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(String scope)
add scope to deploy.xml: "Application", "Request", "Session"
optional;
|
void |
setFactory(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?
|
void |
setHelperGen(boolean parameter)
Turn on/off Helper class generation;
default is false
|
void |
setImplementationClassName(String implementationClassName)
Set the name of the class implementing the web service.
|
void |
setNamespaceMappingFile(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(File parameter)
output directory for emitted files
|
void |
setPassword(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?
|
void |
setProtocolHandlerPkgs(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(String parameter)
URL to fetch and generate WSDL for.
|
void |
setUsername(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.
|
void |
traceParams(int logLevel)
trace out parameters
|
protected void |
validate()
validation code
|
getDescription, getLocation, getOwningTarget, getRuntimeConfigurableWrapper, getTaskName, handleErrorOutput, handleOutput, init, isInvalid, log, log, maybeConfigure, perform, setDescription, setLocation, setOwningTarget, setRuntimeConfigurableWrapper, setTaskName
protected void validate() throws org.apache.tools.ant.BuildException
org.apache.tools.ant.BuildException
- if validation failedpublic void traceParams(int logLevel)
logLevel
- to log atProject.log(java.lang.String)
public void execute() throws org.apache.tools.ant.BuildException
execute
in class org.apache.tools.ant.Task
org.apache.tools.ant.BuildException
- if validation or execution failedpublic void setVerbose(boolean verbose)
verbose
- The new verbose valuepublic void setDebug(boolean debug)
debug
- The new debug valuepublic void setQuiet(boolean quiet)
quiet
- The new quiet valuepublic void setServerSide(boolean parameter)
public void setSkeletonDeploy(boolean parameter)
public void setTestCase(boolean parameter)
public void setHelperGen(boolean parameter)
public void setFactory(String parameter)
public void setNoImports(boolean parameter)
public void setOutput(File parameter) throws org.apache.tools.ant.BuildException
org.apache.tools.ant.BuildException
public void setProtocolHandlerPkgs(String handlerPkgs)
public void setDeployScope(String scope)
public void setURL(String parameter)
public void setAll(boolean parameter)
public void setTypeMappingVersion(TypeMappingVersionEnum parameter)
parameter
- new versionpublic void setTimeout(long parameter)
public void addMapping(NamespaceMapping mapping)
public void addMappingSet(MappingSet mappingset)
public void setNamespaceMappingFile(File namespaceMappingFile)
namespaceMappingFile
- public void setFailOnNetworkErrors(boolean failOnNetworkErrors)
failOnNetworkErrors
- public void setPrintStackTraceOnFailure(boolean printStackTraceOnFailure)
printStackTraceOnFailure
- public void setUsername(String username)
username
- public void setPassword(String password)
password
- username
public void setNoWrapped(boolean noWrapped)
noWrapped
- public void setAllowInvalidUrl(boolean b)
public void setImplementationClassName(String implementationClassName)
implementationClassName
- public void setWrapArrays(boolean wrapArrays)
wrapArrays
- public org.apache.tools.ant.types.Path createClasspath()
public NamespaceSelector createNsInclude()
public NamespaceSelector createNsExclude()
public FactoryProperty createProperty()
protected Emitter createEmitter()
protected NamespaceSelector createSelector()
public void addSysproperty(org.apache.tools.ant.types.Environment.Variable sysp)
sysp
- environment variable to addCopyright © The Apache Software Foundation. All Rights Reserved.