Back to index

lightning-sunbird  0.9+nobinonly
Public Member Functions | Public Attributes | Protected Member Functions | Protected Attributes
nsSOAPMessage Class Reference

#include <nsSOAPMessage.h>

Inheritance diagram for nsSOAPMessage:
Inheritance graph
[legend]
Collaboration diagram for nsSOAPMessage:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 nsSOAPMessage ()
virtual ~nsSOAPMessage ()
void encode (in unsigned short aVersion, in AString aMethodName, in AString aTargetObjectURI, in unsigned long aHeaderBlockCount,[array, size_is(aHeaderBlockCount)] in nsISOAPHeaderBlock aHeaderBlocks, in unsigned long aParameterCount,[array, size_is(aParameterCount)] in nsISOAPParameter aParameters)
 Encodes the specified parameters into this message, if this message type supports it.
void getHeaderBlocks (out unsigned long aCount,[array, size_is(aCount), retval] out nsISOAPHeaderBlock aHeaderBlocks)
 Gathers the header blocks of a message so that they can be accessed by a recipient.
void getParameters (in boolean aDocumentStyle, out unsigned long aCount,[array, size_is(aCount), retval] out nsISOAPParameter aParameters)
 Gathers the parameters of a message so that they can be accessed by a recipient.

Public Attributes

const unsigned short VERSION_1_1 = 0
const unsigned short VERSION_1_2 = 1
const unsigned short VERSION_UNKNOWN = 0xFFFF
attribute nsIDOMDocument message
 The document which captures the message, if any.
readonly attribute nsIDOMElement envelope
 A convenience attribute to obtain the DOM element representing the SOAP envelope from the document.
readonly attribute unsigned short version
 A convenience attribute to obtain the SOAP version number, if it is known, from the envelope.
readonly attribute nsIDOMElement header
 A convenience attribute to obtain the DOM element representing the SOAP header from the envelope.
readonly attribute nsIDOMElement body
 A convenience attribute to obtain the DOM element representing the SOAP body from the envelope.
readonly attribute AString methodName
 The name of the method being invoked.
readonly attribute AString targetObjectURI
 The target object on which the method is being invoked.
attribute nsISOAPEncoding encoding
 The primary encoding of the message, which is established at the envelope and used unless overridden.
attribute AString actionURI
 An optional URI that can be used to add a SOAPAction HTTP header field.

Protected Member Functions

PRUint16 GetEnvelopeWithVersion (nsIDOMElement **aEnvelope)
nsresult GetEncodingWithVersion (nsIDOMElement *aFirst, PRUint16 *aVersion, nsISOAPEncoding **aEncoding)
 Internally used to track down the encoding to be used at the headers or parameters.

Protected Attributes

nsCOMPtr< nsIDOMDocumentmMessage
nsCOMPtr< nsISOAPEncodingmEncoding
nsString mActionURI

Detailed Description

Definition at line 50 of file nsSOAPMessage.h.


Constructor & Destructor Documentation

Definition at line 58 of file nsSOAPMessage.cpp.

{
}

Definition at line 62 of file nsSOAPMessage.cpp.

{
}

Member Function Documentation

void nsISOAPMessage::encode ( in unsigned short  aVersion,
in AString  aMethodName,
in AString  aTargetObjectURI,
in unsigned long  aHeaderBlockCount,
[array, size_is(aHeaderBlockCount)] in nsISOAPHeaderBlock  aHeaderBlocks,
in unsigned long  aParameterCount,
[array, size_is(aParameterCount)] in nsISOAPParameter  aParameters 
) [inherited]

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

Parameters:
aMethodNameThe name of the method being invoked for rpc-style messages. For document-style messages, this must be null.
aTargetObjectURIThe name of the target object for rpc-style messages. For document-style messages, this must be null.
aHeaderBlockCountNumber of header blocks in array to be encoded. Must be 0 if header block array is null.
aHeaderBlocksArray of header blocks to be encoded, which may be null if there are no header blocks.
aParameterCountNumber of parameters in array to be encoded. Must be 0 if parameter array is null.
aParametersAn array of parameters to be encoded, which may null if there are no parameters.
nsresult nsSOAPMessage::GetEncodingWithVersion ( nsIDOMElement aFirst,
PRUint16 aVersion,
nsISOAPEncoding **  aEncoding 
) [protected]

Internally used to track down the encoding to be used at the headers or parameters.

We know the version is legal, or we couldn't have found a starting point, so it is used but not checked again. We also know that since there is a version, there is an encoding.

Definition at line 518 of file nsSOAPMessage.cpp.

