Package org.apache.wsil.util
Class WSDLDocument
java.lang.Object
org.apache.wsil.util.WSDLDocument
Provides an easy way to read and write information to and from
WSDL documents.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected static final String
Class name.static final String
static final String
static final String
static final String
WSDL related namespaces.static final String
WSDL factory classprotected static javax.wsdl.WSDLException
protected static javax.wsdl.factory.WSDLFactory
-
Constructor Summary
ConstructorsConstructorDescriptionWSDLDocument
(Reader reader) Constructs a new WSDL document from the specified Reader.WSDLDocument
(String fileName) Constructs a new WSDL document from the specified file.WSDLDocument
(URL documentURL) Constructs a new WSDL document from the specified URL.WSDLDocument
(javax.wsdl.Definition definition) Constructs a new WSDL document from a UDDI businessService.WSDLDocument
(Document document) Constructs a new WSDL document from a Document DOM. -
Method Summary
Modifier and TypeMethodDescriptionFind the Service Interface document which this Service Implementation document references.javax.wsdl.Binding[]
Get all the binding elements from the WSDL document.javax.wsdl.Definition
Get the definition element of the WSDL document.javax.wsdl.Import[]
Get all the import elements from the WSDL document.javax.wsdl.Message[]
Get all the message elements from the WSDL document.javax.wsdl.PortType[]
Get all the portType elements from the WSDL document.javax.wsdl.Service[]
Get all the service elements from the WSDL document.static javax.wsdl.xml.WSDLReader
Constructs a WSDLReader Set verbose option off.static javax.wsdl.xml.WSDLReader
getWSDLReader
(boolean imports) Constructs a WSDLReader Set verbose option off.static javax.wsdl.xml.WSDLWriter
Constructs a WSDLWriterboolean
Check if this document is both a service interface and a service implementation.boolean
Check if this document is a service implementation.boolean
Check if this document is a service interface.boolean
Check if this document is a service interface with bindings only.static void
Command line interface for validating WSDL documents.void
Read the information contained in a WSDL file.void
Read the information contained in a WSDL fileGenerate an XML string that represents the WSDL document content.toString()
Return string representation of this object.void
Write the WSDL document content to the specified writer.void
Write the WSDL document to the specified file.
-
Field Details
-
className
Class name.- See Also:
-
NS_URI_XSD
WSDL related namespaces.- See Also:
-
NS_URI_WSDL_SOAP
- See Also:
-
NS_URI_WSDL_HTTP
- See Also:
-
NS_URI_WSDL_MIME
- See Also:
-
WSDL_FACTORY
WSDL factory class- See Also:
-
wsdlFactory
protected static javax.wsdl.factory.WSDLFactory wsdlFactory -
wsdlException
protected static javax.wsdl.WSDLException wsdlException
-
-
Constructor Details
-
WSDLDocument
Constructs a new WSDL document from the specified file.- Parameters:
fileName
- The name of the WSDL file to be read. Specify either the full path to the file, or a URL address.- Throws:
javax.wsdl.WSDLException
- if the WSDL document cannot be created.
-
WSDLDocument
Constructs a new WSDL document from the specified URL.- Parameters:
documentURL
- the URL where the WSDL document is located- Throws:
javax.wsdl.WSDLException
- if the WSDL document cannot be created.
-
WSDLDocument
Constructs a new WSDL document from the specified Reader.- Parameters:
reader
- the reader that will be used to get the contents of the WSDL document- Throws:
javax.wsdl.WSDLException
- if the WSDL document cannot be created.
-
WSDLDocument
Constructs a new WSDL document from a Document DOM.- Parameters:
document
- A parsed XML document that conforms to the WSDL schema.- Throws:
javax.wsdl.WSDLException
- if the WSDL document cannot be created.
-
WSDLDocument
public WSDLDocument(javax.wsdl.Definition definition) throws javax.wsdl.WSDLException Constructs a new WSDL document from a UDDI businessService.- Parameters:
definition
- A WSDL definition element.- Throws:
javax.wsdl.WSDLException
- if the WSDL document cannot be created.
-
-
Method Details
-
getWSDLReader
public static javax.wsdl.xml.WSDLReader getWSDLReader() throws javax.wsdl.WSDLExceptionConstructs a WSDLReader Set verbose option off. Sets reslove imports off.- Throws:
javax.wsdl.WSDLException
- if the WSDL document cannot be created.
-
getWSDLReader
public static javax.wsdl.xml.WSDLReader getWSDLReader(boolean imports) throws javax.wsdl.WSDLException Constructs a WSDLReader Set verbose option off.- Parameters:
imports
- set to true if imports are to be reslolved, false if not.- Throws:
javax.wsdl.WSDLException
- if the WSDL document cannot be created.
-
getWSDLWriter
public static javax.wsdl.xml.WSDLWriter getWSDLWriter() throws javax.wsdl.WSDLExceptionConstructs a WSDLWriter- Throws:
javax.wsdl.WSDLException
- if the WSDL document cannot be created.
-
read
Read the information contained in a WSDL file.- Parameters:
fileName
- The name of the WSDL file to be read. Specify either the full path to the file, or a URL address.- Throws:
javax.wsdl.WSDLException
- if a error occurs processing the file.
-
read
Read the information contained in a WSDL file- Parameters:
fileName
- the name of the WSDL file to be read. Specify either the full path to the file, or a URL address.imports
- true if imports in the WSDL file should be resolved- Throws:
javax.wsdl.WSDLException
- if an error occurs processing the file.
-
write
Write the WSDL document to the specified file.- Parameters:
fileName
- The name of the file to write to.
-
write
Write the WSDL document content to the specified writer.- Parameters:
writer
- The Writer to use.
-
serializeToXML
Generate an XML string that represents the WSDL document content.- Returns:
- String The string containing this document serialized as XML.
-
getDefinitions
public javax.wsdl.Definition getDefinitions()Get the definition element of the WSDL document.- Returns:
- The definition element
-
getMessages
public javax.wsdl.Message[] getMessages()Get all the message elements from the WSDL document.- Returns:
- The list of message elements.
-
getPortTypes
public javax.wsdl.PortType[] getPortTypes()Get all the portType elements from the WSDL document.- Returns:
- The list of portType elements.
-
getBindings
public javax.wsdl.Binding[] getBindings()Get all the binding elements from the WSDL document.- Returns:
- The list of binding elements.
-
getImports
public javax.wsdl.Import[] getImports()Get all the import elements from the WSDL document.- Returns:
- The list of import elements.
-
getServices
public javax.wsdl.Service[] getServices()Get all the service elements from the WSDL document.- Returns:
- The list of service elements.
-
isServiceInterface
public boolean isServiceInterface()Check if this document is a service interface. That means it must contain Message, PortType and Binding elements.- Returns:
- true if Message, PortType and Binding elements are all found; false otherwise
-
isServiceInterfaceWithBindingsOnly
public boolean isServiceInterfaceWithBindingsOnly()Check if this document is a service interface with bindings only. That means it must contain Binding elements only.- Returns:
- true if Binding element is found; false otherwise
-
isServiceImplementation
public boolean isServiceImplementation()Check if this document is a service implementation. That means it must contain at least one Import and one Service element. No attempt is made to verify the content of any imported document.- Returns:
- true if at least one Import and one Service element is found; false otherwise
-
isCompleteServiceDefinition
public boolean isCompleteServiceDefinition()Check if this document is both a service interface and a service implementation. That means it must contain Message, PortType, Binding and Service elements.- Returns:
- true if Message, PortType, Binding and Service elements are all found; false otherwise
-
findServiceInterface
Find the Service Interface document which this Service Implementation document references. A Service Implementation document is expected to contain an Import statement that references the Service Interface document.- Returns:
- WSDLDocument the Service Interface document. A null is returned if the source document is not a service implementation document or we didn't find an import for a service implementation document.
- Throws:
javax.wsdl.WSDLException
- if an error occurs while reading an imported document.
-
toString
Return string representation of this object. -
main
Command line interface for validating WSDL documents.
-