nsISOAPMessage

IID:3970815e-1dd2-11b2-a475-db4dac6826f1
Inherits From:nsISupports

This interface controls all SOAP messages. It permits easy construction of a message, typically through encoding of parameters and certain properties settable on this interface or through deserialization of a transport stream. It permits easy processing of a message typically through decoding of parameters and certain properties available on this interface. It also encapsulates protocol information interpreted by the transport.

This interface is implemented by the following components:


Constants

PRUint16 VERSION_1_1 = 0
PRUint16 VERSION_1_2 = 1
PRUint16 VERSION_UNKNOWN = 65535

Properties

AString actionURI

An optional URI that can be used to add a SOAPAction HTTP header field. If this attribute is NULL (the default case), no SOAPAction header will be added.

readonly nsIDOMElement body

A convenience attribute to obtain the DOM element representing the SOAP body from the envelope. DOM methods may be used to access, add, or modify attributes or elements of the body.

If the envelope attribute is null or does not contain a SOAP body element type, then this will be null.

nsISOAPEncoding encoding

The primary encoding of the message, which is established at the envelope and used unless overridden. By default, this is the SOAP encoding, which may be locally modified or used to obtain alternative encodings, which may be locally modified, but it may be set to an encoding that is shared, or it may be set to null, in which case all non-literal header blocks and parameters must specify an encoding.

readonly nsIDOMElement envelope

A convenience attribute to obtain the DOM element representing the SOAP envelope from the document. DOM methods may be used to access, add, or modify attributes of the envelope.

If the message attribute is null or is not a document containing a root soap envelope element, then this will be null.

readonly nsIDOMElement header

A convenience attribute to obtain the DOM element representing the SOAP header from the envelope. DOM methods may be used to access, add, or modify attributes or elements of the header.

If the envelope attribute is null or does not contain a SOAP header element type, then this will be null.

nsIDOMDocument message

The document which captures the message, if any. A simple sending application passes parameters to the method encodeSOAPParameters, which calls SOAP encoders to construct this document along with all contained elements.

But an application may create and set the message directly instead of invoking encodeSOAPParameters to use encoders or access and manipulate the message after it has been constructed by encodeSOAPParameters. If the message has not been set, invoking a call will fail. A message reciever may also use this accessor to get the document to avoid using decoders.

readonly AString methodName

The name of the method being invoked. The methodName is set during encoding as the tagname of the single child of body of RPC-style messages. When there is no encoded message this will be null. The value of this attribute for document-style messages may be non-null but should be ignored. It is up to the application to know whether the message is RPC-style or document style because the SOAP specification makes it difficult to tell which way a message was encoded.

readonly AString targetObjectURI

The target object on which the method is being invoked. This URI is set during encoding as the namespace to qualify the tagname of the single child of body of RPC-style messages. When there is no encoded message, this will be null. The value of this attribute for document-style messages may be non-null but should be ignored. It is up to the application to know whether the message is RPC-style or document style because the SOAP specification makes it difficult to tell which way a message was encoded.

readonly PRUint16 version

A convenience attribute to obtain the SOAP version number, if it is known, from the envelope.

If the message attribute is null or is not a document containing a root soap envelope element, then this will be VERSION_UNKNOWN.


Methods

void encode ( PRUint16 version , AString methodName , AString targetObjectURI , PRUint32 headerBlockCount , nsISOAPHeaderBlock headerBlocks , PRUint32 parameterCount , nsISOAPParameter parameters ) void getHeaderBlocks ( out PRUint32 count , retval nsISOAPHeaderBlock headerBlocks ) void getParameters ( PRBool documentStyle , out PRUint32 count , retval nsISOAPParameter parameters )

void encode ( PRUint16 version , AString methodName , AString targetObjectURI , PRUint32 headerBlockCount , nsISOAPHeaderBlock headerBlocks , PRUint32 parameterCount , nsISOAPParameter parameters )

Encodes the specified parameters into this message, if this message type supports it.

Arguments:
version
methodName: The name of the method being invoked for rpc-style messages. For document-style messages, this must be null.
targetObjectURI: The name of the target object for rpc-style messages. For document-style messages, this must be null.
headerBlockCount: Number of header blocks in array to be encoded. Must be 0 if header block array is null.
headerBlocks: Array of header blocks to be encoded, which may be null if there are no header blocks.
parameterCount: Number of parameters in array to be encoded. Must be 0 if parameter array is null.
parameters: An array of parameters to be encoded, which may null if there are no parameters.

void getHeaderBlocks ( out PRUint32 count , retval nsISOAPHeaderBlock headerBlocks )

Gathers the header blocks of a message so that they can be accessed by a recipient.

Arguments:
count: Integer to receive the length of the list of header blocks.
headerBlocks
Returns:
Array of header blocks found in the message.

void getParameters ( PRBool documentStyle , out PRUint32 count , retval nsISOAPParameter parameters )

Gathers the parameters of a message so that they can be accessed by a recipient.

Arguments:
documentStyle: If true, then the parameters are looked for treating the message as a document style message, otherwise it treated as an RPC-style message.
count: Integer to receive the length of the list of parameters.
parameters
Returns:
Array of parameters found in the message.

References

This interface is passed as an argument to the following methods:

nsISOAPService.process, nsISOAPTransportListener.handleMessage

Reference documentation is generated from Mozilla's source.

Add a note User Contributed Notes
No comments available

Copyright © 1999 - 2005 XULPlanet.com