org.autopipes.servlet
Class DOMSOAPImp

java.lang.Object
  extended by org.autopipes.servlet.DOMSOAPImp
All Implemented Interfaces:
DOMSOAP

public class DOMSOAPImp
extends java.lang.Object
implements DOMSOAP

Implementation of DOMSOAP with no dependencies outside J2SE.


Field Summary
 
Fields inherited from interface org.autopipes.servlet.DOMSOAP
SOAPENV, XMLNS
 
Constructor Summary
DOMSOAPImp()
          Default constructor.
 
Method Summary
 org.w3c.dom.Document createErrorMessage(java.lang.Exception e)
          Creates SOAP Fault message containing text found in an exception.
 org.w3c.dom.Document createMessageDoc()
          Creates an empty SOAP message.
static org.w3c.dom.Element getMessageBody(org.w3c.dom.Document msg)
          Finds SOAP body element within a SOAP message.
static org.w3c.dom.Element getMessageContent(org.w3c.dom.Document msg)
          Finds the XML content passed in a SOAP message.
 org.w3c.dom.Document readMessage(java.io.Reader reader)
          Deserializes a stream into a node.
 void writeMessage(org.w3c.dom.Node msg, java.io.Writer writer)
          Serializes a node into a stream.
 java.lang.String xmlString(org.w3c.dom.Node in)
          Converts a DOM Node to a String.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DOMSOAPImp

public DOMSOAPImp()
           throws javax.servlet.ServletException
Default constructor.

Throws:
javax.servlet.ServletException - wraps exceptions from XML setup so that it can be used in a Servlet
Method Detail

createMessageDoc

public org.w3c.dom.Document createMessageDoc()
Creates an empty SOAP message.

Specified by:
createMessageDoc in interface DOMSOAP
Returns:
the message

getMessageBody

public static org.w3c.dom.Element getMessageBody(org.w3c.dom.Document msg)
Finds SOAP body element within a SOAP message.

Parameters:
msg - the message
Returns:
the Body element

getMessageContent

public static org.w3c.dom.Element getMessageContent(org.w3c.dom.Document msg)
Finds the XML content passed in a SOAP message.

Parameters:
msg - the message
Returns:
the content or null if none present

createErrorMessage

public org.w3c.dom.Document createErrorMessage(java.lang.Exception e)
Creates SOAP Fault message containing text found in an exception.

Specified by:
createErrorMessage in interface DOMSOAP
Parameters:
e - the exception
Returns:
the message

writeMessage

public void writeMessage(org.w3c.dom.Node msg,
                         java.io.Writer writer)
                  throws javax.servlet.ServletException
Serializes a node into a stream.

Specified by:
writeMessage in interface DOMSOAP
Parameters:
msg - the node
writer - the stream
Throws:
javax.servlet.ServletException - wrapped for use in a Servlet

xmlString

public java.lang.String xmlString(org.w3c.dom.Node in)
                           throws javax.servlet.ServletException
Converts a DOM Node to a String.

Parameters:
in - the Node
Returns:
the String
Throws:
javax.servlet.ServletException

readMessage

public org.w3c.dom.Document readMessage(java.io.Reader reader)
                                 throws javax.xml.transform.TransformerException
Deserializes a stream into a node.

Specified by:
readMessage in interface DOMSOAP
Parameters:
reader - the stream
Returns:
the node
Throws:
javax.xml.transform.TransformerException