{
  nsCOMPtr<nsISOAPEncoding> encoding;
  nsresult rv = GetEncoding(getter_AddRefs(encoding));
  if (NS_FAILED(rv))
    return rv;
  rv = GetVersion(aVersion);
  if (NS_FAILED(rv))
    return rv;
  nsCOMPtr<nsIDOMElement> element = aFirst;

  // Check for stray encodingStyle attributes.  If none found, then
  // use empty string encoding style.

  nsAutoString style;
  for (;;) {
    nsCOMPtr<nsIDOMAttr> enc;
    rv = element->GetAttributeNodeNS(*gSOAPStrings->kSOAPEnvURI[*aVersion],
                                     gSOAPStrings->kEncodingStyleAttribute,
                                     getter_AddRefs(enc));
    if (NS_FAILED(rv))
      return rv;
    if (enc) {
      rv = enc->GetNodeValue(style);
      if (NS_FAILED(rv))
        return rv;
      break;
    } else {
      nsCOMPtr<nsIDOMNode> next;
      rv = element->GetParentNode(getter_AddRefs(next));
      if (NS_FAILED(rv))
        return rv;
      if (next) {
        PRUint16 type;
        rv = next->GetNodeType(&type);
        if (NS_FAILED(rv))
          return rv;
        if (type != nsIDOMNode::ELEMENT_NODE) {
          next = nsnull;
        }
      }
      if (next) {
        element = do_QueryInterface(next);
      } else {
        break;
      }
    }
  }
  return encoding->GetAssociatedEncoding(style, PR_TRUE, aEncoding);
}

Here is the call graph for this function:

Definition at line 148 of file nsSOAPMessage.cpp.

{
  if (mMessage) {
    nsCOMPtr<nsIDOMElement> root;
    mMessage->GetDocumentElement(getter_AddRefs(root));
    if (root) {
      nsAutoString namespaceURI;
      nsAutoString name;
      root->GetNamespaceURI(namespaceURI);
      root->GetLocalName(name);
      if (name.Equals(gSOAPStrings->kEnvelopeTagName)) {
        if (namespaceURI.
            Equals(*gSOAPStrings->kSOAPEnvURI[nsISOAPMessage::VERSION_1_2])) {
          *aEnvelope = root;
          NS_ADDREF(*aEnvelope);
          return nsISOAPMessage::VERSION_1_2;
        } else if (namespaceURI.
                   Equals(*gSOAPStrings->kSOAPEnvURI[nsISOAPMessage::VERSION_1_1])) {
          *aEnvelope = root;
          NS_ADDREF(*aEnvelope);
          return nsISOAPMessage::VERSION_1_1;
        }
      }
    }
  }
  *aEnvelope = nsnull;
  return nsISOAPMessage::VERSION_UNKNOWN;
}

Here is the call graph for this function:

void nsISOAPMessage::getHeaderBlocks ( out unsigned long  aCount,
[array, size_is(aCount), retval] out nsISOAPHeaderBlock  aHeaderBlocks 
) [inherited]

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

Parameters:
aCountInteger to receive the length of the list of header blocks.
Returns:
Array of header blocks found in the message.
void nsISOAPMessage::getParameters ( in boolean  aDocumentStyle,
out unsigned long  aCount,
[array, size_is(aCount), retval] out nsISOAPParameter  aParameters 
) [inherited]

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

Parameters:
aDocumentStyleIf true, then the parameters are looked for treating the message as a document style message, otherwise it treated as an RPC-style message.
aCountInteger to receive the length of the list of parameters.
Returns:
Array of parameters found in the message.

Member Data Documentation

attribute AString nsISOAPMessage::actionURI [inherited]

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.

Definition at line 229 of file nsISOAPMessage.idl.

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.

Definition at line 118 of file nsISOAPMessage.idl.

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.

Definition at line 222 of file nsISOAPMessage.idl.

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.

Definition at line 89 of file nsISOAPMessage.idl.

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.

Definition at line 108 of file nsISOAPMessage.idl.

Definition at line 65 of file nsSOAPMessage.h.

Definition at line 64 of file nsSOAPMessage.h.

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.

Definition at line 79 of file nsISOAPMessage.idl.

readonly attribute AString nsISOAPMessage::methodName [inherited]

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.

Definition at line 131 of file nsISOAPMessage.idl.

Definition at line 63 of file nsSOAPMessage.h.

readonly attribute AString nsISOAPMessage::targetObjectURI [inherited]

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.

Definition at line 144 of file nsISOAPMessage.idl.

readonly attribute unsigned short nsISOAPMessage::version [inherited]

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.

Definition at line 98 of file nsISOAPMessage.idl.

const unsigned short nsISOAPMessage::VERSION_1_1 = 0 [inherited]

Definition at line 61 of file nsISOAPMessage.idl.

const unsigned short nsISOAPMessage::VERSION_1_2 = 1 [inherited]

Definition at line 62 of file nsISOAPMessage.idl.

const unsigned short nsISOAPMessage::VERSION_UNKNOWN = 0xFFFF [inherited]

Definition at line 63 of file nsISOAPMessage.idl.


The documentation for this class was generated from the following files: