Class WSDLDocument


  • public class WSDLDocument
    extends java.lang.Object
    Provides an easy way to read and write information to and from WSDL documents.
    • Constructor Summary

      Constructors 
      Constructor Description
      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.
      WSDLDocument​(javax.wsdl.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.
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      WSDLDocument findServiceInterface()
      Find the Service Interface document which this Service Implementation document references.
      javax.wsdl.Binding[] getBindings()
      Get all the binding elements from the WSDL document.
      javax.wsdl.Definition getDefinitions()
      Get the definition element of the WSDL document.
      javax.wsdl.Import[] getImports()
      Get all the import elements from the WSDL document.
      javax.wsdl.Message[] getMessages()
      Get all the message elements from the WSDL document.
      javax.wsdl.PortType[] getPortTypes()
      Get all the portType elements from the WSDL document.
      javax.wsdl.Service[] getServices()
      Get all the service elements from the WSDL document.
      static javax.wsdl.xml.WSDLReader getWSDLReader()
      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 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.io.Writer writer)
      Write the WSDL document content to the specified writer.
      void write​(java.lang.String fileName)
      Write the WSDL document to the specified file.
      • 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 javax.wsdl.factory.WSDLFactory wsdlFactory
      • wsdlException

        protected static javax.wsdl.WSDLException wsdlException
    • Constructor Detail

      • WSDLDocument

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

        public WSDLDocument​(java.net.URL documentURL)
                     throws javax.wsdl.WSDLException
        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

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

        public WSDLDocument​(org.w3c.dom.Document document)
                     throws javax.wsdl.WSDLException
        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 Detail

      • getWSDLReader

        public static javax.wsdl.xml.WSDLReader getWSDLReader()
                                                       throws javax.wsdl.WSDLException
        Constructs 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.WSDLException
        Constructs a WSDLWriter
        Throws:
        javax.wsdl.WSDLException - if the WSDL document cannot be created.
      • read

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

        public void read​(java.lang.String fileName,
                         boolean imports)
                  throws javax.wsdl.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:
        javax.wsdl.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 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

        public WSDLDocument findServiceInterface()
                                          throws javax.wsdl.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:
        javax.wsdl.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.