public final class RemoteTransaction extends Object
Request/reply transactions are stored in an XML document, allowing a flexible
application interaction. See the class
se.entra.phantom.server.DefaultRemoteApplication
for the
definition of the XML document format.
This class also supports sending all transaction strings and characters as
unicode strings. If this is required, call the method
setUnicodeTransactions
. This should normally not be needed as
transactions are checked for correct code page, but is supported here for
compatibility with the Server.
Constructor and Description |
---|
RemoteTransaction()
Create a new instance of the class.
|
RemoteTransaction(RAPPTransaction transaction)
Creates a new transaction instance for a Request for the Remote Application
in a
RAPPTransaction instance. |
Modifier and Type | Method and Description |
---|---|
static String |
documentToString(Document document)
Converts a Document to String (in XML).
|
Document |
getDocument()
Gets the contents of this transaction as an XML Document.
|
RAPPTransaction |
getTransaction()
Creates a complete new instance of
RAPPTransaction from the
XML document contents received from the server. |
void |
setContents(Document document)
Sets the contents of the transaction as a String.
|
void |
setContents(String xmlString)
Sets the contents of the transaction as a String.
|
void |
setRequest(RAPPTransaction transaction)
Sets the request contents of the transaction.
|
static Document |
stringToDocument(String xmlDocument)
Converts a String (in XML) to a Document.
|
String |
toString()
Gets the contents of this transaction as an XML String.
|
void |
updateTransaction(RAPPTransaction transaction)
Updates the
RAPPTransaction instance with the XML document
contents received from the server. |
public RemoteTransaction()
public RemoteTransaction(RAPPTransaction transaction) throws IOException
RAPPTransaction
instance.
Note: This method DOES NOT serialize reply data to the Document.
IOException
- for errors in the StringWriter
used when streaming
the Document
as a stream.public final void setContents(String xmlString)
public final void setContents(Document document) throws IOException
IOException
- for errors in the StringWriter
used when streaming
the Document
as a stream.public final void setRequest(RAPPTransaction transaction) throws IOException
RAPPTransaction
instance.
Note: This method DOES NOT serialize reply data to the Document.
IOException
- for errors in the StringWriter
used when streaming
the Document
as a stream.public static final String documentToString(Document document) throws IOException
IOException
- for errors in the StringWriter
used when streaming
the Document
as a stream.public static final Document stringToDocument(String xmlDocument) throws IOException, SAXException
IOException
- for errors in the StringReader
used when parsing the
xmlDocument
as a stream.SAXException
- for errors in parsing the xmlDocument
to a
org.w3c.dom.Document
.public final String toString()
If no document contents has been set by a previous call to
setContents
, a NullPointerException
is thrown.
public final Document getDocument() throws IOException, SAXException
In this implementation, this method converts the reply from
toString
and then converts this String to a Document for each
call.
If no document contents has been set by a previous call to
setContents
, a NullPointerException
is thrown.
IOException
- for errors in the StringReader
used when parsing the
xmlDocument
as a stream.SAXException
- for errors in parsing the xmlDocument
to a
org.w3c.dom.Document
.public final void updateTransaction(RAPPTransaction transaction) throws IOException, SAXException
RAPPTransaction
instance with the XML document
contents received from the server.
This method should be used for a non-disconnect session when the instance of the request transaction is still instantiated in a variable in the Remote Application.
IOException
- for errors in the StringReader
used when parsing the
xmlDocument
as a stream.SAXException
- for errors in parsing the xmlDocument
to a
org.w3c.dom.Document
.RAPPTransaction.updateReplyFromDocument(org.w3c.dom.Document)
public final RAPPTransaction getTransaction() throws IOException, SAXException
RAPPTransaction
from the
XML document contents received from the server.
This method is used for sessions that drop the connection and does not have the instance variable for the initial request transaction.
The transaction created by this method must then be traversed by the caller in order to extract the action replies.
IOException
- for errors in the StringReader
used when parsing the
xmlDocument
as a stream.SAXException
- for errors in parsing the xmlDocument
to a
org.w3c.dom.Document
.RAPPTransaction.getAction(int)
,
RAPPTransaction.getFinalAction(int)
,
RAPPTransaction.getActionCount()
,
RAPPTransaction.getFinalActionCount()
,
RAPPTransaction.createFromDocument(org.w3c.dom.Document)
Phantom® and NetPhantom® are registered trademarks of Mindus SARL.
© © Mindus SARL, 2024. All rights reserved.