Package org.jibx.ws.wsdl.tools
Class Jibx2Wsdl
java.lang.Object
org.jibx.ws.wsdl.tools.Jibx2Wsdl
Start-from-code WSDL generator using JiBX data binding. This starts from one or more service classes, each with one
or more methods to be exposed as service operations, and generates complete bindings and WSDL for the services.
Although many of the methods in this class use
public
access, they are intended for use only by the JiBX
developers and may change from one release to the next. To make use of this class from your own code, call the main(String[])
method with an appropriate argument list.- Author:
- Dennis M. Sosnoski
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final BindGen
Binding generator.private final WsdlGeneratorCommandLine
Parameter information for generation.private final SchemaGen
Schema generator.private final Map
Map from schema namespace URIs to schema holders.private static final Logger
Logger for class. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate static void
accumulateBindingDefinitions
(BindingElement binding, Map elemmap, Map typemap) Accumulate all mapping definitions, including those found in included bindings.private void
accumulateData
(ValueCustom value, Map clasmap, Set dataset) Accumulate data type(s) from value to be included in binding.addCollectionBinding
(boolean doclit, ValueCustom value, Map typemap, BindingHolder bind) Add the <mapping> definition for a typed collection to a binding.private void
addSchemaReference
(QName qname, Map namemap, SchemaHolder holder) Add reference to another schema.private ElementElement
buildValueElement
(ValueCustom parm, Map typemap, Map namemap, SchemaHolder hold) Build an element representing a parameter or return value.private Definitions
buildWSDL
(ServiceCustom service, Map ptypemap, Map classelems, Map elemschemas, Map classtypes, Map typeschemas) Build WSDL for service.private List
generate
(List classes, List extras, Map classelems, Map elemschemas, Map classtypes, Map typeschemas, Collection exists) Generate based on list of service classes.private QName
getMappingQName
(String type, MappingElement mapping) Get the qualified name used for an abstract mapping.static void
Run the WSDL generation using command line parameters.static BindingElement
processPregeneratedBinding
(URL url, Map elemmap, Map typemap) Load and validate binding and process all mapping definitions, including those in included bindings.
-
Field Details
-
s_logger
private static final Logger s_loggerLogger for class. -
m_generationParameters
Parameter information for generation. -
m_bindingGenerator
Binding generator. -
m_schemaGenerator
Schema generator. -
m_uriSchemaMap
Map from schema namespace URIs to schema holders.
-
-
Constructor Details
-
Jibx2Wsdl
Constructor.- Parameters:
parms
- generation parameters
-
-
Method Details
-
getMappingQName
Get the qualified name used for an abstract mapping. This throws an exception if the qualified name is not found.- Parameters:
type
-mapping
-- Returns:
- qualified name
-
addSchemaReference
Add reference to another schema. The reference may either be to a definition in a supplied schema (in which case it'll be in the map) or in a generated schema (in which case the namespace is used to lookup the schema).- Parameters:
qname
- referenced definition namenamemap
- map from qualified name to holder for defining schema (only for predefined schemas)holder
- schema making the reference
-
buildValueElement
private ElementElement buildValueElement(ValueCustom parm, Map typemap, Map namemap, SchemaHolder hold) Build an element representing a parameter or return value.- Parameters:
parm
-typemap
- map from parameterized type to abstract mapping qualified namenamemap
- map from qualified name to holder for defining schema (only for predefined schemas)hold
- containing schema holder- Returns:
- constructed element
-
buildWSDL
private Definitions buildWSDL(ServiceCustom service, Map ptypemap, Map classelems, Map elemschemas, Map classtypes, Map typeschemas) Build WSDL for service.- Parameters:
service
-ptypemap
- map from parameterized type to abstract mapping nameclasselems
- fully-qualified class name to element qualified name mapelemschemas
- element qualified name to schema holder mapclasstypes
- fully-qualified class name to type qualified name maptypeschemas
- type qualified name to schema holder map- Returns:
- constructed WSDL definitions
-
accumulateData
Accumulate data type(s) from value to be included in binding.- Parameters:
value
-clasmap
- map with classes to be excluded as keysdataset
- set of types for binding
-
addCollectionBinding
public QName addCollectionBinding(boolean doclit, ValueCustom value, Map typemap, BindingHolder bind) Add the <mapping> definition for a typed collection to a binding. This always creates an abstract mapping with the type name based on both the item type and the collection type, except in the case where an array is being used in unwrapped (non-plain doc/lit) form.- Parameters:
doclit
- plain doc/lit handling flagvalue
- collection valuetypemap
- map from parameterized type to abstract mapping namebind
- target binding- Returns:
- qualified name for collection
-
generate
private List generate(List classes, List extras, Map classelems, Map elemschemas, Map classtypes, Map typeschemas, Collection exists) throws JiBXException, IOException Generate based on list of service classes.- Parameters:
classes
- service class listextras
- list of extra classes for bindingclasselems
- fully-qualified class name to element qualified name mapelemschemas
- element qualified name to schema element mapclasstypes
- fully-qualified class name to type qualified name maptypeschemas
- type qualified name to schema element mapexists
- existing schemas potentially referenced- Returns:
- list of WSDLs
- Throws:
JiBXException
IOException
-
accumulateBindingDefinitions
Accumulate all mapping definitions, including those found in included bindings. For each named abstract mapping found, the class name is associated with the type name in the type map; for each concrete mapping found, the class name is associated with the element name in the element map. Included bindings are handled with recursive calls.- Parameters:
binding
- binding definition rootelemmap
- map from fully-qualified class name to element qualified nametypemap
- map from fully-qualified class name to type qualified name
-
processPregeneratedBinding
public static BindingElement processPregeneratedBinding(URL url, Map elemmap, Map typemap) throws JiBXException, IOException Load and validate binding and process all mapping definitions, including those in included bindings.- Parameters:
url
- binding definition pathelemmap
- map from element qualified name to class datatypemap
- map from type qualified name to class data- Returns:
- binding
- Throws:
JiBXException
IOException
-
main
Run the WSDL generation using command line parameters.- Parameters:
args
-- Throws:
JiBXException
IOException
-