com.ibm.di.connector.axis2.util
Class WSUtils

java.lang.Object
  extended by com.ibm.di.connector.axis2.util.WSUtils

public class WSUtils
extends Object

Utility class , providing various methods for managing Axis 2 web services.


Constructor Summary
WSUtils()
           
 
Method Summary
static Vector createAllAxisServicesFromWSDLFile(String wsdl)
          Returns all services from the given WSDL file.
static Vector createAllAxisServicesFromWSDLFile(String wsdl, boolean isServerSide)
          Returns all services from the given WSDL file.
static org.apache.axis2.description.AxisService createAxisServiceFromWSDLFile(String wsdlFile, String serviceName)
          Creates a specified service object from the WSDL file.
static org.apache.axis2.description.AxisService createAxisServiceFromWSDLFile(String wsdlFile, String serviceName, boolean isServerSide)
          Creates a specified service object from the WSDL file.
static Vector getServiceEndPointNames(String wsdlFile, String serviceName)
          Retrieves the endpoint names from the give WSDL file for the given service.
static Vector getServiceOperationNames(String wsdlFile, String serviceName)
          Returns service operation names from the give WSDL file for the given service.
static Attribute getSOAPHeader(org.apache.axiom.soap.SOAPEnvelope envelope, String attributeName, Entry e)
          Returns the SOAP Header as TDI Hierarchical Attribute from a given SOAP Envelope.
static boolean isWSDL20(URL wsdlURL)
          This method determines the version of the WSDL file which corresponds to the given URL.
static void setSOAPHeader(org.apache.axiom.soap.SOAPEnvelope envelope, Attribute soapHeaderHAttr)
          Sets the SOAP Envelope header to the provided TDI Hierarchical Attribute.
static Element toDOM(org.apache.axiom.om.OMElement src, Document doc)
          Converts Apache AXIOM element to W3C DOM Element, i.e.
static org.apache.axiom.om.OMElement toOM(Element src)
          Converts W3C DOM Element to Apache AXIOM element.
static org.apache.axiom.om.OMElement toOM(Element src, org.apache.axiom.om.OMFactory factory)
          Converts W3C DOM Element to Apache AXIOM element.
static Attribute verifyAttribute(Attribute a, QName qname)
          Verifies that the passed Attribute has the required prefix/localName/namespace and that its child is a Text object
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

WSUtils

public WSUtils()
Method Detail

toDOM

public static Element toDOM(org.apache.axiom.om.OMElement src,
                            Document doc)
Converts Apache AXIOM element to W3C DOM Element, i.e. to TDI Hierarchical Attribute.

Parameters:
src - The AXIOM element which will be converted.
doc - The document used to create all needed DOM information.
Returns:
DOM Element object which corresponds to the AXIOM element.

toOM

public static org.apache.axiom.om.OMElement toOM(Element src)
Converts W3C DOM Element to Apache AXIOM element. It uses the default OMFactory.

Parameters:
src - The element which will be converted.
Returns:
AXIOM element corresponding to the source DOM Element object.

toOM

public static org.apache.axiom.om.OMElement toOM(Element src,
                                                 org.apache.axiom.om.OMFactory factory)
Converts W3C DOM Element to Apache AXIOM element. It uses the provided OMFactory.

Parameters:
src - The element which will be converted.
factory - The desired OMFacotry for the convertion.
Returns:
AXIOM element corresponding to the source DOM Element object.

isWSDL20

public static boolean isWSDL20(URL wsdlURL)
                        throws Exception
This method determines the version of the WSDL file which corresponds to the given URL.

Parameters:
wsdlURL - The URL to the WSDL file.
Returns:
Returns true if the WSDL file version 2.0 and false if it is 1.1.
Throws:
Exception - The WSDL version cannot be recognized.

createAllAxisServicesFromWSDLFile

public static Vector createAllAxisServicesFromWSDLFile(String wsdl)
                                                throws Exception
Returns all services from the given WSDL file. The services are created from server point of view - this affects the input/output message creation.

