org.apache.wsil.util
Class WSDLDocument

java.lang.Object
  extended by org.apache.wsil.util.WSDLDocument

public class WSDLDocument
extends java.lang.Object

Provides an easy way to read and write information to and from WSDL documents.


Field Summary
protected static java.lang.String className
          Class name.
static java.lang.String NS_URI_WSDL_HTTP
           
static java.lang.String NS_URI_WSDL_MIME
           
static java.lang.String NS_URI_WSDL_SOAP
           
static java.lang.String NS_URI_XSD
          WSDL related namespaces.
static java.lang.String WSDL_FACTORY
          WSDL factory class
protected static WSDLException wsdlException
           
protected static WSDLFactory wsdlFactory
           
 
Constructor Summary
WSDLDocument(Definition definition)
          Constructs a new WSDL document from a UDDI businessService.
WSDLDocument(org.w3c.dom.Document document)
          Constructs a new WSDL document from a Document DOM.
WSDLDocument(java.io.Reader reader)
          Constructs a new WSDL document from the specified Reader.
WSDLDocument(java.lang.String fileName)
          Constructs a new WSDL document from the specified file.
WSDLDocument(java.net.URL documentURL)
          Constructs a new WSDL document from the specified URL.
 
Method Summary
 WSDLDocument findServiceInterface()
          Find the Service Interface document which this Service Implementation document references.
 Binding[] getBindings()
          Get all the binding elements from the WSDL document.
 Definition getDefinitions()
          Get the definition element of the WSDL document.
 Import[] getImports()
          Get all the import elements from the WSDL document.
 Message[] getMessages()
          Get all the message elements from the WSDL document.
 PortType[] getPortTypes()
          Get all the portType elements from the WSDL document.
 Service[] getServices()
          Get all the service elements from the WSDL document.
static WSDLReader getWSDLReader()
          Constructs a WSDLReader Set verbose option off.
static WSDLReader getWSDLReader(boolean imports)
          Constructs a WSDLReader Set verbose option off.
static WSDLWriter getWSDLWriter()
          Constructs a WSDLWriter
 boolean isCompleteServiceDefinition()
          Check if this document is both a service interface and a service implementation.
 boolean isServiceImplementation()
          Check if this document is a service implementation.
 boolean isServiceInterface()
          Check if this document is a service interface.
 boolean isServiceInterfaceWithBindingsOnly()
          Check if this document is a service interface with bindings only.
static void main(java.lang.String[] args)
          Command line interface for validating WSDL documents.
 void read(java.lang.String fileName)
          Read the information contained in a WSDL file.
 void read(java.lang.String fileName, boolean imports)
          Read the information contained in a WSDL file
 java.lang.String serializeToXML()
          Generate an XML string that represents the WSDL document content.
 java.lang.String toString()
          Return string representation of this object.
 void write(java.lang.String fileName)
          Write the WSDL document to the specified file.
 void write(java.io.Writer writer)
          Write the WSDL document content to the specified writer.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

className

protected static final java.lang.String className
Class name.

See Also:
Constant Field Values

NS_URI_XSD

public static final java.lang.String NS_URI_XSD
WSDL related namespaces.

See Also:
Constant Field Values

NS_URI_WSDL_SOAP

public static final java.lang.String NS_URI_WSDL_SOAP
See Also:
Constant Field Values

NS_URI_WSDL_HTTP

public static final java.lang.String NS_URI_WSDL_HTTP
See Also:
Constant Field Values

NS_URI_WSDL_MIME

public static final java.lang.String NS_URI_WSDL_MIME
See Also:
Constant Field Values

WSDL_FACTORY

public static final java.lang.String WSDL_FACTORY
WSDL factory class

See Also:
Constant Field Values

wsdlFactory

protected static WSDLFactory wsdlFactory

wsdlException

protected static WSDLException wsdlException
Constructor Detail

WSDLDocument

public WSDLDocument(java.lang.String fileName)
             throws WSDLException
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:
WSDLException - if the WSDL document cannot be created.

WSDLDocument

public WSDLDocument(java.net.URL documentURL)
             throws WSDLException
Constructs a new WSDL document from the specified URL.

Parameters:
documentURL - the URL where the WSDL document is located
Throws:
WSDLException - if the WSDL document cannot be created.

WSDLDocument

public WSDLDocument(java.io.Reader reader)
             throws WSDLException
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:
WSDLException - if the WSDL document cannot be created.

WSDLDocument

public WSDLDocument(org.w3c.dom.Document document)
             throws WSDLException
Constructs a new WSDL document from a Document DOM.

Parameters:
document - A parsed XML document that conforms to the WSDL schema.
Throws:
WSDLException - if the WSDL document cannot be created.

WSDLDocument

public WSDLDocument(Definition definition)
             throws WSDLException
Constructs a new WSDL document from a UDDI businessService.

Parameters:
definition - A WSDL definition element.
Throws:
WSDLException - if the WSDL document cannot be created.
Method Detail

getWSDLReader

public static WSDLReader getWSDLReader()
                                throws WSDLException
Constructs a WSDLReader Set verbose option off. Sets reslove imports off.

Throws:
WSDLException - if the WSDL document cannot be created.

getWSDLReader

public static WSDLReader getWSDLReader(boolean imports)
                                throws WSDLException
Constructs a WSDLReader Set verbose option off.

Parameters:
imports - set to true if imports are to be reslolved, false if not.
Throws:
WSDLException - if the WSDL document cannot be created.

getWSDLWriter

public static WSDLWriter getWSDLWriter()
                                throws WSDLException
Constructs a WSDLWriter

Throws:
WSDLException - if the WSDL document cannot be created.

read

public void read(java.lang.String fileName)
          throws WSDLException
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:
WSDLException - if a error occurs processing the file.

read

public void read(java.lang.String fileName,
                 boolean imports)
          throws WSDLException
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:
WSDLException - if an error occurs processing the file.

write

public void write(java.lang.String fileName)
Write the WSDL document to the specified file.

Parameters:
fileName - The name of the file to write to.

write

public void write(java.io.Writer writer)
Write the WSDL document content to the specified writer.

Parameters:
writer - The Writer to use.

serializeToXML

public java.lang.String serializeToXML()
Generate an XML string that represents the WSDL document content.

Returns:
String The string containing this document serialized as XML.

getDefinitions

public Definition getDefinitions()
Get the definition element of the WSDL document.

Returns:
The definition element

getMessages

public Message[] getMessages()
Get all the message elements from the WSDL document.

Returns:
The list of message elements.

getPortTypes

public PortType[] getPortTypes()
Get all the portType elements from the WSDL document.

Returns:
The list of portType elements.

getBindings

public Binding[] getBindings()
Get all the binding elements from the WSDL document.

Returns:
The list of binding elements.

getImports

public Import[] getImports()
Get all the import elements from the WSDL document.

Returns:
The list of import elements.

getServices

public 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

public WSDLDocument findServiceInterface()
                                  throws WSDLException
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:
WSDLException - if an error occurs while reading an imported document.

toString

public java.lang.String toString()
Return string representation of this object.

Overrides:
toString in class java.lang.Object

main

public static void main(java.lang.String[] args)
Command line interface for validating WSDL documents.



Copyright ? 2001 International Business Machines Corporation. All Rights Reserved.