XML

XTLRuntime Object

The XTLRuntime object works with XSL style sheets. It implements the IXTLRuntime interface that has nine methods: absoluteChildNumber, ancestorChildNumber, childNumber, depth, formatDate, formatIndex, formatNumber, formatTime, and uniqueID. We will cover XSL style sheets and these methods in Chapter 12.

XMLHTTPRequest Object

The XMLHTTPRequest object, which is an extension of the W3C specification, can be used to send and receive HTTP messages to and from a Web server. Once a message is received, it can be parsed by XML DOM objects. You could use the XMLHTTPRequest object to create applications that build and send SOAP messages to the server. This object implements the IXMLHTTPRequest interface, which has the following properties and methods:

IXMLHTTPRequest Properties

Name Description
readyState Indicates the current state of the document being loaded. The value changes as the XML document loads.
responseBody Returns the response as an array of unsigned bytes.
responseStream Returns the response object as an IStream object.
responseText Returns the response object as a text string.
responseXML Returns the response as an XML document. When this property is used, validation is turned off to prevent the parser from attempting to download a linked DTD or schema.
status Returns a status code as a long integer.
statusText Returns the status as a string.

IXMLHTTPRequest Methods

Name Description
abort()* Cancels the current HTTP request
getAllResponseHeaders()* Returns all the HTTP headers as name value pairs separated by carriage return-linefeeds
getResponseHeader (headerName)* Gets the response header with the name headerName
open (method, url, async, userID, password)* Initializes a request and specifies the HTTP method, the URL, and if the response is asynchronous, the user information
send()* Sends an HTTP request to the server and waits to receive a response
setRequestHeader (headerName, value) Sets HTTP headers that are sent to the server

This chapter has described a complete set of objects that can allow you to manipulate XML information and send HTTP streams to and from a Web server. It's time we look at a more complete example of using some of these objects, including the XMLHTTPRequest object. To do this, we will write the code to create a SOAP client and server application.