Parameters:
wsdl - The location to the WSDL file.
Returns:
Vector object with all services in the WSDL file.
Throws:
Exception - If an Exception occurs during the process. Check the Exception message for more details.

createAllAxisServicesFromWSDLFile

public static Vector createAllAxisServicesFromWSDLFile(String wsdl,
                                                       boolean isServerSide)
                                                throws Exception
Returns all services from the given WSDL file. The services are created from server or client point of view - this affects the input/output message creation.

Parameters:
wsdl - The location to the WSDL file.
isServerSide - If true the services will be created form server point of view. If false - from client point of view.
Returns:
Vector object with all services in the WSDL file.
Throws:
Exception - If an Exception occurs during the process. Check the Exception message for more details.

createAxisServiceFromWSDLFile

public static org.apache.axis2.description.AxisService createAxisServiceFromWSDLFile(String wsdlFile,
                                                                                     String serviceName)
                                                                              throws Exception
Creates a specified service object from the WSDL file. The service is created from server point of view - this affects the input/output message creation.

Parameters:
wsdlFile - The location to the WSDL file.
serviceName - The service name of the service which will be created.
Returns:
A service object generated from the WSDL file.
Throws:
Exception - If an Exception occurs during the process. Check the Exception message for more details.

createAxisServiceFromWSDLFile

public static org.apache.axis2.description.AxisService createAxisServiceFromWSDLFile(String wsdlFile,
                                                                                     String serviceName,
                                                                                     boolean isServerSide)
                                                                              throws Exception
Creates a specified service object from the WSDL file. The service is created from server or client point of view - this affects the input/output message creation.

Parameters:
wsdlFile - The location to the WSDL file.
serviceName - The service name of the service which will be created.
isServerSide - If true the service will be created form server point of view. If false - from client point of view.
Returns:
A service object generated from the WSDL file.
Throws:
Exception - If an Exception occurs during the process. Check the Exception message for more details.

getServiceEndPointNames

public static Vector getServiceEndPointNames(String wsdlFile,
                                             String serviceName)
                                      throws Exception
Retrieves the endpoint names from the give WSDL file for the given service.

Parameters:
wsdlFile - The location to the WSDL file.
serviceName - The service name of the service from which the endpoint will be extracted.
Returns:
Vector with Endpoint names of the service.
Throws:
Exception - If an Exception occurs during the process. Check the Exception message for more details.

getServiceOperationNames

public static Vector getServiceOperationNames(String wsdlFile,
                                              String serviceName)
                                       throws Exception
Returns service operation names from the give WSDL file for the given service.

Parameters:
wsdlFile - The location to the WSDL file.
serviceName - The service name of the service from which the operations will be extracted.
Returns:
Vector with Operation names of the service.
Throws:
Exception - If an Exception occurs during the process. Check the Exception message for more details.

getSOAPHeader

public static Attribute getSOAPHeader(org.apache.axiom.soap.SOAPEnvelope envelope,
                                      String attributeName,
                                      Entry e)
Returns the SOAP Header as TDI Hierarchical Attribute from a given SOAP Envelope.

Parameters:
envelope - The Envelope from which the headers will be extracted.
attributeName - The name of the TDI Hierarchical Attribute to which the Envelope Header will be written.
e - The entry which is used to manipulate the TDI Hierarchical Attribute.
Returns:
TDI Hierarchical Attribute which contains the SOAP Header information.

setSOAPHeader

public static void setSOAPHeader(org.apache.axiom.soap.SOAPEnvelope envelope,
                                 Attribute soapHeaderHAttr)
Sets the SOAP Envelope header to the provided TDI Hierarchical Attribute.

Parameters:
envelope - The SOAP Envelope which will be populated with the headers information.
soapHeaderHAttr - The TDI Hierarchical Attribute containing the SOAP Headers.

verifyAttribute

public static Attribute verifyAttribute(Attribute a,
                                        QName qname)
Verifies that the passed Attribute has the required prefix/localName/namespace and that its child is a Text object

Parameters:
a - The TDI Attribute.
qname - The name which will be used for the TDI Attribute if it is not already set..
Returns:
the correct Attribute to use.