org.eclipse.jst.ws.jaxws.core.utils
Class WSDLUtils

java.lang.Object
  extended by org.eclipse.jst.ws.jaxws.core.utils.WSDLUtils

public final class WSDLUtils
extends java.lang.Object

WSDL Utility class.

Provisional API: This class/interface is part of an interim API that is still under development and expected to change significantly before reaching stability. It is being made available at this early stage to solicit feedback from pioneering adopters on the understanding that any code that uses this API will almost certainly be broken (repeatedly) as the API evolves.


Field Summary
static java.lang.String WSDL_FILE_EXTENSION
           
 
Method Summary
static javax.wsdl.extensions.ExtensibilityElement getEndpointAddress(javax.wsdl.Definition definition)
          Returns the first SOAPAddress or SOAP12Address found in the given Definition or null if none is found.
static java.lang.String getPackageNameFromNamespace(java.lang.String namespace)
          Constructs a dot separated package name from a given namespace.
static org.eclipse.core.resources.IFolder getWebContentFolder(org.eclipse.core.resources.IProject project)
          Returns the Web Content folder of the given project.
static org.eclipse.core.resources.IFolder getWSDLFolder(org.eclipse.core.resources.IProject project)
          Returns the WSDL folder of the given project.
static org.eclipse.core.resources.IFolder getWSDLFolder(java.lang.String projectName)
          Returns the WSDL folder of the project with the given name.
static java.lang.String getWSDLLocation(javax.wsdl.Definition definition)
          Returns the location URI from the first SOAPAddress or SOAP12Address found in the given Definition or null if none is found.
static boolean isValidWSDLFileName(java.lang.String wsdlFileName)
          Returns true if the given file name contains Alphanumeric characters, underscore '_', dashes '-' and ends with the '.wsdl' extension.
static javax.wsdl.Definition readWSDL(java.net.URL wsdlURL)
          Returns a javax.wsdl.Definition by reading the WSDL document at the given URL or null if none can be found or if the connection times out.
static void writeWSDL(java.net.URL wsdlURL, javax.wsdl.Definition definition)
          Writes the given javax.wsdl.Definition to the wsdl document at the given URL.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

WSDL_FILE_EXTENSION

public static final java.lang.String WSDL_FILE_EXTENSION
See Also:
Constant Field Values
Method Detail

readWSDL

public static javax.wsdl.Definition readWSDL(java.net.URL wsdlURL)
                                      throws java.io.IOException
Returns a javax.wsdl.Definition by reading the WSDL document at the given URL or null if none can be found or if the connection times out.

Parameters:
wsdlURL - the url of the wsdl document to read.
Returns:
the definition described in the wsdl document pointed to by the given URL.
Throws:
java.io.IOException - if an I/O exception occurs.

writeWSDL

public static void writeWSDL(java.net.URL wsdlURL,
                             javax.wsdl.Definition definition)
                      throws java.io.IOException,
                             org.eclipse.core.runtime.CoreException
Writes the given javax.wsdl.Definition to the wsdl document at the given URL.

Parameters:
wsdlURL - the url of the wsdl document to write to.
definition - the WSDL definition to be written.
Throws:
java.io.IOException - if an I/O exception occurs.
org.eclipse.core.runtime.CoreException - if an exception occurs refreshing the file in the workspace if it exists.

isValidWSDLFileName

public static boolean isValidWSDLFileName(java.lang.String wsdlFileName)
Returns true if the given file name contains Alphanumeric characters, underscore '_', dashes '-' and ends with the '.wsdl' extension. Otherwise returns false.

Parameters:
wsdlFileName - the wsdl file name
Returns:
true if valid, code>false otherwise.

getWebContentFolder

public static org.eclipse.core.resources.IFolder getWebContentFolder(org.eclipse.core.resources.IProject project)
Returns the Web Content folder of the given project. The returned resource may not exist.

Parameters:
project - the name of the web project
Returns:
the web content folder

getWSDLFolder

public static org.eclipse.core.resources.IFolder getWSDLFolder(java.lang.String projectName)
Returns the WSDL folder of the project with the given name. The WSDL folder path is the projects web content folder path appended with the 'WSDL' directory. The returned resource may not exist.

Parameters:
projectName - the name of the web project
Returns:
the wsdl folder

getWSDLFolder

public static org.eclipse.core.resources.IFolder getWSDLFolder(org.eclipse.core.resources.IProject project)
Returns the WSDL folder of the given project. The WSDL folder path is the projects web content folder path appended with the 'WSDL' directory. The returned resource may not exist.

Parameters:
project - the web project
Returns:
the wsdl folder

getEndpointAddress

public static javax.wsdl.extensions.ExtensibilityElement getEndpointAddress(javax.wsdl.Definition definition)
Returns the first SOAPAddress or SOAP12Address found in the given Definition or null if none is found.

Parameters:
definition - the given definition.
Returns:
return one of:
  • SOAPAddress
  • SOAP12Address
  • null if it can not find a soap address

  • getWSDLLocation

    public static java.lang.String getWSDLLocation(javax.wsdl.Definition definition)
                                            throws java.net.MalformedURLException
    Returns the location URI from the first SOAPAddress or SOAP12Address found in the given Definition or null if none is found. The returned location URI is appended with the '?wsdl' query if the query was not present in the SOAPAddress or SOAP12Address location URI.

    Parameters:
    definition - the given defintion.
    Returns:
    the location URI or the first SOAPAddress or SOAP12Address found in the given definition.
    Throws:
    java.net.MalformedURLException - if an error occurs testing the location URI for a query part.

    getPackageNameFromNamespace

    public static java.lang.String getPackageNameFromNamespace(java.lang.String namespace)
    Constructs a dot separated package name from a given namespace.

    E.g., the namespace Òhttp://ws.example.com/Ó would return the Java package name Òcom.example.wsÓ.

    N.B. This method does not preserve 'www' in the returned package name if it exists in the given namespace.

    Parameters:
    namespace - the given name.
    Returns:
    a package name.