com.ibm.di.parser
Class SOAPParser

java.lang.Object
  extended by com.ibm.di.parser.ParserImpl
      extended by com.ibm.di.parser.XMLParser
          extended by com.ibm.di.parser.SOAPParser
All Implemented Interfaces:
ParserInterface, VersionInfoInterface, ErrorHandler

public class SOAPParser
extends XMLParser

The SOAP Parser reads and writes SOAP XML documents. The Parser converts SOAP XML documents to or from entry objects in a simple, straightforward fashion.


Field Summary
 
Fields inherited from class com.ibm.di.parser.XMLParser
children, curindex, db, entrytag, inputDoc, outputDoc, toplevel, toplevelInput, useCData, valuetag
 
Fields inherited from class com.ibm.di.parser.ParserImpl
_debug, myConfiguration
 
Constructor Summary
SOAPParser()
          Creates SOAPParser.
 
Method Summary
 void dumpNodes(String prefix, NodeList list)
          Prints the contents of the NodeList depending on the types of the .
 Node findNamedElement(NodeList list, String name)
          Finds node element by given name.
 Node getElement(Node parent, int index)
          Returns Node object by given index.
 Vector<Element> getElementList(Node parent)
          Return list containing all children of the parent node.
 Node getFirstText(Node parent)
          Gets the text of the first child of a given Node.
 String getVersion()
          Version information.
 String getXML(Entry e)
          Returns string representation of Entry object as a XML file.
 void initOutput()
          Initializes the output Document
 void p(String s)
          Writes a message to the log.
 Entry parseRequest(Object request)
          Sets the current input stream and initializes the parser.
 Node parseXML(String xml)
          Parses XML file to Document element.
 void printNode(String prefix, Node n)
          Prints the contents of the Node depending on its type.
 Entry readEntry()
          Reads SOAP XML documents.
 void writeEntry(Entry entry)
          Writes SOAP XML document.
 
Methods inherited from class com.ibm.di.parser.XMLParser
closeParser, error, fatalError, flush, getOmitXMLDeclaration, initInput, initParser, registerScriptBeans, setOmitXMLDeclaration, warning
 
Methods inherited from class com.ibm.di.parser.ParserImpl
debug, debugMode, getClassInstance, getContext, getDebug, getInputStream, getOutputStream, getParam, getParser, getReader, getWriter, isDeltaSupported, logmsg, querySchema, setConfiguration, setContext, setDebug, setInputStream, setInputStream, setInputStream, setOutputStream, setOutputStream, setParam, setParser
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SOAPParser

public SOAPParser()
Creates SOAPParser.

Method Detail

initOutput

public void initOutput()
                throws Exception
Initializes the output Document

Overrides:
initOutput in class XMLParser
Throws:
Exception - If could not find output stream.

parseRequest

public Entry parseRequest(Object request)
                   throws Exception
Sets the current input stream and initializes the parser.

Parameters:
request - the requested Reader.
Returns:
first read entry containing the parsed attributes.
Throws:
Exception - if I/O error occurs.

findNamedElement

public Node findNamedElement(NodeList list,
                             String name)
Finds node element by given name.

Parameters:
list - NodeList to search into.
name - the name of the searched node.
Returns:
first Element node named name.

getElementList

public Vector<Element> getElementList(Node parent)
Return list containing all children of the parent node.

Parameters:
parent - the parent Node.
Returns:
Vector with all Element children

getElement

public Node getElement(Node parent,
                       int index)
Returns Node object by given index.

Parameters:
parent - the parent Node.
index - the index of the desired Node.
Returns:
Node object at index position.

getFirstText

public Node getFirstText(Node parent)
Gets the text of the first child of a given Node.

Parameters:
parent - the parent Node
Returns:
string containing the text value.

dumpNodes

public void dumpNodes(String prefix,
                      NodeList list)
Prints the contents of the NodeList depending on the types of the .

Parameters:
prefix - prefix of the log message.
list - the NodeList object to be printed.
See Also:
printNode(String, Node)

printNode

public void printNode(String prefix,
                      Node n)
Prints the contents of the Node depending on its type.

Parameters:
prefix - prefix of the log message.
n - the Node to be printed.

p

public void p(String s)
Writes a message to the log.

Parameters:
s - The log message
See Also:
ParserImpl.logmsg(String)

readEntry

public Entry readEntry()
                throws Exception
Reads SOAP XML documents. The attribute SOAP_CALL is set to reflect the first tag following the SOAP-ENV:Body tag. Each tag under the SOAP_CALL tag translates to an attribute in the entry object.

Specified by:
readEntry in interface ParserInterface
Overrides:
readEntry in class XMLParser
Returns:
the entry containing the read attributes.
Throws:
Exception - if the XML file is invalid or malformed SOAP XML document.

writeEntry

public void writeEntry(Entry entry)
                throws Exception
Writes SOAP XML document. The SOAPParser uses attributes from the entry to build the document. The SOAP_CALL attribute is expected to contain the value for the SOAP call. For all others attribute in the entry, a tag with that name and value is created.

Specified by:
writeEntry in interface ParserInterface
Overrides:
writeEntry in class XMLParser
Parameters:
entry - the entry containing the attributes to write.
Throws:
Exception - if could not build the DOM tree or serialize the DOM element.
See Also:
DOMException

parseXML

public Node parseXML(String xml)
              throws Exception
Parses XML file to Document element.

Parameters:
xml - xml file to parse.
Returns:
parsed Document element.
Throws:
Exception - If any I/O or parse errors occur; if xml is null

getXML

public String getXML(Entry e)
              throws Exception
Returns string representation of Entry object as a XML file.

Parameters:
e - the Entry object
Returns:
the buffer of the current writer object as a string.
Throws:
Exception - if could not build the DOM tree or serialize the DOM element.

getVersion

public String getVersion()
Version information.

Specified by:
getVersion in interface VersionInfoInterface
Overrides:
getVersion in class XMLParser
Returns:
version information