15
SOAP and Web Services
Managing XML-based Information
Its usage is illustrated in the following example:
// Create the oAsync notification object:
var myNotification = {
// This method is called when the service is bound:
resolve: function(nStatus, oInfo)
{
// Print the location if the service was bound:
if (nStatus == 0){
var str = "RESOLVE: http://";
str += oInfo.target;
str += ":";
str += oInfo.port;
str += "/";
str += oInfo.info.path;
console.println(str);
}
// Display the error code if the service was not bound:
else
console.println("ERROR: " + nStatus);
}
};
// Attempt to bind to the service:
SOAP.resolveService({
cType: "http",
cDomain: "local.",
cService: "My Web Server",
oAsync: myNotification
});
Managing XML-based Information
Acrobat JavaScript provides support for XML-based information generated within your
workflows by providing an
XMLData
object, which represents an XML document tree that
may be manipulated via the XFA Data DOM. (For example, it is possible to apply an XSL
transformation (XSLT) to a node and its children using the
XFA
object). The
XMLData
object provides two methods for manipulating XML documents:
●
●
parse
: Creates an object representing an XML document tree.
applyXPath
: Permits the manipulation and query of an XML document via XPath
expressions.
You may convert a string containing XML information into a document tree using the
XML
object’s
parse
method, and then manipulate and query the tree using its
applyXPath
method.
258
Acrobat JavaScript Scripting Guide