cgl.narada.wsinfra.util
Class SoapDOMConversion

java.lang.Object
  extended by cgl.narada.wsinfra.util.SoapDOMConversion

public class SoapDOMConversion
extends Object

This is a utility class which performs several DOM to SOAPElement related functions.


Field Summary
static String SOAP_ENVELOPE_NAMESPACE_URI
           
 
Method Summary
 SOAPElement addChildNode(Node node, SOAPElement soapElement, SOAPEnvelope soapEnvelope)
          This method adds a w3c DOM node to the specified javax.soap.SOAPElement.
 SOAPElement addChildNodes(Node node, SOAPElement soapElement, SOAPEnvelope soapEnvelope)
          This method adds child nodes of the specified w3c DOM Node to the specified javax.soap.SOAPElement.
 SOAPElement convertDOMNodeToSOAPElement(Node node, SOAPEnvelope soapEnvelope)
          This method converts a w3c DOM Node into a javax.xml.SOAPElement.
 Document convertToDOMDocument(SOAPMessage soapMessage)
          This method converts a SOAPMessage into a org.w3c.dom.Document object.
 Element extractSOAPBody(Document document)
          This method extracts the SOAPBody from a document.
 Element extractSOAPHeader(Document document)
          This method extracts the SOAPHeader from a document.
 Element getElement(Element element, String localName)
          This method retrieves a child element based on just the localName associated with the element in question.
 Element getElement(Element element, String localName, String prefixUri)
          This method retrieves a child element based on both the localName and prefixUri associated with the element in the question.
static SoapDOMConversion getInstance()
           
 boolean hasElement(Element element, String localName, String prefixUri)
          Checks to see if the element in question contains an element referred to the specified localName and prefixUri
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

SOAP_ENVELOPE_NAMESPACE_URI

public static final String SOAP_ENVELOPE_NAMESPACE_URI
See Also:
Constant Field Values
Method Detail

getInstance

public static SoapDOMConversion getInstance()

convertToDOMDocument

public Document convertToDOMDocument(SOAPMessage soapMessage)
                              throws Exception
This method converts a SOAPMessage into a org.w3c.dom.Document object.

Throws:
Exception

extractSOAPHeader

public Element extractSOAPHeader(Document document)
                          throws Exception
This method extracts the SOAPHeader from a document. The element returned is of the type org.w3c.dom.Element. This method currently works with the soapEnvelope namespace corresponding to SOAP1.1 and the one that is currently approved by WSI. This method throws an error if there are more than 1 SOAP header elements in the SOAPMessage

Throws:
Exception

extractSOAPBody

public Element extractSOAPBody(Document document)
                        throws Exception
This method extracts the SOAPBody from a document. The element returned is of the type org.w3c.dom.Element. This method currently works with the soapEnvelope namespace corresponding to SOAP1.1 and the one that is currently approved by WSI. This method throws an error if there isn't EXACTLY ONE SOAPBody element in the SOAPMessage

Throws:
Exception

hasElement

public boolean hasElement(Element element,
                          String localName,
                          String prefixUri)
Checks to see if the element in question contains an element referred to the specified localName and prefixUri


getElement

public Element getElement(Element element,
                          String localName,
                          String prefixUri)
This method retrieves a child element based on both the localName and prefixUri associated with the element in the question. This method throws an exception if any of the argument passed to this method are null


getElement

public Element getElement(Element element,
                          String localName)
This method retrieves a child element based on just the localName associated with the element in question.


convertDOMNodeToSOAPElement

public SOAPElement convertDOMNodeToSOAPElement(Node node,
                                               SOAPEnvelope soapEnvelope)
                                        throws Exception
This method converts a w3c DOM Node into a javax.xml.SOAPElement. This method is needed since it is not possible to simply cast these objects into one another since they are part of the inheritance tree. This method converts the DOM node into the corresponding SOAPElement. If this node has child nodes these are converted into the appropriate SOAPElements and add as child elements to the root SOAPElement.

Throws:
Exception

addChildNodes

public SOAPElement addChildNodes(Node node,
                                 SOAPElement soapElement,
                                 SOAPEnvelope soapEnvelope)
                          throws Exception
This method adds child nodes of the specified w3c DOM Node to the specified javax.soap.SOAPElement. This method cycles through the DOM child nodes and converts the DOM child nodes into the corresponding SOAPElements, which are then added as child elements to the root SOAPElement.

Throws:
Exception

addChildNode

public SOAPElement addChildNode(Node node,
                                SOAPElement soapElement,
                                SOAPEnvelope soapEnvelope)
                         throws Exception
This method adds a w3c DOM node to the specified javax.soap.SOAPElement. This method also deals with the case where there are mutliple child nodes within the specified node in question

Throws:
Exception


For comments and suggestions please send e-mail to The NaradaBrokering Project