org.jboss.ws.api.tools
Class WSContractConsumer
- java.lang.Object
-
- org.jboss.ws.api.tools.WSContractConsumer
public abstract class WSContractConsumer extends Object
WSContractConsumer is responsible for generating JAX-WS client and server artifacts from the specified WSDL file. To implement a client, one would use the generated ___Service.java file. For a server, one only needs to provide an implementation class that implements the generated service endpoint interface.- Author:
- Jason T. Greene, Richard Opalka
-
Field Summary
Fields Modifier and Type Field and Description static String
PROVIDER_PROPERTY
Constructor Summary
Constructors Constructor and Description WSContractConsumer()
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method and Description void
consume(String wsdl)
Generate the required artifacts using the specified WSDL.abstract void
consume(URL wsdl)
Generate the required artifacts using the specified WSDL URL.static WSContractConsumer
newInstance()
Obtain a new instance of aWSContractConsumer
.static WSContractConsumer
newInstance(ClassLoader loader)
Obtain a new instance of aWSContractConsumer
.abstract void
setAdditionalCompilerClassPath(List<String> classPath)
Sets the additional classpath to use if/when invoking the Java compiler.abstract void
setAdditionalHeaders(boolean additionalHeaders)
Enables or disables processing of implicit SOAP headers (i.e.abstract void
setBindingFiles(List<File> bindingFiles)
Specifies the JAX-WS and JAXB binding files to use on import operations.abstract void
setCatalog(File catalog)
Sets the OASIS XML Catalog file to use for entity resolution.abstract void
setClientJar(File clientJar)
Set the clientjar file nameabstract void
setEncoding(String encoding)
Sets the charset encoding to be used for generating sourcesabstract void
setExtension(boolean extension)
Enables/Disables SOAP 1.2 binding extensionabstract void
setGenerateSource(boolean generateSource)
Enables/Disables Java source generation.abstract void
setMessageStream(PrintStream messageStream)
Sets the PrintStream to use for status feedback.abstract void
setNoCompile(boolean nocompile)
Enables/Disables Java source compilation.abstract void
setOutputDirectory(File directory)
Sets the main output directory.abstract void
setSourceDirectory(File directory)
Sets the source directory.abstract void
setTarget(String target)
Set the target JAX-WS specification target.abstract void
setTargetPackage(String targetPackage)
Sets the target package for generated source.abstract void
setWsdlLocation(String wsdlLocation)
Sets the @@WebService.wsdlLocation and @@WebServiceClient.wsdlLocation attributes to a custom value.
-
Field Detail
PROVIDER_PROPERTY
public static final String PROVIDER_PROPERTY
- See Also:
- Constant Field Values
Method Detail
newInstance
public static WSContractConsumer newInstance()
Obtain a new instance of aWSContractConsumer
. This will use the current thread's context class loader to locate theWSContractConsumerFactory
implementation.- Returns:
-
a new
WSContractConsumer
instance
newInstance
public static WSContractConsumer newInstance(ClassLoader loader)
Obtain a new instance of aWSContractConsumer
. The specified ClassLoader will be used to locate theWSContractConsumerFactory
implementation- Parameters:
-
loader
- the ClassLoader to use - Returns:
-
a new
WSContractConsumer
instance
setBindingFiles
public abstract void setBindingFiles(List<File> bindingFiles)
Specifies the JAX-WS and JAXB binding files to use on import operations.- Parameters:
-
bindingFiles
- list of JAX-WS or JAXB binding files
setCatalog
public abstract void setCatalog(File catalog)
Sets the OASIS XML Catalog file to use for entity resolution.- Parameters:
-
catalog
- the OASIS XML Catalog file
setOutputDirectory
public abstract void setOutputDirectory(File directory)
Sets the main output directory. If the directory does not exist, it will be created.- Parameters:
-
directory
- the root directory for generated files
setSourceDirectory
public abstract void setSourceDirectory(File directory)
Sets the source directory. This directory will contain any generated Java source. If the directory does not exist, it will be created. If not specified, the output directory will be used instead.- Parameters:
-
directory
- the root directory for generated source code
setExtension
public abstract void setExtension(boolean extension)
Enables/Disables SOAP 1.2 binding extension- Parameters:
-
extension
- whether or not to enable SOAP 1.2 binding extension
setGenerateSource
public abstract void setGenerateSource(boolean generateSource)
Enables/Disables Java source generation.- Parameters:
-
generateSource
- whether or not to generate Java source.
setNoCompile
public abstract void setNoCompile(boolean nocompile)
Enables/Disables Java source compilation.- Parameters:
-
nocompile
- whether or not to compile Java source.
setTargetPackage
public abstract void setTargetPackage(String targetPackage)
Sets the target package for generated source. If not specified the default is based off of the XML namespace.- Parameters:
-
targetPackage
- the target package for generated source
setWsdlLocation
public abstract void setWsdlLocation(String wsdlLocation)
Sets the @@WebService.wsdlLocation and @@WebServiceClient.wsdlLocation attributes to a custom value.- Parameters:
-
wsdlLocation
- the custom WSDL location to use in generated source
setEncoding
public abstract void setEncoding(String encoding)
Sets the charset encoding to be used for generating sources- Parameters:
-
encoding
- the charset encoding to be used for generating sources
setMessageStream
public abstract void setMessageStream(PrintStream messageStream)
Sets the PrintStream to use for status feedback. The simplest example would be to use System.out.- Parameters:
-
messageStream
- the stream to use for status messages:
setAdditionalCompilerClassPath
public abstract void setAdditionalCompilerClassPath(List<String> classPath)
Sets the additional classpath to use if/when invoking the Java compiler. Typically an implementation will use the systemjava.class.path
property. So for most normal applications this method is not needed. However, if this API is being used from an isolated classloader, then it needs to be called in order to reference all jars that are required by the implementation.- Parameters:
-
classPath
- a list of strings where each entry references a single jar or directory
setAdditionalHeaders
public abstract void setAdditionalHeaders(boolean additionalHeaders)
Enables or disables processing of implicit SOAP headers (i.e. SOAP headers defined in the wsdl:binding but not wsdl:portType section.) Default is false.- Parameters:
-
additionalHeaders
- a boolean enabling processing of implicit SOAP headers
setTarget
public abstract void setTarget(String target)
Set the target JAX-WS specification target. Allowed values are 2.0, 2.1 and 2.2- Parameters:
-
target
- the JAX-WS specification version.
setClientJar
public abstract void setClientJar(File clientJar)
Set the clientjar file name- Parameters:
-
clientJar
- client Jar file name
consume
public abstract void consume(URL wsdl)
Generate the required artifacts using the specified WSDL URL. This method may be called more than once, although this is probably not desireable- Parameters:
-
wsdl
- the URL of the WSDL
consume
public void consume(String wsdl) throws MalformedURLException
Generate the required artifacts using the specified WSDL. This method may be called more than once, although this is probably not desireable. The passed string is expect to either be a valid URL, or a local file path.- Parameters:
-
wsdl
- a URL or local file path - Throws:
-
MalformedURLException
- if wsdl is not a legal URL or local file
Copyright © 2018 JBoss, by Red Hat. All rights reserved.