Compare commits
1 Commits
SOAP_20010
...
src
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
258dc9fead |
@@ -1,50 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 2001 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
|
||||
#include "nsISupports.idl"
|
||||
|
||||
/**
|
||||
* This interface permits attachment of SOAP attachments.
|
||||
*/
|
||||
|
||||
[scriptable, uuid(6192dcbe-1dd2-11b2-81ad-a4597614c4ae)]
|
||||
interface nsISOAPAttachments : nsISupports {
|
||||
|
||||
/**
|
||||
* Get the attachment associated with a particular identifier.
|
||||
*
|
||||
* @param aIdentifier The identifier of the attachment to be accessed.
|
||||
*
|
||||
* Appropriate return(s) must be identified.
|
||||
*/
|
||||
void getAttachment(in AString aIdentifier);
|
||||
|
||||
/**
|
||||
* Attach an attachment to the message.
|
||||
*
|
||||
* Appropriate argument(s) must be identified.
|
||||
*
|
||||
* @return The identifier of the attachment, to be referenced in SOAP encoding
|
||||
*/
|
||||
AString attach();
|
||||
|
||||
};
|
||||
@@ -1,90 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 2001 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
|
||||
#include "nsISupports.idl"
|
||||
#include "nsISOAPMessage.idl"
|
||||
|
||||
interface nsISOAPResponse;
|
||||
interface nsISOAPResponseListener;
|
||||
|
||||
/**
|
||||
* This interface is a convenience extension of the basic SOAP message,
|
||||
* which handles common patterns of calling, such as providing an
|
||||
* action URI in the HTTP header, locating and invoking the appropriate
|
||||
* transport based upon the protocol of the transportURI, and
|
||||
* automatically recieving the result in a new nsISOAPResponse object
|
||||
* which recieves an XML message.
|
||||
*/
|
||||
|
||||
[scriptable, uuid(a8fefe40-52bc-11d4-9a57-000064657374)]
|
||||
interface nsISOAPCall : nsISOAPMessage {
|
||||
|
||||
/**
|
||||
* The URI to which the message will be sent, identifying the
|
||||
* transport and transport-specific information about the
|
||||
* destination.
|
||||
* This does not have to match the <code>targetObjectURI</code>.
|
||||
*/
|
||||
attribute AString transportURI;
|
||||
|
||||
/**
|
||||
* Synchronously invoke the call. The method returns only when
|
||||
* we receive a response (or an error occurs). The
|
||||
* <code>transportURI</code> must have been set, the
|
||||
* parameter list (even if empty) must have been encoded,
|
||||
* and the transportURI must use some known protocol. A
|
||||
* synchronous call assumes that there will be exactly one
|
||||
* response per call.
|
||||
*
|
||||
* If not, an error is returned in the status of the response.
|
||||
*
|
||||
* @returns The SOAP response
|
||||
*/
|
||||
nsISOAPResponse invoke();
|
||||
|
||||
/**
|
||||
* Asynchronously invoke the call. At this point, the document
|
||||
* rooted by the Envelope element is encoded to form the body
|
||||
* of the SOAP message. The method returns immediately, and the
|
||||
* listener is invoked when we eventually receive a response
|
||||
* (or error or successful completion). The
|
||||
* <code>transportURI</code> must have been set, the
|
||||
* parameter list (even if empty) must have been encoded,
|
||||
* and the transportURI must use some known protocol.
|
||||
*
|
||||
* If not, an error is returned in the status of the response.
|
||||
*
|
||||
* @param aListener Handler to be invoked asynchronously after the
|
||||
* response is recieved. Should be null if no response is
|
||||
* expected.
|
||||
*/
|
||||
void asyncInvoke(in nsISOAPResponseListener aListener);
|
||||
};
|
||||
|
||||
%{ C++
|
||||
#define NS_SOAPCALL_CID \
|
||||
{ /* 87d21ec0-539d-11d4-9a59-00104bdf5339 */ \
|
||||
0x87d21ec0, 0x539d, 0x11d4, \
|
||||
{0x9a, 0x59, 0x00, 0x10, 0x4b, 0xdf, 0x53, 0x39} }
|
||||
#define NS_SOAPCALL_CONTRACTID \
|
||||
"@mozilla.org/xmlextras/soap/call;1"
|
||||
%}
|
||||
@@ -1,61 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 2001 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
|
||||
#include "nsISupports.idl"
|
||||
|
||||
interface nsISchemaType;
|
||||
interface nsISOAPEncoding;
|
||||
interface nsIDOMElement;
|
||||
interface nsIVariant;
|
||||
interface nsISOAPAttachments;
|
||||
|
||||
/**
|
||||
* This interface supplies decoding of a specific
|
||||
* part of a message XML DOM into appropriate objects
|
||||
* for the script or application.
|
||||
*/
|
||||
|
||||
[scriptable, uuid(4c2e02ae-1dd2-11b2-b1cd-c79dea3d46db)]
|
||||
interface nsISOAPDecoder : nsISupports {
|
||||
|
||||
/**
|
||||
* Decode the source DOM node
|
||||
*
|
||||
* @param aEncodings The encodings used to decode
|
||||
*
|
||||
* @param aEncodingStyleURI The encoding style
|
||||
*
|
||||
* @param aSource The DOM node to be decoded.
|
||||
*
|
||||
* @param aSchemaType The schema type of the source DOM node
|
||||
*
|
||||
* @param aAttachments Dispenses any attachments.
|
||||
*
|
||||
* @return The decoded variant, which is null if
|
||||
* the operation failed or did not return a result.
|
||||
*/
|
||||
nsIVariant decode(
|
||||
in nsISOAPEncoding aEncoding,
|
||||
in nsIDOMElement aSource,
|
||||
in nsISchemaType aSchemaType,
|
||||
in nsISOAPAttachments aAttachments);
|
||||
};
|
||||
@@ -1,69 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 2001 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
|
||||
#include "nsISupports.idl"
|
||||
|
||||
interface nsISchemaType;
|
||||
interface nsISOAPEncoding;
|
||||
interface nsIVariant;
|
||||
interface nsIDOMElement;
|
||||
interface nsISOAPAttachments;
|
||||
|
||||
/**
|
||||
* This interface permits encoding of variants.
|
||||
*/
|
||||
|
||||
[scriptable, uuid(fc33ffd6-1dd1-11b2-8750-fa62430a38b4)]
|
||||
interface nsISOAPEncoder : nsISupports {
|
||||
|
||||
/**
|
||||
* Encode the source variant.
|
||||
*
|
||||
* @param aEncodings The encodings to be used.
|
||||
*
|
||||
* @param aEncodingStyleURI The encoding style
|
||||
*
|
||||
* @param aSource The variant to be encoded.
|
||||
*
|
||||
* @param aNamespaceURI The namespace of the thing being coded
|
||||
*
|
||||
* @param aName The name of the thing being coded
|
||||
*
|
||||
* @param aSchemaType The schema type of the thing being encoded
|
||||
*
|
||||
* @param aDestination The node scope, if any, where the result
|
||||
* will live. If this is null, then the result must be
|
||||
* explicitly attached to the message.
|
||||
*
|
||||
* @return element which was inserted.
|
||||
*
|
||||
* @param aAttachments Accumulates any attachments.
|
||||
*/
|
||||
nsIDOMElement encode(
|
||||
in nsISOAPEncoding aEncoding,
|
||||
in nsIVariant aSource,
|
||||
in AString aNamespaceURI,
|
||||
in AString aName,
|
||||
in nsISchemaType aSchemaType,
|
||||
in nsISOAPAttachments aAttachments,
|
||||
in nsIDOMElement aDestination);
|
||||
};
|
||||
@@ -1,184 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 2001 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
|
||||
#include "nsISupports.idl"
|
||||
|
||||
interface nsISchemaType;
|
||||
interface nsIDOMElement;
|
||||
interface nsISOAPEncoder;
|
||||
interface nsISOAPDecoder;
|
||||
interface nsISOAPMessage;
|
||||
interface nsIVariant;
|
||||
interface nsISOAPAttachments;
|
||||
interface nsISchemaCollection;
|
||||
|
||||
/**
|
||||
* This interface keeps track of all the known types and how
|
||||
* each should be encoded (by type) or decoded (by
|
||||
* schema type)
|
||||
*/
|
||||
|
||||
[scriptable, uuid(9ae49600-1dd1-11b2-877f-e62f620c5e92)]
|
||||
interface nsISOAPEncoding : nsISupports {
|
||||
|
||||
/**
|
||||
* The name of the encoding as it is known to SOAP.
|
||||
*/
|
||||
readonly attribute AString styleURI;
|
||||
|
||||
/**
|
||||
* Get an alternative encoding.
|
||||
*
|
||||
* @param aStyleURI The style URI of the alternative encoding style.
|
||||
*
|
||||
* @param aCreateIf If true, then create the alternative style if it
|
||||
* does not already exist, otherwise return the existing encoding.
|
||||
*
|
||||
* @return The alternative encoding which corresponds to the
|
||||
* specified styleURI, or null if the spefied alternative encoding
|
||||
* does not exist and it was not requested that it be created.
|
||||
*/
|
||||
nsISOAPEncoding getStyle(
|
||||
in AString aStyleURI,
|
||||
in boolean aCreateIf);
|
||||
|
||||
/**
|
||||
* Set an encoder in the encoding.
|
||||
*
|
||||
* @param aSchemaNamespaceURI The schema namespace URI to serve as key.
|
||||
*
|
||||
* @param aSchemaType The schema type to serve as key.
|
||||
*
|
||||
* @param aEncoder The encoder to be specified or null to eliminate
|
||||
* the encoder.
|
||||
*
|
||||
* @return Old encoder registered under that type in the encoding, which
|
||||
* should be kept by the new encoder if it is to be called back.
|
||||
*/
|
||||
void setEncoder(in AString aSchemaNamespaceURI, in AString aSchemaType,
|
||||
in nsISOAPEncoder aEncoder);
|
||||
|
||||
/**
|
||||
* Get an encoder from the encoding.
|
||||
*
|
||||
* @param aSchemaNamespaceURI The schema namespace URI to serve as key.
|
||||
*
|
||||
* @param aSchemaType The schema type to serve as key.
|
||||
*
|
||||
* @return The encoder.
|
||||
*/
|
||||
nsISOAPEncoder getEncoder(in AString aSchemaNamespaceURI, in AString aSchemaType);
|
||||
|
||||
/**
|
||||
* Set a decoder in the encoding.
|
||||
*
|
||||
* @param aSchemaNamespaceURI The schema namespace URI to serve as key.
|
||||
*
|
||||
* @param aSchemaType The schema type to serve as key.
|
||||
*
|
||||
* @param aDecoder The decoder to be specified or null to eliminate
|
||||
* the decoder.
|
||||
*
|
||||
* @return Old decoder registered under that type in the encoding, which
|
||||
* should be kept by the new decoder if it is to be called back.
|
||||
*/
|
||||
void setDecoder(in AString aSchemaNamespaceURI, in AString aSchemaType,
|
||||
in nsISOAPDecoder aDecoder);
|
||||
|
||||
/**
|
||||
* Get a decoder from the encoding.
|
||||
*
|
||||
* @param aSchemaNamespaceURI The schema namespace URI to serve as key.
|
||||
*
|
||||
* @param aSchemaType The schema type to serve as key.
|
||||
*
|
||||
* @return The decoder.
|
||||
*/
|
||||
nsISOAPDecoder getDecoder(in AString aSchemaNamespaceURI, in AString aSchemaType);
|
||||
|
||||
attribute nsISOAPEncoder defaultEncoder;
|
||||
|
||||
attribute nsISOAPDecoder defaultDecoder;
|
||||
|
||||
attribute nsISchemaCollection schemaCollection;
|
||||
|
||||
/**
|
||||
* Encode the source variant
|
||||
*
|
||||
* @param aEncodings The encodings to be used.
|
||||
*
|
||||
* @param aEncodingStyleURI The encoding style
|
||||
*
|
||||
* @param aSource The variant to be encoded, soon to become a variant
|
||||
*
|
||||
* @param aNamespaceURI The namespace of the thing being coded
|
||||
*
|
||||
* @param aName The name of the thing being coded
|
||||
*
|
||||
* @param aSchemaType The schema type of the thing being encoded
|
||||
*
|
||||
* @param aDestination The node scope where the result will live.
|
||||
*
|
||||
* @param aAttachments Accumulates any attachments.
|
||||
*
|
||||
* @return The element which was inserted and encoded.
|
||||
*/
|
||||
nsIDOMElement encode(
|
||||
in nsIVariant aSource,
|
||||
in AString aNamespaceURI,
|
||||
in AString aName,
|
||||
in nsISchemaType aSchemaType,
|
||||
in nsISOAPAttachments aAttachments,
|
||||
in nsIDOMElement aDestination);
|
||||
|
||||
/**
|
||||
* Decode the source DOM node
|
||||
*
|
||||
* @param aEncodings The encodings used to decode
|
||||
*
|
||||
* @param aEncodingStyleURI The encoding style
|
||||
*
|
||||
* @param aSource The DOM node to be decoded.
|
||||
*
|
||||
* @param aSchemaType The schema type of the source DOM node
|
||||
*
|
||||
* @param aAttachments Dispenses any attachments.
|
||||
*
|
||||
* @return The decoded variant, soon to become a variant, which is null if
|
||||
* the operation failed or did not return a result.
|
||||
*/
|
||||
nsIVariant decode(
|
||||
in nsIDOMElement aSource,
|
||||
in nsISchemaType aSchemaType,
|
||||
in nsISOAPAttachments aAttachments);
|
||||
};
|
||||
|
||||
%{ C++
|
||||
#define NS_DEFAULTSOAPENCODER_CID \
|
||||
{ /* 06fb035c-1dd2-11b2-bc30-f6d8e314d6b9 */ \
|
||||
0x06fb035c, 0x1dd2, 0x11b2, \
|
||||
{0xbc, 0x30, 0xf6, 0xd8, 0xe3, 0x14, 0xd6, 0xb9} }
|
||||
#define NS_SOAPENCODING_CONTRACTID_PREFIX \
|
||||
"@mozilla.org/xmlextras/soap/encoding;1?uri="
|
||||
#define NS_DEFAULTSOAPENCODER_CONTRACTID \
|
||||
NS_SOAPENCODING_CONTRACTID_PREFIX "http://schemas.xmlsoap.org/soap/encoding/"
|
||||
%}
|
||||
@@ -1,69 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 2001 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
|
||||
#include "nsISupports.idl"
|
||||
|
||||
interface nsIDOMElement;
|
||||
|
||||
/**
|
||||
* This interface conveniently interprets information about a fault
|
||||
* that has been returned in a response message.
|
||||
*
|
||||
*/
|
||||
|
||||
[scriptable, uuid(99ec6694-535f-11d4-9a58-000064657374)]
|
||||
interface nsISOAPFault : nsISupports {
|
||||
/**
|
||||
* The DOM element representing the fault in the response SOAP message.
|
||||
* This must be set for the rest of the interface to function correctly.
|
||||
*/
|
||||
attribute nsIDOMElement element;
|
||||
|
||||
/**
|
||||
* The fault code
|
||||
*/
|
||||
readonly attribute AString faultCode;
|
||||
|
||||
/**
|
||||
* The fault string
|
||||
*/
|
||||
readonly attribute AString faultString;
|
||||
|
||||
/**
|
||||
* The fault actor if one was specified.
|
||||
*/
|
||||
readonly attribute AString faultActor;
|
||||
|
||||
/**
|
||||
* The DOM element representing the fault details
|
||||
*/
|
||||
readonly attribute nsIDOMElement detail;
|
||||
};
|
||||
|
||||
%{ C++
|
||||
#define NS_SOAPFAULT_CID \
|
||||
{ /* 87d21ec1-539d-11d4-9a59-00104bdf5339 */ \
|
||||
0x87d21ec1, 0x539d, 0x11d4, \
|
||||
{0x9a, 0x59, 0x00, 0x10, 0x4b, 0xdf, 0x53, 0x39} }
|
||||
#define NS_SOAPFAULT_CONTRACTID \
|
||||
"@mozilla.org/xmlextras/soap/fault;1"
|
||||
%}
|
||||
@@ -1,96 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 2001 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
|
||||
#include "nsISupports.idl"
|
||||
|
||||
interface nsIDOMElement;
|
||||
interface nsIVariant;
|
||||
interface nsISOAPEncoding;
|
||||
interface nsISchemaType;
|
||||
interface nsISOAPAttachments;
|
||||
|
||||
/**
|
||||
* This interface encapsulates an arbitrary header block to be used
|
||||
* by the soap serialization or protocol. It formalizes a type
|
||||
* string, a reference to the object, and a name.
|
||||
*/
|
||||
|
||||
[scriptable, uuid(063d4a4e-1dd2-11b2-a365-cbaf1651f140)]
|
||||
interface nsISOAPHeaderBlock : nsISupports {
|
||||
|
||||
/**
|
||||
* The namespace URI of the header block. Ignored if name is null.
|
||||
*/
|
||||
attribute AString namespaceURI;
|
||||
|
||||
/**
|
||||
* The name of the header block. If the header block is left unnamed, it
|
||||
* will be encoded using the element types defined in the SOAP-ENC
|
||||
* schema. For example, <code><SOAP-ENC:int>45</SOAP-ENC:int>
|
||||
* </code>
|
||||
*/
|
||||
attribute AString name;
|
||||
|
||||
/**
|
||||
* The actor URI of the header block.
|
||||
*/
|
||||
attribute AString actorURI;
|
||||
|
||||
/**
|
||||
* The encoding that was / will be applied to the
|
||||
* header block.
|
||||
*/
|
||||
attribute nsISOAPEncoding encoding;
|
||||
|
||||
/**
|
||||
* The schema type used to encode or decode the
|
||||
* header block.
|
||||
*/
|
||||
attribute nsISchemaType schemaType;
|
||||
|
||||
/**
|
||||
* The element which is the encoded value of this header block.
|
||||
* If this is set, value becomes a computed attribute
|
||||
* which is produced by decoding this element.
|
||||
*/
|
||||
attribute nsIDOMElement element;
|
||||
|
||||
/**
|
||||
* The native value which is the decoded value of
|
||||
* this header block. If this is set, element becomes null.
|
||||
*/
|
||||
attribute nsIVariant value;
|
||||
|
||||
/**
|
||||
* The attachments which were attached to the message.
|
||||
*/
|
||||
attribute nsISOAPAttachments attachments;
|
||||
};
|
||||
|
||||
%{ C++
|
||||
#define NS_SOAPHEADERBLOCK_CID \
|
||||
{ /* 5ad0eace-1dd2-11b2-a260-ff42edcaedb3 */ \
|
||||
0x5ad0eace, 0x1dd2, 0x11b2, \
|
||||
{0xa2, 0x60, 0xff, 0x42, 0xed, 0xca, 0xed, 0xb3} }
|
||||
#define NS_SOAPHEADERBLOCK_CONTRACTID \
|
||||
"@mozilla.org/xmlextras/soap/headerblock;1"
|
||||
%}
|
||||
@@ -1,196 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 2001 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
|
||||
#include "nsISupports.idl"
|
||||
|
||||
interface nsIDOMDocument;
|
||||
interface nsIDOMElement;
|
||||
interface nsISOAPEncoding;
|
||||
interface nsISOAPHeaderBlock;
|
||||
interface nsISOAPParameter;
|
||||
interface nsIVariant;
|
||||
|
||||
/**
|
||||
* 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.
|
||||
*/
|
||||
|
||||
[scriptable, uuid(3970815e-1dd2-11b2-a475-db4dac6826f1)]
|
||||
interface nsISOAPMessage : nsISupports {
|
||||
/**
|
||||
* 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.
|
||||
*/
|
||||
attribute nsIDOMDocument message;
|
||||
|
||||
/**
|
||||
* 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 attribute nsIDOMElement envelope;
|
||||
|
||||
/**
|
||||
* 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.
|
||||
*/
|
||||
readonly attribute nsIDOMElement header;
|
||||
|
||||
/**
|
||||
* 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.
|
||||
*/
|
||||
readonly attribute nsIDOMElement body;
|
||||
|
||||
/**
|
||||
* 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 attribute AString methodName;
|
||||
|
||||
/**
|
||||
* 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 attribute AString targetObjectURI;
|
||||
|
||||
/**
|
||||
* Encodes the specified parameters into this message, if
|
||||
* this message type supports it.
|
||||
*
|
||||
* @param aMethodName The name of the method being invoked
|
||||
* for rpc-style messages. For document-style messages,
|
||||
* this must be null.
|
||||
*
|
||||
* @param aTargetObjectURI The name of the target object
|
||||
* for rpc-style messages. For document-style messages,
|
||||
* this must be null.
|
||||
*
|
||||
* @param aHeaderBlockCount Number of header blocks in array to be
|
||||
* encoded. Must be 0 if header block array is null.
|
||||
*
|
||||
* @param aHeaderBlocks Array of header blocks to be encoded, which
|
||||
* may be null if there are no header blocks.
|
||||
*
|
||||
* @param aParameterCount Number of parameters in array
|
||||
* to be encoded. Must be 0 if parameter array is null.
|
||||
*
|
||||
* @param aParameters An array of parameters to be
|
||||
* encoded, which may null if there are no parameters.
|
||||
*/
|
||||
void encode(
|
||||
in AString aMethodName, in AString aTargetObjectURI,
|
||||
in PRUint32 aHeaderBlockCount,
|
||||
[array, size_is(aHeaderBlockCount)] in nsISOAPHeaderBlock aHeaderBlocks,
|
||||
in PRUint32 aParameterCount,
|
||||
[array, size_is(aParameterCount)] in nsISOAPParameter aParameters);
|
||||
|
||||
/**
|
||||
* Gathers the header blocks of a message so that they can be
|
||||
* accessed by a recipient.
|
||||
*
|
||||
* @param aCount Integer to receive the length of the list
|
||||
* of header blocks.
|
||||
*
|
||||
* @return Array of header blocks found in the message.
|
||||
*/
|
||||
void getHeaderBlocks(out PRUint32 aCount,
|
||||
[array, size_is(aCount), retval] out nsISOAPHeaderBlock aHeaderBlocks);
|
||||
|
||||
/**
|
||||
* Gathers the parameters of a message so that they can be
|
||||
* accessed by a recipient.
|
||||
*
|
||||
* @param aDocumentStyle If true, then the parameters
|
||||
* are looked for treating the message as a document
|
||||
* style message, otherwise it treated as an RPC-style
|
||||
* message.
|
||||
*
|
||||
* @param aCount Integer to receive the length of the list
|
||||
* of parameters.
|
||||
*
|
||||
* @return Array of parameters found in the message.
|
||||
*/
|
||||
void getParameters(in boolean aDocumentStyle,
|
||||
out PRUint32 aCount,
|
||||
[array, size_is(aCount), retval] out nsISOAPParameter aParameters);
|
||||
|
||||
/**
|
||||
* 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.
|
||||
*/
|
||||
attribute nsISOAPEncoding encoding;
|
||||
|
||||
/**
|
||||
* 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.
|
||||
*/
|
||||
attribute AString actionURI;
|
||||
};
|
||||
@@ -1,93 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 2001 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
|
||||
#include "nsISupports.idl"
|
||||
|
||||
interface nsIDOMElement;
|
||||
interface nsIVariant;
|
||||
interface nsISOAPEncoding;
|
||||
interface nsISchemaType;
|
||||
interface nsISOAPAttachments;
|
||||
|
||||
/**
|
||||
* This interface encapsulates an arbitrary parameter to be used
|
||||
* by the soap serialization or protocol. It formalizes a type
|
||||
* string, a reference to the object, and a name.
|
||||
*/
|
||||
|
||||
[scriptable, uuid(99ec6690-535f-11d4-9a58-000064657374)]
|
||||
interface nsISOAPParameter : nsISupports {
|
||||
|
||||
/**
|
||||
* The namespace URI of the parameter. Ignored if name is null.
|
||||
*/
|
||||
attribute AString namespaceURI;
|
||||
|
||||
/**
|
||||
* The name of the parameter. If the parameter is left unnamed, it
|
||||
* will be encoded using the element types defined in the SOAP-ENC
|
||||
* schema. For example, <code><SOAP-ENC:int>45</SOAP-ENC:int>
|
||||
* </code>
|
||||
*/
|
||||
attribute AString name;
|
||||
|
||||
/**
|
||||
* The encoding that was / will be applied to the
|
||||
* parameter.
|
||||
*/
|
||||
attribute nsISOAPEncoding encoding;
|
||||
|
||||
/**
|
||||
* The schema type used to encode or decode the
|
||||
* parameter.
|
||||
*/
|
||||
attribute nsISchemaType schemaType;
|
||||
|
||||
/**
|
||||
* The element which is the encoded value of this parameter.
|
||||
* If this is set, value becomes a computed attribute
|
||||
* which may be produced by decoding this element.
|
||||
*/
|
||||
attribute nsIDOMElement element;
|
||||
|
||||
/**
|
||||
* The native value which is the decoded value of
|
||||
* this parameter. If this is set, element becomes
|
||||
* null.
|
||||
*/
|
||||
attribute nsIVariant value;
|
||||
|
||||
/**
|
||||
* The attachments which were attached to the message
|
||||
* that may be needed to decode the parameter.
|
||||
*/
|
||||
attribute nsISOAPAttachments attachments;
|
||||
};
|
||||
|
||||
%{ C++
|
||||
#define NS_SOAPPARAMETER_CID \
|
||||
{ /* 87d21ec2-539d-11d4-9a59-00104bdf5339 */ \
|
||||
0x87d21ec2, 0x539d, 0x11d4, \
|
||||
{0x9a, 0x59, 0x00, 0x10, 0x4b, 0xdf, 0x53, 0x39} }
|
||||
#define NS_SOAPPARAMETER_CONTRACTID \
|
||||
"@mozilla.org/xmlextras/soap/parameter;1"
|
||||
%}
|
||||
@@ -1,63 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 2001 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
|
||||
#include "nsISupports.idl"
|
||||
#include "nsISOAPCall.idl"
|
||||
|
||||
interface nsISOAPParameter;
|
||||
interface nsISOAPFault;
|
||||
|
||||
/**
|
||||
* This is an extension of a message which contains extra functions
|
||||
* such as tracking, where appropriate, the original call that
|
||||
* produced the response message, identifying the fault, if any,
|
||||
* and supplying the return value.
|
||||
*/
|
||||
|
||||
[scriptable, uuid(99ec6691-535f-11d4-9a58-000064657374)]
|
||||
interface nsISOAPResponse : nsISOAPMessage {
|
||||
/**
|
||||
* The message which generated this response. There is no guarantee
|
||||
* that the message has not been modified since the original call
|
||||
* occurred. This is set automatically when invoking a call that
|
||||
* returns this response. This must also be set by a call processor
|
||||
* so that the transport can return a response to the correct caller.
|
||||
*/
|
||||
attribute nsISOAPCall respondingTo;
|
||||
|
||||
/**
|
||||
* The fault returned in the response, if one was generated. NULL
|
||||
* if there was no fault. This does not rely on the response
|
||||
* parameters having been deserialized.
|
||||
*/
|
||||
readonly attribute nsISOAPFault fault;
|
||||
|
||||
};
|
||||
|
||||
%{ C++
|
||||
#define NS_SOAPRESPONSE_CID \
|
||||
{ /* 87d21ec3-539d-11d4-9a59-00104bdf5339 */ \
|
||||
0x87d21ec3, 0x539d, 0x11d4, \
|
||||
{0x9a, 0x59, 0x00, 0x10, 0x4b, 0xdf, 0x53, 0x39} }
|
||||
#define NS_SOAPRESPONSE_CONTRACTID \
|
||||
"@mozilla.org/xmlextras/soap/response;1"
|
||||
%}
|
||||
@@ -1,61 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 2001 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
|
||||
#include "nsISupports.idl"
|
||||
|
||||
interface nsISOAPCall;
|
||||
interface nsISOAPResponse;
|
||||
|
||||
/**
|
||||
* This interface represents a response handler to be invoked whenever
|
||||
* a response of a particular call is recieved and when no more
|
||||
* responses are expected.
|
||||
*/
|
||||
|
||||
[scriptable, uuid(99ec6692-535f-11d4-9a58-000064657374)]
|
||||
interface nsISOAPResponseListener : nsISupports {
|
||||
/**
|
||||
* This method is invoked when we receive an asynchronous response to
|
||||
* a SOAP message. The listener is registered as part of the original
|
||||
* asynchronous call invocation.
|
||||
*
|
||||
* @param aResponse The decoded version of the response. If an
|
||||
* error occurred transmitting the response, the status field
|
||||
* of the response will contain an error code. The last call
|
||||
* to the listener may contain a null response, which should
|
||||
* only be interpreted as an error if your call expected more
|
||||
* results than it got. If the service or the transport
|
||||
* do not know whether to expect more results, then setting
|
||||
* the last parameter true may only be possible after the
|
||||
* last response has already been delivered.
|
||||
*
|
||||
* @param aLast True if this is the last call to the listener.
|
||||
*
|
||||
* @return True to make this the last call to the listener, even
|
||||
* if last was not true. Calls which expect a single response
|
||||
* should return true upon receiving that response to avoid
|
||||
* possibly recieving another callback with a null response
|
||||
* indicating that the last response was already sent.
|
||||
*/
|
||||
boolean handleResponse(in nsISOAPResponse aResponse,
|
||||
in nsISOAPCall aCall, in unsigned long status, in boolean aLast);
|
||||
};
|
||||
@@ -1,65 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 2001 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
|
||||
#include "nsISupports.idl"
|
||||
|
||||
interface nsISOAPMessage;
|
||||
interface nsISOAPResponseListener;
|
||||
|
||||
/**
|
||||
* This interface describes a service which may be
|
||||
* applied to incoming messages. The service is
|
||||
* responsible for determining whether the message
|
||||
* is one that it should process and rejecting it
|
||||
* if it is not. Services may be chained.
|
||||
*/
|
||||
[scriptable, uuid(9927fa40-1dd1-11b2-a8d1-857ad21b872c)]
|
||||
interface nsISOAPService : nsISupports {
|
||||
/**
|
||||
* Configuration object that may contain more info on the service
|
||||
*/
|
||||
attribute nsISupports configuration;
|
||||
|
||||
/**
|
||||
* Process an incoming message.
|
||||
*
|
||||
* @param aMessage message to be processed
|
||||
*
|
||||
* @param aListener listener to which to report results
|
||||
*
|
||||
* @return True if the message will be handled, false if
|
||||
* it should be given to some other service or fail.
|
||||
* In case of failure, a more detailed status will be
|
||||
* recorded in the message.
|
||||
*/
|
||||
boolean process(in nsISOAPMessage aMessage,
|
||||
in nsISOAPResponseListener aListener);
|
||||
};
|
||||
|
||||
%{ C++
|
||||
#define NS_SOAPJSSERVICE_CID \
|
||||
{ /* 26a41df2-1dd2-11b2-9f29-909e637afa0e */ \
|
||||
0x26a41df2, 0x1dd2, 0x11b2, \
|
||||
{0x9f, 0x29, 0x90, 0x9e, 0x63, 0x7a, 0xfa, 0x0e} }
|
||||
#define NS_SOAPJSSERVICE_CONTRACTID \
|
||||
"@mozilla.org/xmlextras/soap/jsservice;1"
|
||||
%}
|
||||
@@ -1,93 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 2001 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
|
||||
#include "nsISupports.idl"
|
||||
|
||||
interface nsIDOMElement;
|
||||
interface nsISOAPService;
|
||||
interface nsISOAPEncodingRegistry;
|
||||
|
||||
/**
|
||||
* This interface represents a registry of SOAP services.
|
||||
* This registry recieves transports to listen for messages
|
||||
* and services to hand the messages to. Service registries
|
||||
* may be created as required. Destroying a service registry
|
||||
* stops the registry's action. To temporarily register
|
||||
* services, create a new registry. For proper order of
|
||||
* listening precedence, registries should be destroyed
|
||||
* in reverse order. Otherwise, a listening priority
|
||||
* would be required.
|
||||
*/
|
||||
[scriptable, uuid(9790d6bc-1dd1-11b2-afe0-bcb310c078bf)]
|
||||
interface nsISOAPServiceRegistry {
|
||||
/**
|
||||
* Process a configuration and add the resulting sources
|
||||
* and services. This will fail if errors occur during
|
||||
* processing of the configuration.
|
||||
*
|
||||
* @param aConfiguration Root element of configuration XML.
|
||||
*/
|
||||
boolean addConfiguration(in nsIDOMElement aConfiguration);
|
||||
|
||||
/**
|
||||
* Add a transport to be serviced by the registered services.
|
||||
* This will fail if the specified source was already added
|
||||
* with the same setting of the capture flag.
|
||||
*
|
||||
* @param aTransport string specifying the transport to supply
|
||||
* messages for the service.
|
||||
*
|
||||
* @param aCapture True if capturing before later declarations
|
||||
*/
|
||||
void addSource(in AString aTransport, in boolean aCapture);
|
||||
|
||||
/**
|
||||
* Add a service to service the registered transports. This
|
||||
* will fail if the specified service was already added.
|
||||
*
|
||||
* @param aService Service to be serviced.
|
||||
*/
|
||||
void addService(in nsISOAPService aService);
|
||||
|
||||
/**
|
||||
* Registry identifying how to encode and decode
|
||||
* messages containing specific types, automatically
|
||||
* added to messages sent to services in this
|
||||
* registry.
|
||||
*/
|
||||
attribute nsISOAPEncodingRegistry encodings;
|
||||
};
|
||||
|
||||
%{ C++
|
||||
#define NS_SOAPSERVICEREGISTRY_CID \
|
||||
{ /* 3869184e-1dd2-11b2-aa36-d8333498043a */ \
|
||||
0x3869184e, 0x1dd2, 0x11b2, \
|
||||
{0xaa, 0x36, 0xd8, 0x33, 0x34, 0x98, 0x04, 0x3a} }
|
||||
#define NS_SOAPSERVICEREGISTRY_CONTRACTID \
|
||||
"@mozilla.org/xmlextras/soap/serviceregistry;1"
|
||||
#define NS_SOAPDEFAULTSERVICEREGISTRY_CID \
|
||||
{ /* 9120a01e-1dd2-11b2-a61f-906766927a4f */ \
|
||||
0x9120a01e, 0x1dd2, 0x11b2, \
|
||||
{0xa6, 0x1f, 0x90, 0x67, 0x66, 0x92, 0x7a, 0x4f} }
|
||||
#define NS_SOAPDEFAULTSERVICEREGISTRY_CONTRACTID \
|
||||
"@mozilla.org/xmlextras/soap/defaultserviceregistry;1"
|
||||
%}
|
||||
@@ -1,102 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 2001 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
|
||||
#include "nsISupports.idl"
|
||||
|
||||
interface nsISOAPTransportListener;
|
||||
interface nsISOAPCall;
|
||||
interface nsISOAPResponse;
|
||||
interface nsISOAPResponseListener;
|
||||
|
||||
[scriptable, uuid(99ec6695-535f-11d4-9a58-000064657374)]
|
||||
interface nsISOAPTransport : nsISupports {
|
||||
|
||||
/**
|
||||
* Send the specified message to the specified destination.
|
||||
* This will fail if synchronous calls are not supported or if there is any
|
||||
* failure in the actual message exchange. Failure of the call itself will be
|
||||
* contained in the response.
|
||||
*
|
||||
* @param aCall Actual message to be sent.
|
||||
*
|
||||
* @param aResponse Message to be recieved. Calling synchronously assumes that
|
||||
* exactly one response is expected.
|
||||
*/
|
||||
void syncCall( in nsISOAPCall aCall,
|
||||
in nsISOAPResponse aResponse);
|
||||
|
||||
/**
|
||||
* Send the specified message to the specified destination synchronously waiting
|
||||
* for completion and any response.
|
||||
* This will fail if there is any failure in the setup of the message exchange.
|
||||
* Later errors will only be known through the response listener. Failures of the
|
||||
* call itself will be contained in the response passed to the response listener.
|
||||
*
|
||||
* @param aCall Actual message to be sent.
|
||||
*
|
||||
* @param aListener Handler to be invoked (single threaded) as each response is
|
||||
* received and finally with null. If specified as null, no responses are returned.
|
||||
*
|
||||
* @param response Message to recieve response and be handled by listener. May be
|
||||
* null if listener is null.
|
||||
*/
|
||||
void asyncCall(in nsISOAPCall aCall,
|
||||
in nsISOAPResponseListener aListener,
|
||||
in nsISOAPResponse aResponse);
|
||||
|
||||
/**
|
||||
* Add listener for unsolicited messages arriving on the transport. Listeners
|
||||
* are provided with the opportunity to accept and process messages. Typically
|
||||
* a listener will be a service dispatcher. Listeners will be invoked in the
|
||||
* reverse order of declaration, allowing more local service dispatchers to
|
||||
* temporarily override permanent service dispatchers. This will fail if the
|
||||
* desired listener was already added to the transport with the specified
|
||||
* capture flag or if the transport does not support incoming messages.
|
||||
*
|
||||
* @param aListener The listener to recieve unsolicited messages from the
|
||||
* transport.
|
||||
*
|
||||
* @param aCapture True if the listener should capture the message before
|
||||
* later-declared services.
|
||||
*/
|
||||
void addListener(in nsISOAPTransportListener aListener, in boolean aCapture);
|
||||
|
||||
/**
|
||||
* Remove listener for unsolicited messages arriving on the transport. This
|
||||
* will fail if the specified listener was not added with the specified
|
||||
* capture setting.
|
||||
*
|
||||
* @param aListener The listener to stop from recieving unsolicited messages
|
||||
* from the transport.
|
||||
*
|
||||
* @param aCapture True if the listener was added to capture the message before
|
||||
* later-declared services (must be specified to remove, since a listener
|
||||
* may be registered as both).
|
||||
*/
|
||||
void removeListener(in nsISOAPTransportListener aListener, in boolean aCapture);
|
||||
};
|
||||
|
||||
%{ C++
|
||||
#define NS_SOAPTRANSPORT_CONTRACTID \
|
||||
"@mozilla.org/xmlextras/soap/transport;1"
|
||||
#define NS_SOAPTRANSPORT_CONTRACTID_PREFIX NS_SOAPTRANSPORT_CONTRACTID "?protocol="
|
||||
%}
|
||||
@@ -1,50 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 2001 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
|
||||
#include "nsISupports.idl"
|
||||
|
||||
interface nsIDOMDocument;
|
||||
interface nsISOAPMessage;
|
||||
|
||||
/**
|
||||
* This interface recieves control when an unsolicited transport
|
||||
* is recieved on a transport.
|
||||
*/
|
||||
|
||||
[scriptable, uuid(99ec6696-535f-11d4-9a58-000064657374)]
|
||||
interface nsISOAPTransportListener : nsISupports {
|
||||
|
||||
/**
|
||||
* This method is invoked when an unsolicited message is
|
||||
* recieved. First all listeners are tried in the order declared
|
||||
* with the capture flag set. Then all listeners are tried in
|
||||
* the reverse order declared with the capture flag clear.
|
||||
*
|
||||
* @param aMessage Actual message.
|
||||
*
|
||||
* @param aCapture True if the listener is being permitted to gain
|
||||
* control before all later-added listeners.
|
||||
*
|
||||
* @return true if message is handled, false if it was not
|
||||
*/
|
||||
boolean handleMessage(in nsISOAPMessage aMessage, in boolean aCapture);
|
||||
};
|
||||
@@ -1,31 +0,0 @@
|
||||
#
|
||||
# The contents of this file are subject to the Mozilla Public
|
||||
# License Version 1.1 (the "License"); you may not use this file
|
||||
# except in compliance with the License. You may obtain a copy of
|
||||
# the License at http://www.mozilla.org/MPL/
|
||||
#
|
||||
# Software distributed under the License is distributed on an "AS
|
||||
# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
# implied. See the License for the specific language governing
|
||||
# rights and limitations under the License.
|
||||
#
|
||||
# The Original Code is mozilla.org code.
|
||||
#
|
||||
# The Initial Developer of the Original Code is Netscape
|
||||
# Communications Corporation. Portions created by Netscape are
|
||||
# Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
# Rights Reserved.
|
||||
#
|
||||
# Contributor(s):
|
||||
#
|
||||
|
||||
DEPTH = ../../..
|
||||
topsrcdir = @top_srcdir@
|
||||
srcdir = @srcdir@
|
||||
VPATH = @srcdir@
|
||||
|
||||
include $(DEPTH)/config/autoconf.mk
|
||||
|
||||
DIRS = public src
|
||||
|
||||
include $(topsrcdir)/config/rules.mk
|
||||
@@ -1,52 +0,0 @@
|
||||
#
|
||||
# The contents of this file are subject to the Mozilla Public
|
||||
# License Version 1.1 (the "License"); you may not use this file
|
||||
# except in compliance with the License. You may obtain a copy of
|
||||
# the License at http://www.mozilla.org/MPL/
|
||||
#
|
||||
# Software distributed under the License is distributed on an "AS
|
||||
# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
# implied. See the License for the specific language governing
|
||||
# rights and limitations under the License.
|
||||
#
|
||||
# The Original Code is mozilla.org code.
|
||||
#
|
||||
# The Initial Developer of the Original Code is Netscape
|
||||
# Communications Corporation. Portions created by Netscape are
|
||||
# Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
# Rights Reserved.
|
||||
#
|
||||
# Contributor(s):
|
||||
#
|
||||
|
||||
DEPTH = ../../../..
|
||||
topsrcdir = @top_srcdir@
|
||||
srcdir = @srcdir@
|
||||
VPATH = @srcdir@
|
||||
|
||||
include $(DEPTH)/config/autoconf.mk
|
||||
|
||||
MODULE = xmlextras
|
||||
LIBRARY_NAME = xmlextrassoap_s
|
||||
REQUIRES = xpcom string caps dom js widget xpconnect necko schema
|
||||
|
||||
CPPSRCS = \
|
||||
nsDefaultSOAPEncoder.cpp\
|
||||
nsHTTPSOAPTransport.cpp \
|
||||
nsSOAPCall.cpp \
|
||||
nsSOAPEncoding.cpp \
|
||||
nsSOAPFault.cpp \
|
||||
nsSOAPHeaderBlock.cpp \
|
||||
nsSOAPMessage.cpp \
|
||||
nsSOAPParameter.cpp \
|
||||
nsSOAPResponse.cpp \
|
||||
nsSOAPUtils.cpp \
|
||||
$(NULL)
|
||||
|
||||
# we don't want the shared lib, but we want to force the creation of a
|
||||
# static lib.
|
||||
FORCE_STATIC_LIB = 1
|
||||
#override NO_SHARED_LIB=1
|
||||
#override NO_STATIC_LIB=
|
||||
|
||||
include $(topsrcdir)/config/rules.mk
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,34 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
|
||||
#ifndef nsDefaultSOAPEncoder_h__
|
||||
#define nsDefaultSOAPEncoder_h__
|
||||
|
||||
#include "nsSOAPEncoding.h"
|
||||
|
||||
class nsDefaultSOAPEncoder : public nsSOAPEncoding
|
||||
{
|
||||
public:
|
||||
nsDefaultSOAPEncoder();
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -1,196 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
|
||||
#include "nsHTTPSOAPTransport.h"
|
||||
#include "nsIComponentManager.h"
|
||||
#include "nsIDOMDocument.h"
|
||||
#include "nsString.h"
|
||||
#include "nsSOAPUtils.h"
|
||||
#include "nsSOAPCall.h"
|
||||
#include "nsSOAPResponse.h"
|
||||
#include "nsIDOMEventTarget.h"
|
||||
|
||||
nsHTTPSOAPTransport::nsHTTPSOAPTransport()
|
||||
{
|
||||
NS_INIT_ISUPPORTS();
|
||||
}
|
||||
|
||||
nsHTTPSOAPTransport::~nsHTTPSOAPTransport()
|
||||
{
|
||||
}
|
||||
|
||||
NS_IMPL_ISUPPORTS1_CI(nsHTTPSOAPTransport, nsISOAPTransport)
|
||||
|
||||
/* void syncCall (in nsISOAPCall aCall, in nsISOAPResponse aResponse); */
|
||||
NS_IMETHODIMP nsHTTPSOAPTransport::SyncCall(nsISOAPCall *aCall, nsISOAPResponse *aResponse)
|
||||
{
|
||||
NS_ENSURE_ARG(aCall);
|
||||
|
||||
nsresult rv;
|
||||
nsCOMPtr<nsIXMLHttpRequest> request;
|
||||
|
||||
request = do_CreateInstance(NS_XMLHTTPREQUEST_CONTRACTID, &rv);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
nsAutoString action;
|
||||
rv = aCall->GetActionURI(action);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
if (!AStringIsNull(action)) {
|
||||
rv = request->SetRequestHeader("SOAPAction", NS_ConvertUCS2toUTF8(action).get());
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
}
|
||||
|
||||
nsAutoString uri;
|
||||
rv = aCall->GetTransportURI(uri);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
if (!AStringIsNull(uri)) return NS_ERROR_NOT_INITIALIZED;
|
||||
|
||||
nsCOMPtr<nsIDOMDocument> messageDocument;
|
||||
rv = aCall->GetMessage(getter_AddRefs(messageDocument));
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
if (!messageDocument) return NS_ERROR_NOT_INITIALIZED;
|
||||
|
||||
rv = request->OpenRequest("POST", NS_ConvertUCS2toUTF8(uri).get(), PR_FALSE, nsnull, nsnull);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
rv = request->Send(messageDocument);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
request->GetStatus(&rv);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
if (aResponse) {
|
||||
nsCOMPtr<nsIDOMDocument> response;
|
||||
rv = request->GetResponseXML(getter_AddRefs(response));
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
rv = aResponse->SetMessage(response);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
class nsHTTPSOAPTransportCompletion : public nsIDOMEventListener
|
||||
{
|
||||
public:
|
||||
nsHTTPSOAPTransportCompletion();
|
||||
virtual ~nsHTTPSOAPTransportCompletion();
|
||||
|
||||
NS_DECL_ISUPPORTS
|
||||
|
||||
// nsIDOMEventListener
|
||||
NS_IMETHOD HandleEvent(nsIDOMEvent* aEvent);
|
||||
|
||||
protected:
|
||||
nsCOMPtr<nsISOAPCall> mCall;
|
||||
nsCOMPtr<nsISOAPResponse> mResponse;
|
||||
nsCOMPtr<nsIXMLHttpRequest> mRequest;
|
||||
nsCOMPtr<nsISOAPResponseListener> mListener;
|
||||
};
|
||||
|
||||
NS_IMPL_ISUPPORTS1(nsHTTPSOAPTransportCompletion, nsIDOMEventListener)
|
||||
|
||||
nsHTTPSOAPTransportCompletion::nsHTTPSOAPTransportCompletion()
|
||||
{
|
||||
NS_INIT_ISUPPORTS();
|
||||
}
|
||||
nsHTTPSOAPTransportCompletion::~nsHTTPSOAPTransportCompletion()
|
||||
{
|
||||
}
|
||||
NS_IMETHODIMP
|
||||
nsHTTPSOAPTransportCompletion::HandleEvent(nsIDOMEvent* aEvent)
|
||||
{
|
||||
nsresult rv;
|
||||
mRequest->GetStatus(&rv);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsCOMPtr<nsIDOMDocument> document;
|
||||
rv = mRequest->GetResponseXML(getter_AddRefs(document));
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
rv = mResponse->SetMessage(document);
|
||||
}
|
||||
}
|
||||
PRBool c; // In other transports, this may signal to stop returning if multiple returns
|
||||
mListener->HandleResponse(mResponse, mCall, (PRInt32)rv, PR_TRUE, &c);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/* void asyncCall (in nsISOAPCall aCall, in nsISOAPResponseListener aListener, in nsISOAPResponse aResponse); */
|
||||
NS_IMETHODIMP nsHTTPSOAPTransport::AsyncCall(nsISOAPCall *aCall, nsISOAPResponseListener *aListener, nsISOAPResponse *aResponse)
|
||||
{
|
||||
NS_ENSURE_ARG(aCall);
|
||||
|
||||
nsresult rv;
|
||||
nsCOMPtr<nsIXMLHttpRequest> request;
|
||||
|
||||
nsCOMPtr<nsIDOMEventTarget> eventTarget = do_QueryInterface(request, &rv);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
request = do_CreateInstance(NS_XMLHTTPREQUEST_CONTRACTID, &rv);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
nsAutoString action;
|
||||
rv = aCall->GetActionURI(action);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
if (!AStringIsNull(action)) {
|
||||
rv = request->SetRequestHeader("SOAPAction", NS_ConvertUCS2toUTF8(action).get());
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
}
|
||||
nsCOMPtr<nsIDOMEventListener> listener = new nsHTTPSOAPTransportCompletion();
|
||||
if (!listener) return NS_ERROR_OUT_OF_MEMORY;
|
||||
|
||||
nsAutoString uri;
|
||||
rv = aCall->GetTransportURI(uri);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
if (!AStringIsNull(uri)) return NS_ERROR_NOT_INITIALIZED;
|
||||
|
||||
nsCOMPtr<nsIDOMDocument> messageDocument;
|
||||
rv = aCall->GetMessage(getter_AddRefs(messageDocument));
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
if (!messageDocument) return NS_ERROR_NOT_INITIALIZED;
|
||||
|
||||
rv = request->OpenRequest("POST", NS_ConvertUCS2toUTF8(uri).get(), PR_TRUE, nsnull, nsnull);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
rv = request->Send(messageDocument);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
eventTarget->AddEventListener(NS_LITERAL_STRING("load"), listener, PR_FALSE);
|
||||
eventTarget->AddEventListener(NS_LITERAL_STRING("error"), listener, PR_FALSE);
|
||||
|
||||
rv = request->Send(messageDocument);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/* void addListener (in nsISOAPTransportListener aListener, in boolean aCapture); */
|
||||
NS_IMETHODIMP nsHTTPSOAPTransport::AddListener(nsISOAPTransportListener *aListener, PRBool aCapture)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
/* void removeListener (in nsISOAPTransportListener aListener, in boolean aCapture); */
|
||||
NS_IMETHODIMP nsHTTPSOAPTransport::RemoveListener(nsISOAPTransportListener *aListener, PRBool aCapture)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
@@ -1,50 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
|
||||
#ifndef nsHTTPSOAPTransport_h__
|
||||
#define nsHTTPSOAPTransport_h__
|
||||
|
||||
#include "nsISOAPTransport.h"
|
||||
#include "nsIXMLHttpRequest.h"
|
||||
#include "nsIDOMEventListener.h"
|
||||
#include "nsISOAPTransportListener.h"
|
||||
#include "nsCOMPtr.h"
|
||||
|
||||
class nsHTTPSOAPTransport : public nsISOAPTransport
|
||||
{
|
||||
public:
|
||||
nsHTTPSOAPTransport();
|
||||
virtual ~nsHTTPSOAPTransport();
|
||||
|
||||
NS_DECL_ISUPPORTS
|
||||
|
||||
// nsISOAPTransport
|
||||
NS_DECL_NSISOAPTRANSPORT
|
||||
};
|
||||
|
||||
#define NS_HTTPSOAPTRANSPORT_CID \
|
||||
{ /* d852ade0-5823-11d4-9a62-00104bdf5339 */ \
|
||||
0xd852ade0, 0x5823, 0x11d4, \
|
||||
{0x9a, 0x62, 0x00, 0x10, 0x4b, 0xdf, 0x53, 0x39} }
|
||||
#define NS_HTTPSOAPTRANSPORT_CONTRACTID NS_SOAPTRANSPORT_CONTRACTID_PREFIX "http"
|
||||
|
||||
#endif
|
||||
@@ -1,187 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
|
||||
#include "nsSOAPCall.h"
|
||||
#include "nsSOAPResponse.h"
|
||||
#include "nsSOAPUtils.h"
|
||||
#include "nsISOAPTransport.h"
|
||||
#include "nsIServiceManager.h"
|
||||
#include "nsIComponentManager.h"
|
||||
#include "nsIURI.h"
|
||||
#include "nsNetUtil.h"
|
||||
|
||||
/////////////////////////////////////////////
|
||||
//
|
||||
//
|
||||
/////////////////////////////////////////////
|
||||
|
||||
nsSOAPCall::nsSOAPCall()
|
||||
{
|
||||
}
|
||||
|
||||
nsSOAPCall::~nsSOAPCall()
|
||||
{
|
||||
}
|
||||
|
||||
NS_IMPL_CI_INTERFACE_GETTER2(nsSOAPCall, nsISOAPMessage, nsISOAPCall)
|
||||
NS_IMPL_ADDREF_INHERITED(nsSOAPCall, nsSOAPMessage)
|
||||
NS_IMPL_RELEASE_INHERITED(nsSOAPCall, nsSOAPMessage)
|
||||
|
||||
NS_INTERFACE_MAP_BEGIN(nsSOAPCall)
|
||||
NS_INTERFACE_MAP_ENTRY(nsISOAPCall)
|
||||
NS_IMPL_QUERY_CLASSINFO(nsSOAPCall)
|
||||
NS_INTERFACE_MAP_END_INHERITING(nsSOAPMessage)
|
||||
|
||||
/* attribute DOMString transportURI; */
|
||||
NS_IMETHODIMP nsSOAPCall::GetTransportURI(nsAWritableString & aTransportURI)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(&aTransportURI);
|
||||
aTransportURI.Assign(mTransportURI);
|
||||
return NS_OK;
|
||||
}
|
||||
NS_IMETHODIMP nsSOAPCall::SetTransportURI(const nsAReadableString & aTransportURI)
|
||||
{
|
||||
mTransportURI.Assign(aTransportURI);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsSOAPCall::GetTransport(nsISOAPTransport** aTransport)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aTransport);
|
||||
nsresult rv;
|
||||
nsCOMPtr<nsIURI> uri;
|
||||
nsXPIDLCString protocol;
|
||||
nsCString transportURI(ToNewCString(mTransportURI));
|
||||
|
||||
rv = NS_NewURI(getter_AddRefs(uri), transportURI.get());
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
uri->GetScheme(getter_Copies(protocol));
|
||||
|
||||
nsCAutoString transportContractid;
|
||||
transportContractid.Assign(NS_SOAPTRANSPORT_CONTRACTID_PREFIX);
|
||||
transportContractid.Append(protocol);
|
||||
|
||||
nsCOMPtr<nsISOAPTransport> transport = do_GetService(transportContractid.get(), &rv);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
*aTransport = transport.get();
|
||||
NS_ADDREF(*aTransport);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/* nsISOAPResponse invoke (); */
|
||||
NS_IMETHODIMP nsSOAPCall::Invoke(nsISOAPResponse **_retval)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(_retval);
|
||||
nsresult rv;
|
||||
nsCOMPtr<nsISOAPTransport> transport;
|
||||
|
||||
if (mTransportURI.Length() == 0) {
|
||||
return NS_ERROR_NOT_INITIALIZED;
|
||||
}
|
||||
|
||||
rv = GetTransport(getter_AddRefs(transport));
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
nsCOMPtr<nsISOAPResponse> response;
|
||||
response = new nsSOAPResponse();
|
||||
if (!response) return NS_ERROR_OUT_OF_MEMORY;
|
||||
rv = response->SetEncoding(mEncoding);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
rv = transport->SyncCall(this, response);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
return response->QueryInterface(NS_GET_IID(nsISOAPResponse), (void**)_retval);
|
||||
}
|
||||
|
||||
/* void asyncInvoke (in nsISOAPResponseListener listener); */
|
||||
NS_IMETHODIMP nsSOAPCall::AsyncInvoke(nsISOAPResponseListener *listener)
|
||||
{
|
||||
nsresult rv;
|
||||
nsCOMPtr<nsISOAPTransport> transport;
|
||||
|
||||
if (mTransportURI.Length() == 0) {
|
||||
return NS_ERROR_NOT_INITIALIZED;
|
||||
}
|
||||
|
||||
rv = GetTransport(getter_AddRefs(transport));
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
nsCOMPtr<nsISOAPResponse> response;
|
||||
response = new nsSOAPResponse();
|
||||
if (!response) return NS_ERROR_OUT_OF_MEMORY;
|
||||
rv = response->SetEncoding(mEncoding);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
rv = transport->AsyncCall(this, listener, response);
|
||||
return rv;
|
||||
}
|
||||
|
||||
static const char* kAllAccess = "AllAccess";
|
||||
|
||||
/* string canCreateWrapper (in nsIIDPtr iid); */
|
||||
NS_IMETHODIMP
|
||||
nsSOAPCall::CanCreateWrapper(const nsIID * iid, char **_retval)
|
||||
{
|
||||
if (iid->Equals(NS_GET_IID(nsISOAPCall))) {
|
||||
*_retval = nsCRT::strdup(kAllAccess);
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/* string canCallMethod (in nsIIDPtr iid, in wstring methodName); */
|
||||
NS_IMETHODIMP
|
||||
nsSOAPCall::CanCallMethod(const nsIID * iid, const PRUnichar *methodName, char **_retval)
|
||||
{
|
||||
if (iid->Equals(NS_GET_IID(nsISOAPCall))) {
|
||||
*_retval = nsCRT::strdup(kAllAccess);
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/* string canGetProperty (in nsIIDPtr iid, in wstring propertyName); */
|
||||
NS_IMETHODIMP
|
||||
nsSOAPCall::CanGetProperty(const nsIID * iid, const PRUnichar *propertyName, char **_retval)
|
||||
{
|
||||
if (iid->Equals(NS_GET_IID(nsISOAPCall))) {
|
||||
*_retval = nsCRT::strdup(kAllAccess);
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/* string canSetProperty (in nsIIDPtr iid, in wstring propertyName); */
|
||||
NS_IMETHODIMP
|
||||
nsSOAPCall::CanSetProperty(const nsIID * iid, const PRUnichar *propertyName, char **_retval)
|
||||
{
|
||||
if (iid->Equals(NS_GET_IID(nsISOAPCall))) {
|
||||
*_retval = nsCRT::strdup(kAllAccess);
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
@@ -1,58 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
|
||||
#ifndef nsSOAPCall_h__
|
||||
#define nsSOAPCall_h__
|
||||
|
||||
#include "nsString.h"
|
||||
#include "nsSOAPMessage.h"
|
||||
#include "nsISOAPCall.h"
|
||||
#include "nsISecurityCheckedComponent.h"
|
||||
#include "nsISOAPTransport.h"
|
||||
#include "nsISOAPResponseListener.h"
|
||||
#include "nsCOMPtr.h"
|
||||
|
||||
class nsSOAPCall : public nsSOAPMessage,
|
||||
public nsISOAPCall
|
||||
{
|
||||
public:
|
||||
nsSOAPCall();
|
||||
virtual ~nsSOAPCall();
|
||||
|
||||
NS_DECL_ISUPPORTS
|
||||
|
||||
// nsISOAPCall
|
||||
NS_FORWARD_NSISOAPMESSAGE(nsSOAPMessage::)
|
||||
|
||||
// nsISOAPCall
|
||||
NS_DECL_NSISOAPCALL
|
||||
|
||||
// nsISecurityCheckedComponent
|
||||
NS_DECL_NSISECURITYCHECKEDCOMPONENT
|
||||
|
||||
protected:
|
||||
|
||||
nsString mTransportURI;
|
||||
nsresult GetTransport(nsISOAPTransport** aTransport);
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -1,405 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
|
||||
#include "nsString.h"
|
||||
#include "nsISOAPParameter.h"
|
||||
#include "nsSOAPMessage.h"
|
||||
#include "nsISOAPEncoder.h"
|
||||
#include "nsISOAPDecoder.h"
|
||||
#include "nsSOAPEncoding.h"
|
||||
#include "nsSOAPUtils.h"
|
||||
#include "nsIServiceManager.h"
|
||||
#include "nsIComponentManager.h"
|
||||
#include "nsIDOMNodeList.h"
|
||||
#include "nsISchema.h"
|
||||
#include "nsISchemaLoader.h"
|
||||
#include "nsSOAPUtils.h"
|
||||
|
||||
// First comes the registry which shares between associated encodings but is never seen by xpconnect.
|
||||
|
||||
NS_IMPL_ISUPPORTS1(nsSOAPEncodingRegistry,nsISOAPEncoding)
|
||||
|
||||
nsSOAPEncodingRegistry::nsSOAPEncodingRegistry(nsISOAPEncoding* aEncoding): mEncodings(new nsSupportsHashtable)
|
||||
{
|
||||
NS_INIT_ISUPPORTS();
|
||||
|
||||
nsAutoString style;
|
||||
aEncoding->GetStyleURI(style);
|
||||
nsStringKey styleKey(style);
|
||||
mEncodings->Put(&styleKey, aEncoding);
|
||||
/* member initializers and constructor code */
|
||||
}
|
||||
|
||||
nsSOAPEncodingRegistry::~nsSOAPEncodingRegistry()
|
||||
{
|
||||
/* destructor code */
|
||||
delete mEncodings;
|
||||
}
|
||||
|
||||
nsresult nsSOAPEncodingRegistry::GetStyle(const nsAString& aStyleURI, PRBool aCreateIf, nsISOAPEncoding* * aEncoding)
|
||||
{
|
||||
NS_SOAP_ENSURE_ARG_STRING(aStyleURI);
|
||||
NS_ENSURE_ARG_POINTER(aEncoding);
|
||||
nsStringKey styleKey(aStyleURI);
|
||||
*aEncoding = (nsISOAPEncoding*)mEncodings->Get(&styleKey);
|
||||
if (!*aEncoding)
|
||||
{
|
||||
nsCOMPtr<nsISOAPEncoding> defaultEncoding;
|
||||
nsCAutoString encodingContractid;
|
||||
encodingContractid.Assign(NS_SOAPENCODING_CONTRACTID_PREFIX);
|
||||
encodingContractid.Append(NS_ConvertUCS2toUTF8(aStyleURI));
|
||||
defaultEncoding = do_GetService(encodingContractid.get());
|
||||
if (defaultEncoding || aCreateIf) {
|
||||
*aEncoding = new nsSOAPEncoding(aStyleURI, this, defaultEncoding);
|
||||
mEncodings->Put(&styleKey, *aEncoding);
|
||||
}
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
nsresult nsSOAPEncodingRegistry::SetSchemaCollection(nsISchemaCollection* aSchemaCollection)
|
||||
{
|
||||
NS_ENSURE_ARG(aSchemaCollection);
|
||||
mSchemaCollection = aSchemaCollection;
|
||||
return NS_OK;
|
||||
}
|
||||
nsresult nsSOAPEncodingRegistry::GetSchemaCollection(nsISchemaCollection** aSchemaCollection)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aSchemaCollection);
|
||||
if (!mSchemaCollection) {
|
||||
nsresult rv;
|
||||
nsCOMPtr<nsISchemaLoader>loader = do_CreateInstance(NS_SCHEMALOADER_CONTRACTID, &rv);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
mSchemaCollection = do_QueryInterface(loader);
|
||||
if (!mSchemaCollection) return NS_ERROR_FAILURE;
|
||||
}
|
||||
*aSchemaCollection = mSchemaCollection;
|
||||
NS_ADDREF(*aSchemaCollection);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/* readonly attribute AString styleURI; */
|
||||
NS_IMETHODIMP nsSOAPEncodingRegistry::GetStyleURI(nsAString & aStyleURI)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
/* nsISOAPEncoder setEncoder (in AString aSchemaNamespaceURI, in AString aSchemaType, in nsISOAPEncoder aEncoder); */
|
||||
NS_IMETHODIMP nsSOAPEncodingRegistry::SetEncoder(const nsAString & aSchemaNamespaceURI, const nsAString & aSchemaType, nsISOAPEncoder *aEncoder)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
/* nsISOAPEncoder getEncoder (in AString aSchemaNamespaceURI, in AString aSchemaType); */
|
||||
NS_IMETHODIMP nsSOAPEncodingRegistry::GetEncoder(const nsAString & aSchemaNamespaceURI, const nsAString & aSchemaType, nsISOAPEncoder **_retval)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
/* nsISOAPDecoder setDecoder (in AString aSchemaNamespaceURI, in AString aSchemaType, in nsISOAPDecoder aDecoder); */
|
||||
NS_IMETHODIMP nsSOAPEncodingRegistry::SetDecoder(const nsAString & aSchemaNamespaceURI, const nsAString & aSchemaType, nsISOAPDecoder *aDecoder)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
/* nsISOAPDecoder getDecoder (in AString aSchemaNamespaceURI, in AString aSchemaType); */
|
||||
NS_IMETHODIMP nsSOAPEncodingRegistry::GetDecoder(const nsAString & aSchemaNamespaceURI, const nsAString & aSchemaType, nsISOAPDecoder **_retval)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
/* attribute nsISOAPEncoder defaultEncoder; */
|
||||
NS_IMETHODIMP nsSOAPEncodingRegistry::GetDefaultEncoder(nsISOAPEncoder * *aDefaultEncoder)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
NS_IMETHODIMP nsSOAPEncodingRegistry::SetDefaultEncoder(nsISOAPEncoder * aDefaultEncoder)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
/* attribute nsISOAPDecoder defaultDecoder; */
|
||||
NS_IMETHODIMP nsSOAPEncodingRegistry::GetDefaultDecoder(nsISOAPDecoder * *aDefaultDecoder)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
NS_IMETHODIMP nsSOAPEncodingRegistry::SetDefaultDecoder(nsISOAPDecoder * aDefaultDecoder)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
/* nsIDOMElement encode (in nsIVariant aSource, in AString aNamespaceURI, in AString aName, in nsISchemaType aSchemaType, in nsISOAPAttachments aAttachments, in nsIDOMElement aDestination); */
|
||||
NS_IMETHODIMP nsSOAPEncodingRegistry::Encode(nsIVariant *aSource, const nsAString & aNamespaceURI, const nsAString & aName, nsISchemaType *aSchemaType, nsISOAPAttachments *aAttachments, nsIDOMElement *aDestination, nsIDOMElement **_retval)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
/* nsIVariant decode (in nsIDOMElement aSource, in nsISchemaType aSchemaType, in nsISOAPAttachments aAttachments); */
|
||||
NS_IMETHODIMP nsSOAPEncodingRegistry::Decode(nsIDOMElement *aSource, nsISchemaType *aSchemaType, nsISOAPAttachments *aAttachments, nsIVariant **_retval)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
// Second, we create the encodings themselves.
|
||||
|
||||
NS_IMPL_ISUPPORTS2(nsSOAPEncoding, nsISOAPEncoding, nsISecurityCheckedComponent)
|
||||
|
||||
nsSOAPEncoding::nsSOAPEncoding(): mEncoders(new nsSupportsHashtable),
|
||||
mDecoders(new nsSupportsHashtable)
|
||||
{
|
||||
NS_INIT_ISUPPORTS();
|
||||
|
||||
/* member initializers and constructor code */
|
||||
|
||||
mStyleURI.Assign(nsSOAPUtils::kSOAPEncodingURI);
|
||||
mDefaultEncoding = do_GetService(NS_DEFAULTSOAPENCODER_CONTRACTID);
|
||||
mRegistry = new nsSOAPEncodingRegistry(this);
|
||||
}
|
||||
|
||||
nsSOAPEncoding::nsSOAPEncoding(const nsAString& aStyleURI, nsSOAPEncodingRegistry* aRegistry, nsISOAPEncoding* aDefaultEncoding)
|
||||
: mEncoders(new nsSupportsHashtable), mDecoders(new nsSupportsHashtable)
|
||||
{
|
||||
NS_INIT_ISUPPORTS();
|
||||
|
||||
/* member initializers and constructor code */
|
||||
|
||||
mStyleURI.Assign(aStyleURI);
|
||||
mRegistry = aRegistry;
|
||||
mDefaultEncoding = aDefaultEncoding;
|
||||
}
|
||||
|
||||
nsSOAPEncoding::~nsSOAPEncoding()
|
||||
{
|
||||
/* destructor code */
|
||||
delete mEncoders;
|
||||
delete mDecoders;
|
||||
}
|
||||
|
||||
nsresult nsSOAPEncoding::SetSchemaCollection(nsISchemaCollection* aSchemaCollection)
|
||||
{
|
||||
NS_ENSURE_ARG(aSchemaCollection);
|
||||
return mRegistry->SetSchemaCollection(aSchemaCollection);
|
||||
}
|
||||
nsresult nsSOAPEncoding::GetSchemaCollection(nsISchemaCollection** aSchemaCollection)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aSchemaCollection);
|
||||
return mRegistry->GetSchemaCollection(aSchemaCollection);
|
||||
}
|
||||
|
||||
/* readonly attribute AString styleURI; */
|
||||
NS_IMETHODIMP nsSOAPEncoding::GetStyleURI(nsAString & aStyleURI)
|
||||
{
|
||||
NS_SOAP_ENSURE_ARG_STRING(aStyleURI);
|
||||
aStyleURI.Assign(mStyleURI);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/* nsISOAPEncoding getStyle (in AString aStyleURI, in boolean aCreateIf); */
|
||||
NS_IMETHODIMP nsSOAPEncoding::GetStyle(const nsAString & aStyleURI, PRBool aCreateIf, nsISOAPEncoding **_retval)
|
||||
{
|
||||
NS_SOAP_ENSURE_ARG_STRING(aStyleURI);
|
||||
NS_ENSURE_ARG_POINTER(_retval);
|
||||
return mRegistry->GetStyle(aStyleURI, aCreateIf, _retval);
|
||||
}
|
||||
|
||||
/* nsISOAPEncoder setEncoder (in AString aSchemaNamespaceURI, in AString aSchemaType, in nsISOAPEncoder aEncoder); */
|
||||
NS_IMETHODIMP nsSOAPEncoding::SetEncoder(const nsAString & aSchemaNamespaceURI, const nsAString & aSchemaType, nsISOAPEncoder *aEncoder)
|
||||
{
|
||||
NS_SOAP_ENSURE_ARG_STRING(aSchemaNamespaceURI);
|
||||
NS_SOAP_ENSURE_ARG_STRING(aSchemaType);
|
||||
NS_ENSURE_ARG(aEncoder);
|
||||
nsAutoString name(aSchemaNamespaceURI);
|
||||
name.Append(nsSOAPUtils::kEncodingSeparator);
|
||||
name.Append(aSchemaType);
|
||||
nsStringKey nameKey(name);
|
||||
if (aEncoder) {
|
||||
mEncoders->Put(&nameKey, aEncoder, nsnull);
|
||||
}
|
||||
else {
|
||||
mEncoders->Remove(&nameKey, nsnull);
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/* nsISOAPEncoder getEncoder (in AString aSchemaNamespaceURI, in AString aSchemaType); */
|
||||
NS_IMETHODIMP nsSOAPEncoding::GetEncoder(const nsAString & aSchemaNamespaceURI, const nsAString & aSchemaType, nsISOAPEncoder **_retval)
|
||||
{
|
||||
NS_SOAP_ENSURE_ARG_STRING(aSchemaNamespaceURI);
|
||||
NS_SOAP_ENSURE_ARG_STRING(aSchemaType);
|
||||
NS_ENSURE_ARG_POINTER(_retval);
|
||||
nsAutoString name(aSchemaNamespaceURI);
|
||||
name.Append(nsSOAPUtils::kEncodingSeparator);
|
||||
name.Append(aSchemaType);
|
||||
nsStringKey nameKey(name);
|
||||
*_retval = (nsISOAPEncoder*)mEncoders->Get(&nameKey);
|
||||
if (*_retval == nsnull && mDefaultEncoding != nsnull) {
|
||||
return mDefaultEncoding->GetEncoder(aSchemaNamespaceURI, aSchemaType, _retval);
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/* nsISOAPDecoder setDecoder (in AString aSchemaNamespaceURI, in AString aSchemaType, in nsISOAPDecoder aDecoder); */
|
||||
NS_IMETHODIMP nsSOAPEncoding::SetDecoder(const nsAString & aSchemaNamespaceURI, const nsAString & aSchemaType, nsISOAPDecoder *aDecoder)
|
||||
{
|
||||
NS_SOAP_ENSURE_ARG_STRING(aSchemaNamespaceURI);
|
||||
NS_SOAP_ENSURE_ARG_STRING(aSchemaType);
|
||||
nsAutoString name(aSchemaNamespaceURI);
|
||||
name.Append(nsSOAPUtils::kEncodingSeparator);
|
||||
name.Append(aSchemaType);
|
||||
nsStringKey nameKey(name);
|
||||
if (aDecoder) {
|
||||
mDecoders->Put(&nameKey, aDecoder, nsnull);
|
||||
}
|
||||
else {
|
||||
mDecoders->Remove(&nameKey, nsnull);
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/* nsISOAPDecoder getDecoder (in AString aSchemaNamespaceURI, in AString aSchemaType); */
|
||||
NS_IMETHODIMP nsSOAPEncoding::GetDecoder(const nsAString & aSchemaNamespaceURI, const nsAString & aSchemaType, nsISOAPDecoder **_retval)
|
||||
{
|
||||
NS_SOAP_ENSURE_ARG_STRING(aSchemaNamespaceURI);
|
||||
NS_SOAP_ENSURE_ARG_STRING(aSchemaType);
|
||||
NS_ENSURE_ARG_POINTER(_retval);
|
||||
nsAutoString name(aSchemaNamespaceURI);
|
||||
name.Append(nsSOAPUtils::kEncodingSeparator);
|
||||
name.Append(aSchemaType);
|
||||
nsStringKey nameKey(name);
|
||||
*_retval = (nsISOAPDecoder*)mDecoders->Get(&nameKey);
|
||||
if (*_retval == nsnull && mDefaultEncoding != nsnull) {
|
||||
return mDefaultEncoding->GetDecoder(aSchemaNamespaceURI, aSchemaType, _retval);
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/* nsIDOMElement encode (in nsIVariant aSource, in AString aNamespaceURI, in AString aName, in nsISchemaType aSchemaType, in nsISOAPAttachments aAttachments, in nsIDOMElement aDestination); */
|
||||
NS_IMETHODIMP nsSOAPEncoding::Encode(nsIVariant *aSource, const nsAString & aNamespaceURI, const nsAString & aName, nsISchemaType *aSchemaType, nsISOAPAttachments *aAttachments, nsIDOMElement *aDestination, nsIDOMElement **_retval)
|
||||
{
|
||||
NS_ENSURE_ARG(aSource);
|
||||
NS_ENSURE_ARG_POINTER(_retval);
|
||||
|
||||
nsCOMPtr<nsISOAPEncoder> encoder;
|
||||
nsresult rv = GetDefaultEncoder(getter_AddRefs(encoder));
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
if (encoder) {
|
||||
return encoder->Encode(this, aSource, aNamespaceURI, aName, aSchemaType, aAttachments, aDestination,
|
||||
_retval);
|
||||
}
|
||||
*_retval = nsnull;
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
/* nsIVariant decode (in nsIDOMElement aSource, in nsISchemaType aSchemaType, in nsISOAPAttachments aAttachments); */
|
||||
NS_IMETHODIMP nsSOAPEncoding::Decode(nsIDOMElement *aSource, nsISchemaType *aSchemaType, nsISOAPAttachments *aAttachments, nsIVariant **_retval)
|
||||
{
|
||||
NS_ENSURE_ARG(aSource);
|
||||
NS_ENSURE_ARG_POINTER(_retval);
|
||||
nsCOMPtr<nsISOAPDecoder> decoder;
|
||||
nsresult rv = GetDefaultDecoder(getter_AddRefs(decoder));
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
if (decoder) {
|
||||
return decoder->Decode(this, aSource, aSchemaType, aAttachments, _retval);
|
||||
}
|
||||
*_retval = nsnull;
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
/* attribute nsISOAPEncoder defaultEncoder; */
|
||||
NS_IMETHODIMP nsSOAPEncoding::GetDefaultEncoder(nsISOAPEncoder * *aDefaultEncoder)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aDefaultEncoder);
|
||||
if (mDefaultEncoding && !mDefaultEncoder) {
|
||||
return mDefaultEncoding->GetDefaultEncoder(aDefaultEncoder);
|
||||
}
|
||||
*aDefaultEncoder = mDefaultEncoder;
|
||||
NS_IF_ADDREF(*aDefaultEncoder);
|
||||
return NS_OK;
|
||||
}
|
||||
NS_IMETHODIMP nsSOAPEncoding::SetDefaultEncoder(nsISOAPEncoder * aDefaultEncoder)
|
||||
{
|
||||
mDefaultEncoder = aDefaultEncoder;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/* attribute nsISOAPDecoder defaultDecoder; */
|
||||
NS_IMETHODIMP nsSOAPEncoding::GetDefaultDecoder(nsISOAPDecoder * *aDefaultDecoder)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aDefaultDecoder);
|
||||
if (mDefaultEncoding && !mDefaultDecoder) {
|
||||
return mDefaultEncoding->GetDefaultDecoder(aDefaultDecoder);
|
||||
}
|
||||
*aDefaultDecoder = mDefaultDecoder;
|
||||
NS_IF_ADDREF(*aDefaultDecoder);
|
||||
return NS_OK;
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
NS_IMETHODIMP nsSOAPEncoding::SetDefaultDecoder(nsISOAPDecoder * aDefaultDecoder)
|
||||
{
|
||||
mDefaultDecoder = aDefaultDecoder;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
static const char* kAllAccess = "AllAccess";
|
||||
|
||||
/* string canCreateWrapper (in nsIIDPtr iid); */
|
||||
NS_IMETHODIMP
|
||||
nsSOAPEncoding::CanCreateWrapper(const nsIID * iid, char **_retval)
|
||||
{
|
||||
if (iid->Equals(NS_GET_IID(nsISOAPEncoding))) {
|
||||
*_retval = nsCRT::strdup(kAllAccess);
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/* string canCallMethod (in nsIIDPtr iid, in wstring methodName); */
|
||||
NS_IMETHODIMP
|
||||
nsSOAPEncoding::CanCallMethod(const nsIID * iid, const PRUnichar *methodName, char **_retval)
|
||||
{
|
||||
if (iid->Equals(NS_GET_IID(nsISOAPEncoding))) {
|
||||
*_retval = nsCRT::strdup(kAllAccess);
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/* string canGetProperty (in nsIIDPtr iid, in wstring propertyName); */
|
||||
NS_IMETHODIMP
|
||||
nsSOAPEncoding::CanGetProperty(const nsIID * iid, const PRUnichar *propertyName, char **_retval)
|
||||
{
|
||||
if (iid->Equals(NS_GET_IID(nsISOAPEncoding))) {
|
||||
*_retval = nsCRT::strdup(kAllAccess);
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/* string canSetProperty (in nsIIDPtr iid, in wstring propertyName); */
|
||||
NS_IMETHODIMP
|
||||
nsSOAPEncoding::CanSetProperty(const nsIID * iid, const PRUnichar *propertyName, char **_retval)
|
||||
{
|
||||
if (iid->Equals(NS_GET_IID(nsISOAPEncoding))) {
|
||||
*_retval = nsCRT::strdup(kAllAccess);
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
@@ -1,77 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
|
||||
#ifndef nsSOAPEncodingRegistry_h__
|
||||
#define nsSOAPEncodingRegistry_h__
|
||||
|
||||
#include "nsString.h"
|
||||
#include "nsISecurityCheckedComponent.h"
|
||||
#include "nsIDOMElement.h"
|
||||
#include "nsISOAPEncoding.h"
|
||||
#include "nsISOAPEncoder.h"
|
||||
#include "nsISOAPDecoder.h"
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsHashtable.h"
|
||||
#include "nsISchema.h"
|
||||
|
||||
class nsSOAPEncoding;
|
||||
|
||||
/* Header file */
|
||||
class nsSOAPEncodingRegistry : public nsISOAPEncoding
|
||||
{
|
||||
public:
|
||||
NS_DECL_ISUPPORTS
|
||||
NS_DECL_NSISOAPENCODING
|
||||
nsSOAPEncodingRegistry() {}
|
||||
nsSOAPEncodingRegistry(nsISOAPEncoding* aEncoding);
|
||||
virtual ~nsSOAPEncodingRegistry();
|
||||
protected:
|
||||
nsSupportsHashtable* mEncodings;
|
||||
nsCOMPtr<nsISchemaCollection> mSchemaCollection;
|
||||
};
|
||||
|
||||
class nsSOAPEncoding : public nsISOAPEncoding,
|
||||
public nsISecurityCheckedComponent
|
||||
{
|
||||
public:
|
||||
NS_DECL_ISUPPORTS
|
||||
|
||||
NS_DECL_NSISOAPENCODING
|
||||
|
||||
// nsISecurityCheckedComponent
|
||||
NS_DECL_NSISECURITYCHECKEDCOMPONENT
|
||||
|
||||
nsSOAPEncoding();
|
||||
nsSOAPEncoding(const nsAString& aStyleURI, nsSOAPEncodingRegistry * aRegistry, nsISOAPEncoding* aDefaultEncoding);
|
||||
virtual ~nsSOAPEncoding();
|
||||
/* additional members */
|
||||
|
||||
protected:
|
||||
nsString mStyleURI;
|
||||
nsSupportsHashtable* mEncoders;
|
||||
nsSupportsHashtable* mDecoders;
|
||||
nsCOMPtr<nsISOAPEncoding> mRegistry;
|
||||
nsCOMPtr<nsISOAPEncoding> mDefaultEncoding;
|
||||
nsCOMPtr<nsISOAPEncoder> mDefaultEncoder;
|
||||
nsCOMPtr<nsISOAPDecoder> mDefaultDecoder;
|
||||
};
|
||||
#endif
|
||||
@@ -1,154 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
|
||||
#include "nsSOAPFault.h"
|
||||
#include "nsSOAPUtils.h"
|
||||
#include "nsIDOMNodeList.h"
|
||||
|
||||
nsSOAPFault::nsSOAPFault(nsIDOMElement* aElement)
|
||||
{
|
||||
NS_INIT_ISUPPORTS();
|
||||
mFaultElement = aElement;
|
||||
}
|
||||
|
||||
nsSOAPFault::~nsSOAPFault()
|
||||
{
|
||||
}
|
||||
|
||||
NS_IMPL_ISUPPORTS2(nsSOAPFault, nsISOAPFault, nsISecurityCheckedComponent)
|
||||
|
||||
/* attribute nsIDOMElement element; */
|
||||
NS_IMETHODIMP nsSOAPFault::SetElement(nsIDOMElement *aElement)
|
||||
{
|
||||
mFaultElement = aElement;
|
||||
return NS_OK;
|
||||
}
|
||||
NS_IMETHODIMP nsSOAPFault::GetElement(nsIDOMElement * *aElement)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aElement);
|
||||
*aElement = mFaultElement;
|
||||
NS_IF_ADDREF(*aElement);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/* readonly attribute wstring faultCode; */
|
||||
NS_IMETHODIMP nsSOAPFault::GetFaultCode(nsAWritableString & aFaultCode)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(&aFaultCode);
|
||||
aFaultCode.Truncate();
|
||||
nsCOMPtr<nsIDOMElement> faultcode;
|
||||
nsSOAPUtils::GetSpecificChildElement(mFaultElement,
|
||||
nsSOAPUtils::kSOAPEnvURI,
|
||||
nsSOAPUtils::kFaultCodeTagName,
|
||||
getter_AddRefs(faultcode));
|
||||
if (faultcode) {
|
||||
nsSOAPUtils::GetElementTextContent(faultcode, aFaultCode);
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/* readonly attribute wstring faultString; */
|
||||
NS_IMETHODIMP nsSOAPFault::GetFaultString(nsAWritableString & aFaultString)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(&aFaultString);
|
||||
|
||||
aFaultString.Truncate();
|
||||
nsCOMPtr<nsIDOMElement> element;
|
||||
nsSOAPUtils::GetSpecificChildElement(mFaultElement, nsSOAPUtils::kSOAPEnvURI,
|
||||
nsSOAPUtils::kFaultStringTagName, getter_AddRefs(element));
|
||||
if (element) {
|
||||
nsSOAPUtils::GetElementTextContent(element, aFaultString);
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/* readonly attribute wstring faultActor; */
|
||||
NS_IMETHODIMP nsSOAPFault::GetFaultActor(nsAWritableString & aFaultActor)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(&aFaultActor);
|
||||
|
||||
aFaultActor.Truncate();
|
||||
nsCOMPtr<nsIDOMElement> element;
|
||||
nsSOAPUtils::GetSpecificChildElement(mFaultElement, nsSOAPUtils::kSOAPEnvURI,
|
||||
nsSOAPUtils::kFaultActorTagName, getter_AddRefs(element));
|
||||
if (element) {
|
||||
nsSOAPUtils::GetElementTextContent(element, aFaultActor);
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/* readonly attribute nsIDOMElement detail; */
|
||||
NS_IMETHODIMP nsSOAPFault::GetDetail(nsIDOMElement * *aDetail)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aDetail);
|
||||
|
||||
nsCOMPtr<nsIDOMElement> element;
|
||||
nsSOAPUtils::GetSpecificChildElement(mFaultElement, nsSOAPUtils::kSOAPEnvURI,
|
||||
nsSOAPUtils::kFaultDetailTagName, aDetail);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
static const char* kAllAccess = "AllAccess";
|
||||
|
||||
/* string canCreateWrapper (in nsIIDPtr iid); */
|
||||
NS_IMETHODIMP
|
||||
nsSOAPFault::CanCreateWrapper(const nsIID * iid, char **_retval)
|
||||
{
|
||||
if (iid->Equals(NS_GET_IID(nsISOAPFault))) {
|
||||
*_retval = nsCRT::strdup(kAllAccess);
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/* string canCallMethod (in nsIIDPtr iid, in wstring methodName); */
|
||||
NS_IMETHODIMP
|
||||
nsSOAPFault::CanCallMethod(const nsIID * iid, const PRUnichar *methodName, char **_retval)
|
||||
{
|
||||
if (iid->Equals(NS_GET_IID(nsISOAPFault))) {
|
||||
*_retval = nsCRT::strdup(kAllAccess);
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/* string canGetProperty (in nsIIDPtr iid, in wstring propertyName); */
|
||||
NS_IMETHODIMP
|
||||
nsSOAPFault::CanGetProperty(const nsIID * iid, const PRUnichar *propertyName, char **_retval)
|
||||
{
|
||||
if (iid->Equals(NS_GET_IID(nsISOAPFault))) {
|
||||
*_retval = nsCRT::strdup(kAllAccess);
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/* string canSetProperty (in nsIIDPtr iid, in wstring propertyName); */
|
||||
NS_IMETHODIMP
|
||||
nsSOAPFault::CanSetProperty(const nsIID * iid, const PRUnichar *propertyName, char **_retval)
|
||||
{
|
||||
if (iid->Equals(NS_GET_IID(nsISOAPFault))) {
|
||||
*_retval = nsCRT::strdup(kAllAccess);
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
@@ -1,51 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
|
||||
#ifndef nsSOAPFault_h__
|
||||
#define nsSOAPFault_h__
|
||||
|
||||
#include "nsString.h"
|
||||
#include "nsISOAPFault.h"
|
||||
#include "nsISecurityCheckedComponent.h"
|
||||
#include "nsIDOMElement.h"
|
||||
#include "nsCOMPtr.h"
|
||||
|
||||
class nsSOAPFault : public nsISOAPFault,
|
||||
public nsISecurityCheckedComponent
|
||||
{
|
||||
public:
|
||||
nsSOAPFault(nsIDOMElement* aElement);
|
||||
virtual ~nsSOAPFault();
|
||||
|
||||
NS_DECL_ISUPPORTS
|
||||
|
||||
// nsISOAPFault
|
||||
NS_DECL_NSISOAPFAULT
|
||||
|
||||
// nsISecurityCheckedComponent
|
||||
NS_DECL_NSISECURITYCHECKEDCOMPONENT
|
||||
|
||||
protected:
|
||||
nsCOMPtr<nsIDOMElement> mFaultElement;
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -1,297 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
|
||||
#include "nsString.h"
|
||||
#include "nsReadableUtils.h"
|
||||
#include "nsSOAPHeaderBlock.h"
|
||||
#include "nsSOAPUtils.h"
|
||||
#include "nsIServiceManager.h"
|
||||
#include "nsISOAPAttachments.h"
|
||||
|
||||
nsSOAPHeaderBlock::nsSOAPHeaderBlock()
|
||||
{
|
||||
NS_INIT_ISUPPORTS();
|
||||
}
|
||||
|
||||
nsSOAPHeaderBlock::~nsSOAPHeaderBlock()
|
||||
{
|
||||
}
|
||||
|
||||
NS_IMPL_ISUPPORTS3_CI(nsSOAPHeaderBlock,
|
||||
nsISOAPHeaderBlock,
|
||||
nsISecurityCheckedComponent,
|
||||
nsIJSNativeInitializer)
|
||||
|
||||
/* attribute AString namespaceURI; */
|
||||
NS_IMETHODIMP nsSOAPHeaderBlock::GetNamespaceURI(nsAWritableString & aNamespaceURI)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(&aNamespaceURI);
|
||||
if (mElement) {
|
||||
return mElement->GetNamespaceURI(aNamespaceURI);
|
||||
}
|
||||
else {
|
||||
aNamespaceURI.Assign(mNamespaceURI);
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
NS_IMETHODIMP nsSOAPHeaderBlock::SetNamespaceURI(const nsAReadableString & aNamespaceURI)
|
||||
{
|
||||
if (mElement) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
mNamespaceURI.Assign(aNamespaceURI);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/* attribute AString name; */
|
||||
NS_IMETHODIMP nsSOAPHeaderBlock::GetName(nsAWritableString & aName)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(&aName);
|
||||
if (mElement) {
|
||||
return mElement->GetLocalName(aName);
|
||||
}
|
||||
else {
|
||||
aName.Assign(mName);
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
NS_IMETHODIMP nsSOAPHeaderBlock::SetName(const nsAReadableString & aName)
|
||||
{
|
||||
if (mElement) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
mName.Assign(aName);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/* attribute AString actorURI; */
|
||||
NS_IMETHODIMP nsSOAPHeaderBlock::GetActorURI(nsAWritableString & aActorURI)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(&aActorURI);
|
||||
if (mElement) {
|
||||
return mElement->GetAttributeNS(nsSOAPUtils::kSOAPEnvURI,nsSOAPUtils::kActorAttribute,aActorURI);
|
||||
}
|
||||
else {
|
||||
aActorURI.Assign(mActorURI);
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
NS_IMETHODIMP nsSOAPHeaderBlock::SetActorURI(const nsAReadableString & aActorURI)
|
||||
{
|
||||
if (mElement) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
mActorURI.Assign(aActorURI);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/* attribute nsISOAPEncoding encoding; */
|
||||
NS_IMETHODIMP nsSOAPHeaderBlock::GetEncoding(nsISOAPEncoding* * aEncoding)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aEncoding);
|
||||
*aEncoding = mEncoding;
|
||||
NS_IF_ADDREF(*aEncoding);
|
||||
return NS_OK;
|
||||
}
|
||||
NS_IMETHODIMP nsSOAPHeaderBlock::SetEncoding(nsISOAPEncoding* aEncoding)
|
||||
{
|
||||
mEncoding = aEncoding;
|
||||
if (mElement) {
|
||||
mComputeValue = PR_TRUE;
|
||||
mValue = nsnull;
|
||||
mStatus = NS_OK;
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/* attribute nsISchemaType schemaType; */
|
||||
NS_IMETHODIMP nsSOAPHeaderBlock::GetSchemaType(nsISchemaType* * aSchemaType)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aSchemaType);
|
||||
*aSchemaType = mSchemaType;
|
||||
NS_IF_ADDREF(*aSchemaType);
|
||||
return NS_OK;
|
||||
}
|
||||
NS_IMETHODIMP nsSOAPHeaderBlock::SetSchemaType(nsISchemaType* aSchemaType)
|
||||
{
|
||||
mSchemaType = aSchemaType;
|
||||
if (mElement) {
|
||||
mComputeValue = PR_TRUE;
|
||||
mValue = nsnull;
|
||||
mStatus = NS_OK;
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/* attribute nsISOAPAttachments attachments; */
|
||||
NS_IMETHODIMP nsSOAPHeaderBlock::GetAttachments(nsISOAPAttachments* * aAttachments)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aAttachments);
|
||||
*aAttachments = mAttachments;
|
||||
NS_IF_ADDREF(*aAttachments);
|
||||
return NS_OK;
|
||||
}
|
||||
NS_IMETHODIMP nsSOAPHeaderBlock::SetAttachments(nsISOAPAttachments* aAttachments)
|
||||
{
|
||||
mAttachments = aAttachments;
|
||||
if (mElement) {
|
||||
mComputeValue = PR_TRUE;
|
||||
mValue = nsnull;
|
||||
mStatus = NS_OK;
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/* attribute nsIDOMElement element; */
|
||||
NS_IMETHODIMP nsSOAPHeaderBlock::GetElement(nsIDOMElement* * aElement)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aElement);
|
||||
*aElement = mElement;
|
||||
NS_IF_ADDREF(*aElement);
|
||||
return NS_OK;
|
||||
}
|
||||
NS_IMETHODIMP nsSOAPHeaderBlock::SetElement(nsIDOMElement* aElement)
|
||||
{
|
||||
mElement = aElement;
|
||||
mNamespaceURI.SetLength(0);
|
||||
mName.SetLength(0);
|
||||
mActorURI.SetLength(0);
|
||||
mComputeValue = PR_TRUE;
|
||||
mValue = nsnull;
|
||||
mStatus = NS_OK;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/* attribute nsIVariant value; */
|
||||
NS_IMETHODIMP nsSOAPHeaderBlock::GetValue(nsIVariant* * aValue)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aValue);
|
||||
if (mElement // Check for auto-computation
|
||||
&& mComputeValue
|
||||
&& mEncoding)
|
||||
{
|
||||
mComputeValue = PR_FALSE;
|
||||
mStatus = mEncoding->Decode(mElement, mSchemaType, mAttachments, getter_AddRefs(mValue));
|
||||
}
|
||||
*aValue = mValue;
|
||||
NS_IF_ADDREF(*aValue);
|
||||
return mElement ? mStatus : NS_OK;
|
||||
}
|
||||
NS_IMETHODIMP nsSOAPHeaderBlock::SetValue(nsIVariant* aValue)
|
||||
{
|
||||
mValue = aValue;
|
||||
mComputeValue = PR_FALSE;
|
||||
mElement = nsnull;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsSOAPHeaderBlock::Initialize(JSContext *cx, JSObject *obj,
|
||||
PRUint32 argc, jsval *argv)
|
||||
{
|
||||
|
||||
// Get the arguments.
|
||||
|
||||
nsCOMPtr<nsIVariant> value;
|
||||
nsAutoString name;
|
||||
nsAutoString namespaceURI;
|
||||
nsAutoString actorURI;
|
||||
nsCOMPtr<nsISupports> schemaType;
|
||||
nsCOMPtr<nsISupports> encoding;
|
||||
|
||||
if (!JS_ConvertArguments(cx, argc, argv, "/%iv %is %is %is %ip %ip",
|
||||
getter_AddRefs(value),
|
||||
NS_STATIC_CAST(nsAString*, &name),
|
||||
NS_STATIC_CAST(nsAString*, &namespaceURI),
|
||||
NS_STATIC_CAST(nsAString*, &actorURI),
|
||||
getter_AddRefs(schemaType),
|
||||
getter_AddRefs(encoding))) return NS_ERROR_ILLEGAL_VALUE;
|
||||
|
||||
nsresult rc = SetValue(value);
|
||||
if (NS_FAILED(rc)) return rc;
|
||||
rc = SetName(name);
|
||||
if (NS_FAILED(rc)) return rc;
|
||||
rc = SetNamespaceURI(namespaceURI);
|
||||
if (NS_FAILED(rc)) return rc;
|
||||
rc = SetActorURI(actorURI);
|
||||
if (NS_FAILED(rc)) return rc;
|
||||
if (schemaType) {
|
||||
nsCOMPtr<nsISchemaType> v = do_QueryInterface(schemaType, &rc);
|
||||
if (NS_FAILED(rc)) return rc;
|
||||
rc = SetSchemaType(v);
|
||||
if (NS_FAILED(rc)) return rc;
|
||||
}
|
||||
if (encoding) {
|
||||
nsCOMPtr<nsISOAPEncoding> v = do_QueryInterface(encoding, &rc);
|
||||
if (NS_FAILED(rc)) return rc;
|
||||
rc = SetEncoding(v);
|
||||
if (NS_FAILED(rc)) return rc;
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
static const char* kAllAccess = "AllAccess";
|
||||
|
||||
/* string canCreateWrapper (in nsIIDPtr iid); */
|
||||
NS_IMETHODIMP
|
||||
nsSOAPHeaderBlock::CanCreateWrapper(const nsIID * iid, char **_retval)
|
||||
{
|
||||
if (iid->Equals(NS_GET_IID(nsISOAPHeaderBlock))) {
|
||||
*_retval = nsCRT::strdup(kAllAccess);
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/* string canCallMethod (in nsIIDPtr iid, in wstring methodName); */
|
||||
NS_IMETHODIMP
|
||||
nsSOAPHeaderBlock::CanCallMethod(const nsIID * iid, const PRUnichar *methodName, char **_retval)
|
||||
{
|
||||
if (iid->Equals(NS_GET_IID(nsISOAPHeaderBlock))) {
|
||||
*_retval = nsCRT::strdup(kAllAccess);
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/* string canGetProperty (in nsIIDPtr iid, in wstring propertyName); */
|
||||
NS_IMETHODIMP
|
||||
nsSOAPHeaderBlock::CanGetProperty(const nsIID * iid, const PRUnichar *propertyName, char **_retval)
|
||||
{
|
||||
if (iid->Equals(NS_GET_IID(nsISOAPHeaderBlock))) {
|
||||
*_retval = nsCRT::strdup(kAllAccess);
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/* string canSetProperty (in nsIIDPtr iid, in wstring propertyName); */
|
||||
NS_IMETHODIMP
|
||||
nsSOAPHeaderBlock::CanSetProperty(const nsIID * iid, const PRUnichar *propertyName, char **_retval)
|
||||
{
|
||||
if (iid->Equals(NS_GET_IID(nsISOAPHeaderBlock))) {
|
||||
*_retval = nsCRT::strdup(kAllAccess);
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
@@ -1,70 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
|
||||
#ifndef nsSOAPHeaderBlock_h__
|
||||
#define nsSOAPHeaderBlock_h__
|
||||
|
||||
#include "nsString.h"
|
||||
#include "nsIVariant.h"
|
||||
#include "nsISOAPHeaderBlock.h"
|
||||
#include "nsISecurityCheckedComponent.h"
|
||||
#include "nsIJSNativeInitializer.h"
|
||||
#include "nsISOAPEncoding.h"
|
||||
#include "nsISchema.h"
|
||||
#include "nsIDOMElement.h"
|
||||
#include "nsISOAPAttachments.h"
|
||||
#include "nsCOMPtr.h"
|
||||
|
||||
class nsSOAPHeaderBlock : public nsISOAPHeaderBlock,
|
||||
public nsISecurityCheckedComponent,
|
||||
public nsIJSNativeInitializer
|
||||
{
|
||||
public:
|
||||
nsSOAPHeaderBlock();
|
||||
virtual ~nsSOAPHeaderBlock();
|
||||
|
||||
NS_DECL_ISUPPORTS
|
||||
|
||||
// nsISOAPHeaderBlock
|
||||
NS_DECL_NSISOAPHEADERBLOCK
|
||||
|
||||
// nsISecurityCheckedComponent
|
||||
NS_DECL_NSISECURITYCHECKEDCOMPONENT
|
||||
|
||||
// nsIJSNativeInitializer
|
||||
NS_IMETHOD Initialize(JSContext *cx, JSObject *obj,
|
||||
PRUint32 argc, jsval *argv);
|
||||
|
||||
protected:
|
||||
nsString mNamespaceURI;
|
||||
nsString mName;
|
||||
nsString mActorURI;
|
||||
nsCOMPtr<nsISOAPEncoding> mEncoding;
|
||||
nsCOMPtr<nsISchemaType> mSchemaType;
|
||||
nsCOMPtr<nsISOAPAttachments> mAttachments;
|
||||
nsCOMPtr<nsIDOMElement> mElement;
|
||||
nsCOMPtr<nsIVariant> mValue;
|
||||
nsresult mStatus;
|
||||
PRBool mComputeValue;
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -1,475 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
|
||||
#include "nsIServiceManager.h"
|
||||
#include "nsMemory.h"
|
||||
#include "nsIComponentManager.h"
|
||||
#include "nsSOAPUtils.h"
|
||||
#include "nsSOAPMessage.h"
|
||||
#include "nsSOAPParameter.h"
|
||||
#include "nsSOAPHeaderBlock.h"
|
||||
#include "nsSOAPEncoding.h"
|
||||
#include "nsIDOMDocument.h"
|
||||
#include "nsIDOMParser.h"
|
||||
#include "nsIDOMElement.h"
|
||||
#include "nsIDOMNamedNodeMap.h"
|
||||
|
||||
static NS_DEFINE_CID(kDOMParserCID, NS_DOMPARSER_CID);
|
||||
/////////////////////////////////////////////
|
||||
//
|
||||
//
|
||||
/////////////////////////////////////////////
|
||||
|
||||
nsSOAPMessage::nsSOAPMessage()
|
||||
{
|
||||
NS_INIT_ISUPPORTS();
|
||||
}
|
||||
|
||||
nsSOAPMessage::~nsSOAPMessage()
|
||||
{
|
||||
}
|
||||
|
||||
NS_IMPL_ISUPPORTS2(nsSOAPMessage,
|
||||
nsISOAPMessage,
|
||||
nsISecurityCheckedComponent)
|
||||
|
||||
/* attribute nsIDOMDocument message; */
|
||||
NS_IMETHODIMP nsSOAPMessage::GetMessage(nsIDOMDocument * *aMessage)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aMessage);
|
||||
*aMessage = mMessage;
|
||||
NS_IF_ADDREF(*aMessage);
|
||||
return NS_OK;
|
||||
}
|
||||
NS_IMETHODIMP nsSOAPMessage::SetMessage(nsIDOMDocument * aMessage)
|
||||
{
|
||||
mMessage = aMessage;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/* readonly attribute nsIDOMElement envelope; */
|
||||
NS_IMETHODIMP nsSOAPMessage::GetEnvelope(nsIDOMElement * *aEnvelope)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aEnvelope);
|
||||
|
||||
if (mMessage) {
|
||||
nsCOMPtr<nsIDOMElement> root;
|
||||
mMessage->GetDocumentElement(getter_AddRefs(root));
|
||||
if (root) {
|
||||
nsAutoString name, namespaceURI;
|
||||
root->GetLocalName(name);
|
||||
root->GetNamespaceURI(namespaceURI);
|
||||
if (name.Equals(nsSOAPUtils::kEnvelopeTagName)
|
||||
&& namespaceURI.Equals(nsSOAPUtils::kSOAPEnvURI))
|
||||
{
|
||||
*aEnvelope = root;
|
||||
NS_ADDREF(*aEnvelope);
|
||||
return NS_OK;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
*aEnvelope = nsnull;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/* readonly attribute nsIDOMElement header; */
|
||||
NS_IMETHODIMP nsSOAPMessage::GetHeader(nsIDOMElement * *aHeader)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aHeader);
|
||||
nsCOMPtr<nsIDOMElement> env;
|
||||
GetEnvelope(getter_AddRefs(env));
|
||||
if (env) {
|
||||
nsSOAPUtils::GetSpecificChildElement(env,
|
||||
nsSOAPUtils::kSOAPEnvURI, nsSOAPUtils::kHeaderTagName,
|
||||
aHeader);
|
||||
}
|
||||
else {
|
||||
*aHeader = nsnull;
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/* readonly attribute nsIDOMElement body; */
|
||||
NS_IMETHODIMP nsSOAPMessage::GetBody(nsIDOMElement * *aBody)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aBody);
|
||||
nsCOMPtr<nsIDOMElement> env;
|
||||
GetEnvelope(getter_AddRefs(env));
|
||||
if (env) {
|
||||
nsSOAPUtils::GetSpecificChildElement(env,
|
||||
nsSOAPUtils::kSOAPEnvURI, nsSOAPUtils::kBodyTagName,
|
||||
aBody);
|
||||
}
|
||||
else {
|
||||
*aBody = nsnull;
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/* attribute DOMString actionURI; */
|
||||
NS_IMETHODIMP nsSOAPMessage::GetActionURI(nsAWritableString & aActionURI)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(&aActionURI);
|
||||
aActionURI.Assign(mActionURI);
|
||||
return NS_OK;
|
||||
}
|
||||
NS_IMETHODIMP nsSOAPMessage::SetActionURI(const nsAReadableString & aActionURI)
|
||||
{
|
||||
mActionURI.Assign(aActionURI);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/* readonly attribute AString methodName; */
|
||||
NS_IMETHODIMP nsSOAPMessage::GetMethodName(nsAString & aMethodName)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(&aMethodName);
|
||||
nsCOMPtr<nsIDOMElement> body;
|
||||
GetBody(getter_AddRefs(body));
|
||||
if (body) {
|
||||
nsCOMPtr<nsIDOMElement> method;
|
||||
nsSOAPUtils::GetFirstChildElement(body, getter_AddRefs(method));
|
||||
if (method) {
|
||||
body->GetLocalName(aMethodName);
|
||||
return NS_OK;
|
||||
}
|
||||
}
|
||||
aMethodName.SetLength(0);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/* readonly attribute AString targetObjectURI; */
|
||||
NS_IMETHODIMP nsSOAPMessage::GetTargetObjectURI(nsAString & aTargetObjectURI)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(&aTargetObjectURI);
|
||||
nsCOMPtr<nsIDOMElement> body;
|
||||
GetBody(getter_AddRefs(body));
|
||||
if (body) {
|
||||
nsCOMPtr<nsIDOMElement> method;
|
||||
nsSOAPUtils::GetFirstChildElement(body, getter_AddRefs(method));
|
||||
if (method) {
|
||||
body->GetNamespaceURI(aTargetObjectURI);
|
||||
return NS_OK;
|
||||
}
|
||||
}
|
||||
aTargetObjectURI.SetLength(0);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_NAMED_LITERAL_STRING(kEmptySOAPDocStr, "<SOAP-ENV:Envelope xmlns:SOAP-ENV=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:SOAP-ENC=\"http://schemas.xmlsoap.org/soap/encoding/\" xmlns:xsi=\"http://www.w3.org/1999/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/1999/XMLSchema\"><SOAP-ENV:Header></SOAP-ENV:Header><SOAP-ENV:Body></SOAP-ENV:Body></SOAP-ENV:Envelope>");
|
||||
|
||||
/* void encode (in AString aMethodName, in AString aTargetObjectURI, in PRUint32 aHeaderBlockCount, [array, size_is (aHeaderBlockCount)] in nsISOAPHeaderBlock aHeaderBlocks, in PRUint32 aParameterCount, [array, size_is (aParameterCount)] in nsISOAPParameter aParameters); */
|
||||
NS_IMETHODIMP nsSOAPMessage::Encode(const nsAString & aMethodName, const nsAString & aTargetObjectURI, PRUint32 aHeaderBlockCount, nsISOAPHeaderBlock **aHeaderBlocks, PRUint32 aParameterCount, nsISOAPParameter **aParameters)
|
||||
{
|
||||
|
||||
// Construct the message skeleton
|
||||
|
||||
nsresult rv;
|
||||
nsCOMPtr<nsIDOMNode> ignored;
|
||||
nsCOMPtr<nsIDOMParser> parser = do_CreateInstance(kDOMParserCID, &rv);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
nsAutoString docstr;
|
||||
rv = parser->ParseFromString(kEmptySOAPDocStr.get(), "text/xml",
|
||||
getter_AddRefs(mMessage));
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
// Declare the default encoding if one exists
|
||||
|
||||
if (mEncoding) {
|
||||
nsCOMPtr<nsIDOMElement> envelope;
|
||||
rv = GetEnvelope(getter_AddRefs(envelope));
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
if (envelope) {
|
||||
nsAutoString enc;
|
||||
mEncoding->GetStyleURI(enc);
|
||||
envelope->SetAttributeNS(nsSOAPUtils::kSOAPEncodingURI, nsSOAPUtils::kEncodingStyleAttribute, enc);
|
||||
}
|
||||
}
|
||||
|
||||
// Encode and add headers, if any were specified
|
||||
|
||||
if (aHeaderBlockCount) {
|
||||
nsCOMPtr<nsIDOMElement> parent;
|
||||
rv = GetHeader(getter_AddRefs(parent));
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
nsCOMPtr<nsISupports> next;
|
||||
nsCOMPtr<nsISOAPHeaderBlock> header;
|
||||
nsCOMPtr<nsIDOMElement> element;
|
||||
nsCOMPtr<nsISOAPEncoding> encoding;
|
||||
nsCOMPtr<nsISchemaType> schemaType;
|
||||
nsCOMPtr<nsIVariant> value;
|
||||
nsAutoString name;
|
||||
nsAutoString namespaceURI;
|
||||
nsAutoString actorURI;
|
||||
for (PRUint32 i = 0; i < aHeaderBlockCount; i++) {
|
||||
header = aHeaderBlocks[i];
|
||||
if (!header) return NS_ERROR_FAILURE;
|
||||
rv = header->GetElement(getter_AddRefs(element));
|
||||
if (element) {
|
||||
nsCOMPtr<nsIDOMNode> node1 = (nsIDOMElement*)element;
|
||||
nsCOMPtr<nsIDOMNode> node2;
|
||||
rv = mMessage->ImportNode(node1, PR_TRUE, getter_AddRefs(node1));
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
rv = parent->AppendChild(node2, getter_AddRefs(node1));
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
element = do_QueryInterface(node1);
|
||||
}
|
||||
else {
|
||||
rv = header->GetNamespaceURI(namespaceURI);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
rv = header->GetName(name);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
rv = header->GetActorURI(actorURI);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
rv = header->GetEncoding(getter_AddRefs(encoding));
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
if (!encoding) {
|
||||
encoding = mEncoding;
|
||||
}
|
||||
rv = header->GetSchemaType(getter_AddRefs(schemaType));
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
rv = header->GetValue(getter_AddRefs(value));
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
rv = encoding->Encode(value, namespaceURI, name,
|
||||
schemaType, nsnull, parent, getter_AddRefs(element));
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
if (!actorURI.IsEmpty()) {
|
||||
element->SetAttributeNS(nsSOAPUtils::kSOAPEnvPrefix, nsSOAPUtils::kActorAttribute, actorURI);
|
||||
}
|
||||
if (mEncoding != encoding) {
|
||||
nsAutoString enc;
|
||||
encoding->GetStyleURI(enc);
|
||||
element->SetAttributeNS(nsSOAPUtils::kSOAPEncodingURI, nsSOAPUtils::kEncodingStyleAttribute, enc);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
nsCOMPtr<nsIDOMElement> body;
|
||||
rv = GetBody(getter_AddRefs(body));
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
// Only produce a call element if mMethodName was non-empty
|
||||
|
||||
if (!aMethodName.IsEmpty()) {
|
||||
nsCOMPtr<nsIDOMElement> call;
|
||||
rv = mMessage->CreateElementNS(aTargetObjectURI, aMethodName, getter_AddRefs(call));
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
nsCOMPtr<nsIDOMNode> ignored;
|
||||
rv = body->AppendChild(call, getter_AddRefs(ignored));
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
body = call;
|
||||
nsAutoString prefix;
|
||||
rv = nsSOAPUtils::MakeNamespacePrefixFixed(body, aTargetObjectURI, prefix);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
if (!prefix.IsEmpty()) {
|
||||
rv = body->SetPrefix(prefix);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
}
|
||||
}
|
||||
|
||||
// Encode and add all of the parameters into the body
|
||||
|
||||
nsCOMPtr<nsISupports> next;
|
||||
nsCOMPtr<nsISOAPParameter> param;
|
||||
nsCOMPtr<nsIDOMElement> element;
|
||||
nsCOMPtr<nsISOAPEncoding> encoding;
|
||||
nsCOMPtr<nsISchemaType> schemaType;
|
||||
nsCOMPtr<nsIVariant> value;
|
||||
nsAutoString name;
|
||||
nsAutoString namespaceURI;
|
||||
for (PRUint32 i = 0; i < aParameterCount; i++) {
|
||||
param = aParameters[i];
|
||||
if (!param) return NS_ERROR_FAILURE;
|
||||
rv = param->GetElement(getter_AddRefs(element));
|
||||
if (element) {
|
||||
nsCOMPtr<nsIDOMNode> node1 = (nsIDOMElement*)element;
|
||||
nsCOMPtr<nsIDOMNode> node2;
|
||||
rv = mMessage->ImportNode(node1, PR_TRUE, getter_AddRefs(node1));
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
rv = body->AppendChild(node2, getter_AddRefs(node1));
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
element = do_QueryInterface(node1);
|
||||
}
|
||||
else {
|
||||
rv = param->GetNamespaceURI(namespaceURI);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
rv = param->GetName(name);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
rv = param->GetEncoding(getter_AddRefs(encoding));
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
if (!encoding) {
|
||||
encoding = mEncoding;
|
||||
}
|
||||
rv = param->GetSchemaType(getter_AddRefs(schemaType));
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
rv = param->GetValue(getter_AddRefs(value));
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
rv = encoding->Encode(value, namespaceURI, name,
|
||||
schemaType, nsnull, body, getter_AddRefs(element));
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
if (mEncoding != encoding) {
|
||||
nsAutoString enc;
|
||||
encoding->GetStyleURI(enc);
|
||||
element->SetAttributeNS(nsSOAPUtils::kSOAPEncodingURI, nsSOAPUtils::kEncodingStyleAttribute, enc);
|
||||
}
|
||||
}
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
static NS_DEFINE_CID(kMemoryCID, NS_MEMORY_CID);
|
||||
|
||||
/* void getHeaderBlocks (out PRUint32 aCount, [array, size_is (aCount), retval] out nsISOAPHeaderBlock aHeaderBlocks); */
|
||||
NS_IMETHODIMP nsSOAPMessage::GetHeaderBlocks(PRUint32 *aCount, nsISOAPHeaderBlock ***aHeaderBlocks)
|
||||
{
|
||||
nsCOMPtr<nsIMemory> memory = do_GetService(kMemoryCID);
|
||||
*aCount = 0;
|
||||
*aHeaderBlocks = nsnull;
|
||||
int count = 0;
|
||||
int length = 0;
|
||||
nsCOMPtr<nsIDOMElement> element;
|
||||
nsresult rv = GetHeader(getter_AddRefs(element));
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
nsCOMPtr<nsIDOMElement> next;
|
||||
nsCOMPtr<nsISOAPHeaderBlock> header;
|
||||
nsSOAPUtils::GetFirstChildElement(element, getter_AddRefs(next));
|
||||
while (next) {
|
||||
if (length == count) {
|
||||
length = length ? 2 * length : 10;
|
||||
*aHeaderBlocks = (nsISOAPHeaderBlock* *)memory->Realloc(*aHeaderBlocks, length * sizeof(**aHeaderBlocks));
|
||||
}
|
||||
element = next;
|
||||
header = new nsSOAPHeaderBlock();
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
// XXX can't addref a COMPTr
|
||||
//NS_ADDREF(header);
|
||||
(*aHeaderBlocks)[(*aCount)++] = header;
|
||||
rv = header->SetElement(element);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
nsSOAPUtils::GetNextSiblingElement(element, getter_AddRefs(next));
|
||||
}
|
||||
if (*aCount) {
|
||||
*aHeaderBlocks = (nsISOAPHeaderBlock* *)memory->Realloc(*aHeaderBlocks, (*aCount) * sizeof(**aHeaderBlocks));
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/* void getParameters (in boolean aDocumentStyle, out PRUint32 aCount, [array, size_is (aCount), retval] out nsISOAPParameter aParameters); */
|
||||
NS_IMETHODIMP nsSOAPMessage::GetParameters(PRBool aDocumentStyle, PRUint32 *aCount, nsISOAPParameter ***aParameters)
|
||||
{
|
||||
nsCOMPtr<nsIMemory> memory = do_GetService(kMemoryCID);
|
||||
*aCount = 0;
|
||||
*aParameters = nsnull;
|
||||
int count = 0;
|
||||
int length = 0;
|
||||
nsCOMPtr<nsIDOMElement> element;
|
||||
nsresult rv = GetHeader(getter_AddRefs(element));
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
nsCOMPtr<nsIDOMElement> next;
|
||||
nsCOMPtr<nsISOAPParameter> param;
|
||||
nsSOAPUtils::GetFirstChildElement(element, getter_AddRefs(next));
|
||||
while (next) {
|
||||
if (length == count) {
|
||||
length = length ? 2 * length : 10;
|
||||
*aParameters = (nsISOAPParameter* *)memory->Realloc(*aParameters, length * sizeof(**aParameters));
|
||||
}
|
||||
element = next;
|
||||
param = new nsSOAPParameter();
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
// XXX can't addref a COMPTr
|
||||
//NS_ADDREF(param);
|
||||
(*aParameters)[(*aCount)++] = param;
|
||||
rv = param->SetElement(element);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
nsSOAPUtils::GetNextSiblingElement(element, getter_AddRefs(next));
|
||||
}
|
||||
if (*aCount) {
|
||||
*aParameters = (nsISOAPParameter* *)memory->Realloc(*aParameters, (*aCount) * sizeof(**aParameters));
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/* attribute nsISOAPEncoding encoding; */
|
||||
NS_IMETHODIMP nsSOAPMessage::GetEncoding(nsISOAPEncoding* * aEncoding)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aEncoding);
|
||||
if (!mEncoding) {
|
||||
mEncoding = new nsSOAPEncoding();
|
||||
if (!mEncoding)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
*aEncoding = mEncoding;
|
||||
NS_IF_ADDREF(*aEncoding);
|
||||
return NS_OK;
|
||||
}
|
||||
NS_IMETHODIMP nsSOAPMessage::SetEncoding(nsISOAPEncoding* aEncoding)
|
||||
{
|
||||
mEncoding = aEncoding;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
static const char*kAllAccess = "AllAccess";
|
||||
|
||||
/* string canCreateWrapper (in nsIIDPtr iid); */
|
||||
NS_IMETHODIMP
|
||||
nsSOAPMessage::CanCreateWrapper(const nsIID * iid, char**_retval)
|
||||
{
|
||||
if (iid->Equals(NS_GET_IID(nsISOAPMessage))) {
|
||||
*_retval = nsCRT::strdup(kAllAccess);
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/* string canCallMethod (in nsIIDPtr iid, in wstring methodName); */
|
||||
NS_IMETHODIMP
|
||||
nsSOAPMessage::CanCallMethod(const nsIID * iid, const PRUnichar*methodName, char**_retval)
|
||||
{
|
||||
if (iid->Equals(NS_GET_IID(nsISOAPMessage))) {
|
||||
*_retval = nsCRT::strdup(kAllAccess);
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/* string canGetProperty (in nsIIDPtr iid, in wstring propertyName); */
|
||||
NS_IMETHODIMP
|
||||
nsSOAPMessage::CanGetProperty(const nsIID * iid, const PRUnichar*propertyName, char**_retval)
|
||||
{
|
||||
if (iid->Equals(NS_GET_IID(nsISOAPMessage))) {
|
||||
*_retval = nsCRT::strdup(kAllAccess);
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/* string canSetProperty (in nsIIDPtr iid, in wstring propertyName); */
|
||||
NS_IMETHODIMP
|
||||
nsSOAPMessage::CanSetProperty(const nsIID * iid, const PRUnichar*propertyName, char**_retval)
|
||||
{
|
||||
if (iid->Equals(NS_GET_IID(nsISOAPMessage))) {
|
||||
*_retval = nsCRT::strdup(kAllAccess);
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
@@ -1,58 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
|
||||
#ifndef nsSOAPMessage_h__
|
||||
#define nsSOAPMessage_h__
|
||||
|
||||
#include "nsString.h"
|
||||
#include "nsISOAPEncoding.h"
|
||||
#include "nsISOAPMessage.h"
|
||||
#include "nsISecurityCheckedComponent.h"
|
||||
#include "nsIDOMElement.h"
|
||||
#include "nsIDOMDocument.h"
|
||||
#include "nsISupportsArray.h"
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsIVariant.h"
|
||||
|
||||
class nsSOAPMessage : public nsISOAPMessage,
|
||||
public nsISecurityCheckedComponent
|
||||
{
|
||||
public:
|
||||
nsSOAPMessage();
|
||||
virtual ~nsSOAPMessage();
|
||||
|
||||
NS_DECL_ISUPPORTS
|
||||
|
||||
// nsISOAPMessage
|
||||
NS_DECL_NSISOAPMESSAGE
|
||||
|
||||
// nsISecurityCheckedComponent
|
||||
NS_DECL_NSISECURITYCHECKEDCOMPONENT
|
||||
|
||||
protected:
|
||||
|
||||
nsCOMPtr<nsIDOMDocument> mMessage;
|
||||
nsCOMPtr<nsISOAPEncoding> mEncoding;
|
||||
nsString mActionURI;
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -1,271 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
|
||||
#include "nsString.h"
|
||||
#include "nsReadableUtils.h"
|
||||
#include "nsSOAPParameter.h"
|
||||
#include "nsSOAPUtils.h"
|
||||
#include "nsIServiceManager.h"
|
||||
#include "nsISOAPAttachments.h"
|
||||
|
||||
nsSOAPParameter::nsSOAPParameter()
|
||||
{
|
||||
NS_INIT_ISUPPORTS();
|
||||
}
|
||||
|
||||
nsSOAPParameter::~nsSOAPParameter()
|
||||
{
|
||||
}
|
||||
|
||||
NS_IMPL_ISUPPORTS3_CI(nsSOAPParameter,
|
||||
nsISOAPParameter,
|
||||
nsISecurityCheckedComponent,
|
||||
nsIJSNativeInitializer)
|
||||
|
||||
/* attribute AString namespaceURI; */
|
||||
NS_IMETHODIMP nsSOAPParameter::GetNamespaceURI(nsAWritableString & aNamespaceURI)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(&aNamespaceURI);
|
||||
if (mElement) {
|
||||
return mElement->GetNamespaceURI(aNamespaceURI);
|
||||
}
|
||||
else {
|
||||
aNamespaceURI.Assign(mNamespaceURI);
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
NS_IMETHODIMP nsSOAPParameter::SetNamespaceURI(const nsAReadableString & aNamespaceURI)
|
||||
{
|
||||
if (mElement) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
mNamespaceURI.Assign(aNamespaceURI);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/* attribute AString name; */
|
||||
NS_IMETHODIMP nsSOAPParameter::GetName(nsAWritableString & aName)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(&aName);
|
||||
if (mElement) {
|
||||
return mElement->GetLocalName(aName);
|
||||
}
|
||||
else {
|
||||
aName.Assign(mName);
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
NS_IMETHODIMP nsSOAPParameter::SetName(const nsAReadableString & aName)
|
||||
{
|
||||
if (mElement) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
mName.Assign(aName);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/* attribute nsISOAPEncoding encoding; */
|
||||
NS_IMETHODIMP nsSOAPParameter::GetEncoding(nsISOAPEncoding* * aEncoding)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aEncoding);
|
||||
*aEncoding = mEncoding;
|
||||
NS_IF_ADDREF(*aEncoding);
|
||||
return NS_OK;
|
||||
}
|
||||
NS_IMETHODIMP nsSOAPParameter::SetEncoding(nsISOAPEncoding* aEncoding)
|
||||
{
|
||||
mEncoding = aEncoding;
|
||||
if (mElement) {
|
||||
mComputeValue = PR_TRUE;
|
||||
mValue = nsnull;
|
||||
mStatus = NS_OK;
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/* attribute nsISchemaType schemaType; */
|
||||
NS_IMETHODIMP nsSOAPParameter::GetSchemaType(nsISchemaType* * aSchemaType)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aSchemaType);
|
||||
*aSchemaType = mSchemaType;
|
||||
NS_IF_ADDREF(*aSchemaType);
|
||||
return NS_OK;
|
||||
}
|
||||
NS_IMETHODIMP nsSOAPParameter::SetSchemaType(nsISchemaType* aSchemaType)
|
||||
{
|
||||
mSchemaType = aSchemaType;
|
||||
if (mElement) {
|
||||
mComputeValue = PR_TRUE;
|
||||
mValue = nsnull;
|
||||
mStatus = NS_OK;
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/* attribute nsISOAPAttachments attachments; */
|
||||
NS_IMETHODIMP nsSOAPParameter::GetAttachments(nsISOAPAttachments* * aAttachments)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aAttachments);
|
||||
*aAttachments = mAttachments;
|
||||
NS_IF_ADDREF(*aAttachments);
|
||||
return NS_OK;
|
||||
}
|
||||
NS_IMETHODIMP nsSOAPParameter::SetAttachments(nsISOAPAttachments* aAttachments)
|
||||
{
|
||||
mAttachments = aAttachments;
|
||||
if (mElement) {
|
||||
mComputeValue = PR_TRUE;
|
||||
mValue = nsnull;
|
||||
mStatus = NS_OK;
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/* attribute nsIDOMElement element; */
|
||||
NS_IMETHODIMP nsSOAPParameter::GetElement(nsIDOMElement* * aElement)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aElement);
|
||||
*aElement = mElement;
|
||||
NS_IF_ADDREF(*aElement);
|
||||
return NS_OK;
|
||||
}
|
||||
NS_IMETHODIMP nsSOAPParameter::SetElement(nsIDOMElement* aElement)
|
||||
{
|
||||
mElement = aElement;
|
||||
mNamespaceURI.SetLength(0);
|
||||
mName.SetLength(0);
|
||||
mComputeValue = PR_TRUE;
|
||||
mValue = nsnull;
|
||||
mStatus = NS_OK;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/* attribute nsIVariant value; */
|
||||
NS_IMETHODIMP nsSOAPParameter::GetValue(nsIVariant* * aValue)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aValue);
|
||||
if (mElement // Check for auto-computation
|
||||
&& mComputeValue
|
||||
&& mEncoding)
|
||||
{
|
||||
mComputeValue = PR_FALSE;
|
||||
mStatus = mEncoding->Decode(mElement, mSchemaType, mAttachments, getter_AddRefs(mValue));
|
||||
}
|
||||
*aValue = mValue;
|
||||
NS_IF_ADDREF(*aValue);
|
||||
return mElement ? mStatus : NS_OK;
|
||||
}
|
||||
NS_IMETHODIMP nsSOAPParameter::SetValue(nsIVariant* aValue)
|
||||
{
|
||||
mValue = aValue;
|
||||
mComputeValue = PR_FALSE;
|
||||
mElement = nsnull;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsSOAPParameter::Initialize(JSContext *cx, JSObject *obj,
|
||||
PRUint32 argc, jsval *argv)
|
||||
{
|
||||
|
||||
// Get the arguments.
|
||||
|
||||
nsCOMPtr<nsIVariant> value;
|
||||
nsAutoString name;
|
||||
nsAutoString namespaceURI;
|
||||
nsCOMPtr<nsISupports> schemaType;
|
||||
nsCOMPtr<nsISupports> encoding;
|
||||
|
||||
if (!JS_ConvertArguments(cx, argc, argv, "/%iv %is %is %ip %ip",
|
||||
getter_AddRefs(value),
|
||||
NS_STATIC_CAST(nsAString*, &name),
|
||||
NS_STATIC_CAST(nsAString*, &namespaceURI),
|
||||
getter_AddRefs(schemaType),
|
||||
getter_AddRefs(encoding))) return NS_ERROR_ILLEGAL_VALUE;
|
||||
|
||||
nsresult rc = SetValue(value);
|
||||
if (NS_FAILED(rc)) return rc;
|
||||
rc = SetName(name);
|
||||
if (NS_FAILED(rc)) return rc;
|
||||
rc = SetNamespaceURI(namespaceURI);
|
||||
if (NS_FAILED(rc)) return rc;
|
||||
if (schemaType) {
|
||||
nsCOMPtr<nsISchemaType> v = do_QueryInterface(schemaType, &rc);
|
||||
if (NS_FAILED(rc)) return rc;
|
||||
rc = SetSchemaType(v);
|
||||
if (NS_FAILED(rc)) return rc;
|
||||
}
|
||||
if (encoding) {
|
||||
nsCOMPtr<nsISOAPEncoding> v = do_QueryInterface(encoding, &rc);
|
||||
if (NS_FAILED(rc)) return rc;
|
||||
rc = SetEncoding(v);
|
||||
if (NS_FAILED(rc)) return rc;
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
static const char* kAllAccess = "AllAccess";
|
||||
|
||||
/* string canCreateWrapper (in nsIIDPtr iid); */
|
||||
NS_IMETHODIMP
|
||||
nsSOAPParameter::CanCreateWrapper(const nsIID * iid, char **_retval)
|
||||
{
|
||||
if (iid->Equals(NS_GET_IID(nsISOAPParameter))) {
|
||||
*_retval = nsCRT::strdup(kAllAccess);
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/* string canCallMethod (in nsIIDPtr iid, in wstring methodName); */
|
||||
NS_IMETHODIMP
|
||||
nsSOAPParameter::CanCallMethod(const nsIID * iid, const PRUnichar *methodName, char **_retval)
|
||||
{
|
||||
if (iid->Equals(NS_GET_IID(nsISOAPParameter))) {
|
||||
*_retval = nsCRT::strdup(kAllAccess);
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/* string canGetProperty (in nsIIDPtr iid, in wstring propertyName); */
|
||||
NS_IMETHODIMP
|
||||
nsSOAPParameter::CanGetProperty(const nsIID * iid, const PRUnichar *propertyName, char **_retval)
|
||||
{
|
||||
if (iid->Equals(NS_GET_IID(nsISOAPParameter))) {
|
||||
*_retval = nsCRT::strdup(kAllAccess);
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/* string canSetProperty (in nsIIDPtr iid, in wstring propertyName); */
|
||||
NS_IMETHODIMP
|
||||
nsSOAPParameter::CanSetProperty(const nsIID * iid, const PRUnichar *propertyName, char **_retval)
|
||||
{
|
||||
if (iid->Equals(NS_GET_IID(nsISOAPParameter))) {
|
||||
*_retval = nsCRT::strdup(kAllAccess);
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
@@ -1,69 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
|
||||
#ifndef nsSOAPParameter_h__
|
||||
#define nsSOAPParameter_h__
|
||||
|
||||
#include "nsString.h"
|
||||
#include "nsIVariant.h"
|
||||
#include "nsISOAPParameter.h"
|
||||
#include "nsISecurityCheckedComponent.h"
|
||||
#include "nsIJSNativeInitializer.h"
|
||||
#include "nsISOAPEncoding.h"
|
||||
#include "nsISchema.h"
|
||||
#include "nsIDOMElement.h"
|
||||
#include "nsISOAPAttachments.h"
|
||||
#include "nsCOMPtr.h"
|
||||
|
||||
class nsSOAPParameter : public nsISOAPParameter,
|
||||
public nsISecurityCheckedComponent,
|
||||
public nsIJSNativeInitializer
|
||||
{
|
||||
public:
|
||||
nsSOAPParameter();
|
||||
virtual ~nsSOAPParameter();
|
||||
|
||||
NS_DECL_ISUPPORTS
|
||||
|
||||
// nsISOAPParameter
|
||||
NS_DECL_NSISOAPPARAMETER
|
||||
|
||||
// nsISecurityCheckedComponent
|
||||
NS_DECL_NSISECURITYCHECKEDCOMPONENT
|
||||
|
||||
// nsIJSNativeInitializer
|
||||
NS_IMETHOD Initialize(JSContext *cx, JSObject *obj,
|
||||
PRUint32 argc, jsval *argv);
|
||||
|
||||
protected:
|
||||
nsString mNamespaceURI;
|
||||
nsString mName;
|
||||
nsCOMPtr<nsISOAPEncoding> mEncoding;
|
||||
nsCOMPtr<nsISchemaType> mSchemaType;
|
||||
nsCOMPtr<nsISOAPAttachments> mAttachments;
|
||||
nsCOMPtr<nsIDOMElement> mElement;
|
||||
nsCOMPtr<nsIVariant> mValue;
|
||||
nsresult mStatus;
|
||||
PRBool mComputeValue;
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -1,122 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
|
||||
#include "nsSOAPResponse.h"
|
||||
#include "nsSOAPUtils.h"
|
||||
#include "nsSOAPFault.h"
|
||||
#include "nsISOAPParameter.h"
|
||||
|
||||
nsSOAPResponse::nsSOAPResponse()
|
||||
{
|
||||
}
|
||||
|
||||
nsSOAPResponse::~nsSOAPResponse()
|
||||
{
|
||||
/* destructor code */
|
||||
}
|
||||
|
||||
NS_IMPL_ISUPPORTS_INHERITED1(nsSOAPResponse, nsSOAPMessage, nsISOAPResponse)
|
||||
|
||||
/* attribute nsISOAPCall respondingTo; */
|
||||
NS_IMETHODIMP nsSOAPResponse::GetRespondingTo(nsISOAPCall * *aRespondingTo)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aRespondingTo);
|
||||
*aRespondingTo = mRespondingTo;
|
||||
NS_IF_ADDREF(*aRespondingTo);
|
||||
return NS_OK;
|
||||
}
|
||||
NS_IMETHODIMP nsSOAPResponse::SetRespondingTo(nsISOAPCall * aRespondingTo)
|
||||
{
|
||||
mRespondingTo = aRespondingTo;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/* readonly attribute nsISOAPFault fault; */
|
||||
NS_IMETHODIMP nsSOAPResponse::GetFault(nsISOAPFault * *aFault)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aFault);
|
||||
nsCOMPtr<nsIDOMElement> body;
|
||||
|
||||
*aFault = nsnull;
|
||||
GetBody(getter_AddRefs(body));
|
||||
if (body) {
|
||||
nsSOAPUtils::GetSpecificChildElement(body,
|
||||
nsSOAPUtils::kSOAPEnvURI, nsSOAPUtils::kFaultTagName,
|
||||
getter_AddRefs(body));
|
||||
if (body) {
|
||||
*aFault = new nsSOAPFault(body);
|
||||
if (!*aFault)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
NS_ADDREF(*aFault);
|
||||
}
|
||||
}
|
||||
else {
|
||||
*aFault = nsnull;
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
static const char* kAllAccess = "AllAccess";
|
||||
|
||||
/* string canCreateWrapper (in nsIIDPtr iid); */
|
||||
NS_IMETHODIMP
|
||||
nsSOAPResponse::CanCreateWrapper(const nsIID * iid, char **_retval)
|
||||
{
|
||||
if (iid->Equals(NS_GET_IID(nsISOAPResponse))) {
|
||||
*_retval = nsCRT::strdup(kAllAccess);
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/* string canCallMethod (in nsIIDPtr iid, in wstring methodName); */
|
||||
NS_IMETHODIMP
|
||||
nsSOAPResponse::CanCallMethod(const nsIID * iid, const PRUnichar *methodName, char **_retval)
|
||||
{
|
||||
if (iid->Equals(NS_GET_IID(nsISOAPResponse))) {
|
||||
*_retval = nsCRT::strdup(kAllAccess);
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/* string canGetProperty (in nsIIDPtr iid, in wstring propertyName); */
|
||||
NS_IMETHODIMP
|
||||
nsSOAPResponse::CanGetProperty(const nsIID * iid, const PRUnichar *propertyName, char **_retval)
|
||||
{
|
||||
if (iid->Equals(NS_GET_IID(nsISOAPResponse))) {
|
||||
*_retval = nsCRT::strdup(kAllAccess);
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/* string canSetProperty (in nsIIDPtr iid, in wstring propertyName); */
|
||||
NS_IMETHODIMP
|
||||
nsSOAPResponse::CanSetProperty(const nsIID * iid, const PRUnichar *propertyName, char **_retval)
|
||||
{
|
||||
if (iid->Equals(NS_GET_IID(nsISOAPResponse))) {
|
||||
*_retval = nsCRT::strdup(kAllAccess);
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
@@ -1,56 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
|
||||
#ifndef nsSOAPResponse_h__
|
||||
#define nsSOAPResponse_h__
|
||||
|
||||
#include "nsString.h"
|
||||
#include "nsSOAPCall.h"
|
||||
#include "nsISOAPResponse.h"
|
||||
#include "nsISecurityCheckedComponent.h"
|
||||
#include "nsIDOMDocument.h"
|
||||
#include "nsIDOMElement.h"
|
||||
#include "nsCOMPtr.h"
|
||||
|
||||
class nsSOAPResponse : public nsSOAPMessage,
|
||||
public nsISOAPResponse
|
||||
{
|
||||
public:
|
||||
NS_DECL_ISUPPORTS
|
||||
|
||||
// nsISOAPResponse
|
||||
NS_FORWARD_NSISOAPMESSAGE(nsSOAPMessage::)
|
||||
|
||||
// nsISOAPResponse
|
||||
NS_DECL_NSISOAPRESPONSE
|
||||
|
||||
// nsISecurityCheckedComponent
|
||||
NS_DECL_NSISECURITYCHECKEDCOMPONENT
|
||||
|
||||
nsSOAPResponse();
|
||||
virtual ~nsSOAPResponse();
|
||||
|
||||
protected:
|
||||
nsCOMPtr<nsISOAPCall> mRespondingTo;
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -1,426 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
|
||||
#include "nsSOAPUtils.h"
|
||||
#include "nsIDOMText.h"
|
||||
#include "nsIDOMNamedNodeMap.h"
|
||||
#include "nsCOMPtr.h"
|
||||
|
||||
NS_NAMED_LITERAL_STRING(nsSOAPUtils::kSOAPEnvURI,"http://schemas.xmlsoap.org/soap/envelope/");
|
||||
NS_NAMED_LITERAL_STRING(nsSOAPUtils::kSOAPEncodingURI,"http://schemas.xmlsoap.org/soap/encoding/");
|
||||
NS_NAMED_LITERAL_STRING(nsSOAPUtils::kSOAPEnvPrefix,"SOAP-ENV");
|
||||
NS_NAMED_LITERAL_STRING(nsSOAPUtils::kSOAPEncodingPrefix,"SOAP-ENC");
|
||||
NS_NAMED_LITERAL_STRING(nsSOAPUtils::kXSIURI,"http://www.w3.org/1999/XMLSchema-instance");
|
||||
NS_NAMED_LITERAL_STRING(nsSOAPUtils::kXSDURI,"http://www.w3.org/1999/XMLSchema");
|
||||
NS_NAMED_LITERAL_STRING(nsSOAPUtils::kXSIPrefix,"xsi");
|
||||
NS_NAMED_LITERAL_STRING(nsSOAPUtils::kXSITypeAttribute,"type");
|
||||
NS_NAMED_LITERAL_STRING(nsSOAPUtils::kXSDPrefix,"xsd");
|
||||
NS_NAMED_LITERAL_STRING(nsSOAPUtils::kEncodingStyleAttribute,"encodingStyle");
|
||||
NS_NAMED_LITERAL_STRING(nsSOAPUtils::kActorAttribute,"actor");
|
||||
NS_NAMED_LITERAL_STRING(nsSOAPUtils::kEnvelopeTagName,"Envelope");
|
||||
NS_NAMED_LITERAL_STRING(nsSOAPUtils::kHeaderTagName,"Header");
|
||||
NS_NAMED_LITERAL_STRING(nsSOAPUtils::kBodyTagName,"Body");
|
||||
NS_NAMED_LITERAL_STRING(nsSOAPUtils::kFaultTagName,"Fault");
|
||||
NS_NAMED_LITERAL_STRING(nsSOAPUtils::kFaultCodeTagName,"faultcode");
|
||||
NS_NAMED_LITERAL_STRING(nsSOAPUtils::kFaultStringTagName,"faultstring");
|
||||
NS_NAMED_LITERAL_STRING(nsSOAPUtils::kFaultActorTagName,"faultactor");
|
||||
NS_NAMED_LITERAL_STRING(nsSOAPUtils::kFaultDetailTagName,"detail");
|
||||
|
||||
NS_NAMED_LITERAL_STRING(nsSOAPUtils::kEncodingSeparator,"#");
|
||||
NS_NAMED_LITERAL_STRING(nsSOAPUtils::kQualifiedSeparator,":");
|
||||
|
||||
NS_NAMED_LITERAL_STRING(nsSOAPUtils::kXMLNamespaceNamespaceURI, "htp://www.w3.org/2000/xmlns/");
|
||||
NS_NAMED_LITERAL_STRING(nsSOAPUtils::kXMLNamespaceURI, "htp://www.w3.org/XML/1998/namespace");
|
||||
NS_NAMED_LITERAL_STRING(nsSOAPUtils::kXMLPrefix, "xml:");
|
||||
NS_NAMED_LITERAL_STRING(nsSOAPUtils::kXMLNamespacePrefix, "xmlns:");
|
||||
|
||||
void
|
||||
nsSOAPUtils::GetSpecificChildElement(
|
||||
nsIDOMElement *aParent,
|
||||
const nsAReadableString& aNamespace,
|
||||
const nsAReadableString& aType,
|
||||
nsIDOMElement * *aElement)
|
||||
{
|
||||
nsCOMPtr<nsIDOMElement> sibling;
|
||||
|
||||
*aElement = nsnull;
|
||||
GetFirstChildElement(aParent, getter_AddRefs(sibling));
|
||||
if (sibling)
|
||||
{
|
||||
GetSpecificSiblingElement(sibling,
|
||||
aNamespace, aType, aElement);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
nsSOAPUtils::GetSpecificSiblingElement(
|
||||
nsIDOMElement *aSibling,
|
||||
const nsAReadableString& aNamespace,
|
||||
const nsAReadableString& aType,
|
||||
nsIDOMElement * *aElement)
|
||||
{
|
||||
nsCOMPtr<nsIDOMElement> sibling;
|
||||
|
||||
*aElement = nsnull;
|
||||
sibling = aSibling;
|
||||
do {
|
||||
nsAutoString name, namespaceURI;
|
||||
sibling->GetLocalName(name);
|
||||
sibling->GetNamespaceURI(namespaceURI);
|
||||
if (name.Equals(aType)
|
||||
&& namespaceURI.Equals(nsSOAPUtils::kSOAPEnvURI))
|
||||
{
|
||||
*aElement = sibling;
|
||||
NS_ADDREF(*aElement);
|
||||
return;
|
||||
}
|
||||
nsCOMPtr<nsIDOMElement> temp = sibling;
|
||||
GetNextSiblingElement(temp, getter_AddRefs(sibling));
|
||||
} while (sibling);
|
||||
}
|
||||
|
||||
void
|
||||
nsSOAPUtils::GetFirstChildElement(nsIDOMElement* aParent,
|
||||
nsIDOMElement** aElement)
|
||||
{
|
||||
nsCOMPtr<nsIDOMNode> child;
|
||||
|
||||
*aElement = nsnull;
|
||||
aParent->GetFirstChild(getter_AddRefs(child));
|
||||
while (child) {
|
||||
PRUint16 type;
|
||||
child->GetNodeType(&type);
|
||||
if (nsIDOMNode::ELEMENT_NODE == type) {
|
||||
child->QueryInterface(NS_GET_IID(nsIDOMElement), (void**)aElement);
|
||||
break;
|
||||
}
|
||||
nsCOMPtr<nsIDOMNode> temp = child;
|
||||
GetNextSibling(temp, getter_AddRefs(child));
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
nsSOAPUtils::GetNextSiblingElement(nsIDOMElement* aStart,
|
||||
nsIDOMElement** aElement)
|
||||
{
|
||||
nsCOMPtr<nsIDOMNode> sibling;
|
||||
|
||||
*aElement = nsnull;
|
||||
GetNextSibling(aStart, getter_AddRefs(sibling));
|
||||
while (sibling) {
|
||||
PRUint16 type;
|
||||
sibling->GetNodeType(&type);
|
||||
if (nsIDOMNode::ELEMENT_NODE == type) {
|
||||
sibling->QueryInterface(NS_GET_IID(nsIDOMElement), (void**)aElement);
|
||||
break;
|
||||
}
|
||||
nsCOMPtr<nsIDOMNode> temp = sibling;
|
||||
GetNextSibling(temp, getter_AddRefs(sibling));
|
||||
}
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsSOAPUtils::GetElementTextContent(nsIDOMElement* aElement,
|
||||
nsAWritableString& aText)
|
||||
{
|
||||
nsCOMPtr<nsIDOMNode> child;
|
||||
nsAutoString rtext;
|
||||
aElement->GetFirstChild(getter_AddRefs(child));
|
||||
while (child) {
|
||||
PRUint16 type;
|
||||
child->GetNodeType(&type);
|
||||
if (nsIDOMNode::TEXT_NODE == type
|
||||
|| nsIDOMNode::CDATA_SECTION_NODE == type) {
|
||||
nsCOMPtr<nsIDOMText> text = do_QueryInterface(child);
|
||||
nsAutoString data;
|
||||
text->GetData(data);
|
||||
rtext.Append(data);
|
||||
}
|
||||
else if (nsIDOMNode::ELEMENT_NODE == type) {
|
||||
return NS_ERROR_ILLEGAL_VALUE; // This was interpreted as a simple value, yet had complex content in it.
|
||||
}
|
||||
nsCOMPtr<nsIDOMNode> temp = child;
|
||||
GetNextSibling(temp, getter_AddRefs(child));
|
||||
}
|
||||
aText.Assign(rtext);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
PRBool
|
||||
nsSOAPUtils::HasChildElements(nsIDOMElement* aElement)
|
||||
{
|
||||
nsCOMPtr<nsIDOMNode> child;
|
||||
|
||||
aElement->GetFirstChild(getter_AddRefs(child));
|
||||
while (child) {
|
||||
PRUint16 type;
|
||||
child->GetNodeType(&type);
|
||||
if (nsIDOMNode::ELEMENT_NODE == type) {
|
||||
return PR_TRUE;
|
||||
}
|
||||
nsCOMPtr<nsIDOMNode> temp = child;
|
||||
GetNextSibling(temp, getter_AddRefs(child));
|
||||
}
|
||||
|
||||
return PR_FALSE;
|
||||
}
|
||||
|
||||
void
|
||||
nsSOAPUtils::GetNextSibling(nsIDOMNode* aSibling, nsIDOMNode **aNext)
|
||||
{
|
||||
nsCOMPtr<nsIDOMNode> last;
|
||||
nsCOMPtr<nsIDOMNode> current;
|
||||
PRUint16 type;
|
||||
|
||||
*aNext = nsnull;
|
||||
last = aSibling;
|
||||
|
||||
last->GetNodeType(&type);
|
||||
if (nsIDOMNode::ENTITY_REFERENCE_NODE == type) {
|
||||
last->GetFirstChild(getter_AddRefs(current));
|
||||
if (!last)
|
||||
{
|
||||
last->GetNextSibling(getter_AddRefs(current));
|
||||
}
|
||||
}
|
||||
else {
|
||||
last->GetNextSibling(getter_AddRefs(current));
|
||||
}
|
||||
while (!current)
|
||||
{
|
||||
last->GetParentNode(getter_AddRefs(current));
|
||||
current->GetNodeType(&type);
|
||||
if (nsIDOMNode::ENTITY_REFERENCE_NODE == type) {
|
||||
last = current;
|
||||
last->GetNextSibling(getter_AddRefs(current));
|
||||
}
|
||||
else {
|
||||
current = nsnull;
|
||||
break;
|
||||
}
|
||||
}
|
||||
*aNext = current;
|
||||
NS_IF_ADDREF(*aNext);
|
||||
}
|
||||
nsresult nsSOAPUtils::GetNamespaceURI(nsIDOMElement* aScope,
|
||||
const nsAReadableString & aQName,
|
||||
nsAWritableString & aURI)
|
||||
{
|
||||
aURI.Truncate(0);
|
||||
PRInt32 i = aQName.FindChar(':');
|
||||
if (i < 0) {
|
||||
return NS_OK;
|
||||
}
|
||||
nsAutoString prefix;
|
||||
aQName.Left(prefix, i);
|
||||
|
||||
if (prefix.Equals(kXMLPrefix)) {
|
||||
aURI.Assign(kXMLNamespaceURI);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult rc;
|
||||
nsCOMPtr<nsIDOMNode> current = aScope;
|
||||
nsCOMPtr<nsIDOMNamedNodeMap> attrs;
|
||||
nsCOMPtr<nsIDOMNode> temp;
|
||||
nsAutoString value;
|
||||
while (current != nsnull) {
|
||||
rc = current->GetAttributes(getter_AddRefs(attrs));
|
||||
if (NS_FAILED(rc)) return rc;
|
||||
if (attrs) {
|
||||
rc = attrs->GetNamedItemNS(kXMLNamespaceNamespaceURI, prefix, getter_AddRefs(temp));
|
||||
if (NS_FAILED(rc)) return rc;
|
||||
if (temp != nsnull)
|
||||
return temp->GetNodeValue(aURI);
|
||||
}
|
||||
rc = current->GetParentNode(getter_AddRefs(temp));
|
||||
if (NS_FAILED(rc)) return rc;
|
||||
current = temp;
|
||||
}
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
nsresult nsSOAPUtils::GetLocalName(const nsAReadableString & aQName,
|
||||
nsAWritableString & aLocalName)
|
||||
{
|
||||
PRInt32 i = aQName.FindChar(':');
|
||||
if (i < 0)
|
||||
aLocalName = aQName;
|
||||
else
|
||||
aQName.Mid(aLocalName, i, aQName.Length() - i);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsSOAPUtils::MakeNamespacePrefix(nsIDOMElement* aScope,
|
||||
const nsAReadableString & aURI,
|
||||
nsAWritableString & aPrefix)
|
||||
{
|
||||
// This may change for level 3 serialization, so be sure to gut this
|
||||
// and call the standardized level 3 method when it is available.
|
||||
aPrefix.Truncate(0);
|
||||
if (aURI.IsEmpty())
|
||||
return NS_OK;
|
||||
if (aURI.Equals(nsSOAPUtils::kXMLNamespaceURI)) {
|
||||
aPrefix.Assign(nsSOAPUtils::kXMLPrefix);
|
||||
return NS_OK;
|
||||
}
|
||||
nsCOMPtr<nsIDOMNode> current = aScope;
|
||||
nsCOMPtr<nsIDOMNamedNodeMap> attrs;
|
||||
nsCOMPtr<nsIDOMNode> temp;
|
||||
nsAutoString tstr;
|
||||
nsresult rc;
|
||||
PRUint32 maxns = 0; // Keep track of max generated NS
|
||||
for (;;) {
|
||||
rc = current->GetAttributes(getter_AddRefs(attrs));
|
||||
if (NS_FAILED(rc)) return rc;
|
||||
if (attrs) {
|
||||
PRUint32 i = 0;
|
||||
for (;;)
|
||||
{
|
||||
attrs->Item(i++, getter_AddRefs(temp));
|
||||
if (!temp)
|
||||
break;
|
||||
temp->GetNamespaceURI(tstr);
|
||||
if (!tstr.Equals(nsSOAPUtils::kXMLNamespaceNamespaceURI))
|
||||
continue;
|
||||
temp->GetNodeValue(tstr);
|
||||
if (tstr.Equals(aURI)) {
|
||||
nsAutoString prefix;
|
||||
rc = temp->GetLocalName(prefix);
|
||||
if (NS_FAILED(rc)) return rc;
|
||||
nsCOMPtr<nsIDOMNode> check = aScope;
|
||||
PRBool hasDecl;
|
||||
nsCOMPtr<nsIDOMElement> echeck;
|
||||
while (check != current) { // Make sure prefix is not overridden
|
||||
echeck = do_QueryInterface(check);
|
||||
if (echeck) {
|
||||
rc = echeck->HasAttributeNS(nsSOAPUtils::kXMLNamespaceNamespaceURI, prefix, &hasDecl);
|
||||
if (NS_FAILED(rc)) return rc;
|
||||
if (hasDecl)
|
||||
break;
|
||||
current->GetParentNode(getter_AddRefs(temp));
|
||||
current = temp;
|
||||
}
|
||||
}
|
||||
if (check == current) {
|
||||
aPrefix.Assign(prefix);
|
||||
return NS_OK;
|
||||
}
|
||||
}
|
||||
rc = temp->GetLocalName(tstr);
|
||||
if (NS_FAILED(rc))
|
||||
return rc;
|
||||
else { // Decode the generated namespace into a number
|
||||
nsReadingIterator<PRUnichar> i1;
|
||||
nsReadingIterator<PRUnichar> i2;
|
||||
tstr.BeginReading(i1);
|
||||
tstr.EndReading(i2);
|
||||
if (i1 == i2 || *i1 != 'n')
|
||||
continue;
|
||||
i1++;
|
||||
if (i1 == i2 || *i1 != 's')
|
||||
continue;
|
||||
i1++;
|
||||
PRUint32 n = 0;
|
||||
while (i1 != i2) {
|
||||
PRUnichar c = *i1;
|
||||
i1++;
|
||||
if (c < '0' || c > '9') {
|
||||
n = 0;
|
||||
break;
|
||||
}
|
||||
n = n * 10 + (c - '0');
|
||||
}
|
||||
if (n > maxns)
|
||||
maxns = n;
|
||||
}
|
||||
}
|
||||
}
|
||||
current->GetParentNode(getter_AddRefs(temp));
|
||||
if (temp)
|
||||
current = temp;
|
||||
else
|
||||
break;
|
||||
}
|
||||
// Create a unique prefix...
|
||||
PRUint32 len = 3;
|
||||
PRUint32 c = maxns + 1;
|
||||
while (c >= 10) {
|
||||
c = c / 10;
|
||||
len++;
|
||||
}
|
||||
// Set the length and write it backwards since that's the easiest way..
|
||||
aPrefix.SetLength(len);
|
||||
nsWritingIterator<PRUnichar> i2;
|
||||
aPrefix.EndWriting(i2);
|
||||
c = maxns + 1;
|
||||
while (c > 0) {
|
||||
PRUint32 r = c % 10;
|
||||
c = c / 10;
|
||||
i2--;
|
||||
*i2 = (PRUnichar)(r + '0');
|
||||
}
|
||||
i2--;
|
||||
*i2 = 's';
|
||||
i2--;
|
||||
*i2 = 'n';
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsSOAPUtils::MakeNamespacePrefixFixed(nsIDOMElement* aScope,
|
||||
const nsAReadableString & aURI,
|
||||
nsAWritableString & aPrefix)
|
||||
{
|
||||
if (aURI.Equals(kSOAPEncodingURI))
|
||||
aPrefix = kSOAPEncodingPrefix;
|
||||
else if (aURI.Equals(kSOAPEnvURI))
|
||||
aPrefix = kSOAPEnvPrefix;
|
||||
else if (aURI.Equals(kXSIURI))
|
||||
aPrefix = kXSIPrefix;
|
||||
else if (aURI.Equals(kXSDURI))
|
||||
aPrefix = kXSDPrefix;
|
||||
else
|
||||
return MakeNamespacePrefix(aScope, aURI, aPrefix);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
PRBool nsSOAPUtils::StartsWith(nsAReadableString& aSuper,
|
||||
nsAReadableString& aSub)
|
||||
{
|
||||
PRUint32 c1 = aSuper.Length();
|
||||
PRUint32 c2 = aSub.Length();
|
||||
if (c1 < c2) return PR_FALSE;
|
||||
if (c1 == c2) return aSuper.Equals(aSub);
|
||||
nsReadingIterator<PRUnichar> i1;
|
||||
nsReadingIterator<PRUnichar> i2;
|
||||
aSuper.BeginReading(i1);
|
||||
aSub.BeginReading(i2);
|
||||
while (c2--) {
|
||||
if (*i1 != *i2) return PR_FALSE;
|
||||
i1++;
|
||||
i2++;
|
||||
}
|
||||
return PR_TRUE;
|
||||
}
|
||||
@@ -1,109 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
|
||||
#ifndef nsSOAPUtils_h__
|
||||
#define nsSOAPUtils_h__
|
||||
|
||||
#include "nsString.h"
|
||||
#include "nsIDOMElement.h"
|
||||
|
||||
class nsSOAPUtils {
|
||||
public:
|
||||
static void GetSpecificChildElement(nsIDOMElement *aParent,
|
||||
const nsAReadableString& aNamespace,
|
||||
const nsAReadableString& aType,
|
||||
nsIDOMElement * *aElement);
|
||||
static void GetSpecificSiblingElement(nsIDOMElement *aSibling,
|
||||
const nsAReadableString& aNamespace,
|
||||
const nsAReadableString& aType,
|
||||
nsIDOMElement * *aElement);
|
||||
static void GetFirstChildElement(nsIDOMElement* aParent,
|
||||
nsIDOMElement** aElement);
|
||||
static void GetNextSiblingElement(nsIDOMElement* aStart,
|
||||
nsIDOMElement** aElement);
|
||||
static nsresult GetElementTextContent(nsIDOMElement* aElement,
|
||||
nsAWritableString& aText);
|
||||
static PRBool HasChildElements(nsIDOMElement* aElement);
|
||||
|
||||
static void GetNextSibling(nsIDOMNode* aSibling,
|
||||
nsIDOMNode **aNext);
|
||||
static nsresult MakeNamespacePrefix(nsIDOMElement* aElement,
|
||||
const nsAReadableString & aURI,
|
||||
nsAWritableString & aPrefix);
|
||||
static nsresult MakeNamespacePrefixFixed(nsIDOMElement* aElement,
|
||||
const nsAReadableString & aURI,
|
||||
nsAWritableString & aPrefix);
|
||||
static nsresult GetNamespaceURI(nsIDOMElement* aElement,
|
||||
const nsAReadableString & aQName,
|
||||
nsAWritableString & aURI);
|
||||
static nsresult GetLocalName(const nsAReadableString & aQName,
|
||||
nsAWritableString & aLocalName);
|
||||
|
||||
// All those missing string functions have to come from somewhere...
|
||||
|
||||
static PRBool StartsWith(nsAReadableString& aSuper,
|
||||
nsAReadableString& aSub);
|
||||
static nsDependentString kSOAPEnvURI;
|
||||
static nsDependentString kSOAPEncodingURI;
|
||||
static nsDependentString kSOAPEnvPrefix;
|
||||
static nsDependentString kSOAPEncodingPrefix;
|
||||
static nsDependentString kXSIURI;
|
||||
static nsDependentString kXSDURI;
|
||||
static nsDependentString kXSIPrefix;
|
||||
static nsDependentString kXSITypeAttribute;
|
||||
static nsDependentString kXSDPrefix;
|
||||
static nsDependentString kEncodingStyleAttribute;
|
||||
static nsDependentString kActorAttribute;
|
||||
static nsDependentString kEnvelopeTagName;
|
||||
static nsDependentString kHeaderTagName;
|
||||
static nsDependentString kBodyTagName;
|
||||
static nsDependentString kFaultTagName;
|
||||
static nsDependentString kFaultCodeTagName;
|
||||
static nsDependentString kFaultStringTagName;
|
||||
static nsDependentString kFaultActorTagName;
|
||||
static nsDependentString kFaultDetailTagName;
|
||||
static nsDependentString kEncodingSeparator;
|
||||
static nsDependentString kQualifiedSeparator;
|
||||
static nsDependentString kXMLNamespaceNamespaceURI;
|
||||
static nsDependentString kXMLNamespaceURI;
|
||||
static nsDependentString kXMLNamespacePrefix;
|
||||
static nsDependentString kXMLPrefix;
|
||||
};
|
||||
|
||||
// Used to support null strings.
|
||||
|
||||
inline PRBool AStringIsNull(const nsAReadableString& aString)
|
||||
{
|
||||
return aString.IsVoid() || aString.IsEmpty(); // Get rid of empty hack when string implementations support.
|
||||
}
|
||||
|
||||
inline void SetAStringToNull(nsAWritableString& aString)
|
||||
{
|
||||
aString.Truncate();
|
||||
aString.SetIsVoid(PR_TRUE);
|
||||
}
|
||||
|
||||
#define NS_SOAP_ENSURE_ARG_STRING(arg) \
|
||||
NS_ENSURE_FALSE(AStringIsNull(arg), NS_ERROR_INVALID_ARG)
|
||||
|
||||
|
||||
#endif
|
||||
@@ -1,31 +0,0 @@
|
||||
#
|
||||
# The contents of this file are subject to the Mozilla Public
|
||||
# License Version 1.1 (the "License"); you may not use this file
|
||||
# except in compliance with the License. You may obtain a copy of
|
||||
# the License at http://www.mozilla.org/MPL/
|
||||
#
|
||||
# Software distributed under the License is distributed on an "AS
|
||||
# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
# implied. See the License for the specific language governing
|
||||
# rights and limitations under the License.
|
||||
#
|
||||
# The Original Code is mozilla.org code.
|
||||
#
|
||||
# The Initial Developer of the Original Code is Netscape
|
||||
# Communications Corporation. Portions created by Netscape are
|
||||
# Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
# Rights Reserved.
|
||||
#
|
||||
# Contributor(s):
|
||||
#
|
||||
|
||||
DEPTH = ../../..
|
||||
topsrcdir = @top_srcdir@
|
||||
srcdir = @srcdir@
|
||||
VPATH = @srcdir@
|
||||
|
||||
include $(DEPTH)/config/autoconf.mk
|
||||
|
||||
DIRS = public src
|
||||
|
||||
include $(topsrcdir)/config/rules.mk
|
||||
@@ -1,26 +0,0 @@
|
||||
#!nmake
|
||||
#
|
||||
# The contents of this file are subject to the Netscape Public
|
||||
# License Version 1.1 (the "License"); you may not use this file
|
||||
# except in compliance with the License. You may obtain a copy of
|
||||
# the License at http://www.mozilla.org/NPL/
|
||||
#
|
||||
# Software distributed under the License is distributed on an "AS
|
||||
# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
# implied. See the License for the specific language governing
|
||||
# rights and limitations under the License.
|
||||
#
|
||||
# The Original Code is mozilla.org code.
|
||||
#
|
||||
# The Initial Developer of the Original Code is Netscape
|
||||
# Communications Corporation. Portions created by Netscape are
|
||||
# Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
# Rights Reserved.
|
||||
#
|
||||
# Contributor(s):
|
||||
|
||||
DEPTH=..\..\..
|
||||
|
||||
DIRS=public src
|
||||
|
||||
include <$(DEPTH)\config\rules.mak>
|
||||
@@ -1,19 +0,0 @@
|
||||
#
|
||||
# This is a list of local files which get copied to the mozilla:dist:idl directory
|
||||
#
|
||||
|
||||
nsISOAPAttachments.idl
|
||||
nsISOAPCall.idl
|
||||
nsISOAPDecoder.idl
|
||||
nsISOAPEncoder.idl
|
||||
nsISOAPEncoding.idl
|
||||
nsISOAPFault.idl
|
||||
nsISOAPHeaderBlock.idl
|
||||
nsISOAPMessage.idl
|
||||
nsISOAPParameter.idl
|
||||
nsISOAPResponse.idl
|
||||
nsISOAPResponseListener.idl
|
||||
nsISOAPService.idl
|
||||
nsISOAPServiceRegistry.idl
|
||||
nsISOAPTransport.idl
|
||||
nsISOAPTransportListener.idl
|
||||
@@ -1,50 +0,0 @@
|
||||
#
|
||||
# The contents of this file are subject to the Mozilla Public
|
||||
# License Version 1.1 (the "License"); you may not use this file
|
||||
# except in compliance with the License. You may obtain a copy of
|
||||
# the License at http://www.mozilla.org/MPL/
|
||||
#
|
||||
# Software distributed under the License is distributed on an "AS
|
||||
# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
# implied. See the License for the specific language governing
|
||||
# rights and limitations under the License.
|
||||
#
|
||||
# The Original Code is mozilla.org code.
|
||||
#
|
||||
# The Initial Developer of the Original Code is Netscape
|
||||
# Communications Corporation. Portions created by Netscape are
|
||||
# Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
# Rights Reserved.
|
||||
#
|
||||
# Contributor(s):
|
||||
#
|
||||
|
||||
DEPTH = ../../../..
|
||||
topsrcdir = @top_srcdir@
|
||||
srcdir = @srcdir@
|
||||
VPATH = @srcdir@
|
||||
|
||||
include $(DEPTH)/config/autoconf.mk
|
||||
|
||||
MODULE = xmlextras
|
||||
XPIDL_MODULE = xmlsoap
|
||||
|
||||
XPIDLSRCS = \
|
||||
nsISOAPAttachments.idl \
|
||||
nsISOAPCall.idl \
|
||||
nsISOAPDecoder.idl \
|
||||
nsISOAPEncoder.idl \
|
||||
nsISOAPEncoding.idl \
|
||||
nsISOAPFault.idl \
|
||||
nsISOAPHeaderBlock.idl \
|
||||
nsISOAPMessage.idl \
|
||||
nsISOAPParameter.idl \
|
||||
nsISOAPResponse.idl \
|
||||
nsISOAPResponseListener.idl \
|
||||
nsISOAPService.idl \
|
||||
nsISOAPServiceRegistry.idl \
|
||||
nsISOAPTransport.idl \
|
||||
nsISOAPTransportListener.idl \
|
||||
$(NULL)
|
||||
|
||||
include $(topsrcdir)/config/rules.mk
|
||||
@@ -1,46 +0,0 @@
|
||||
#!nmake
|
||||
#
|
||||
# The contents of this file are subject to the Netscape Public
|
||||
# License Version 1.1 (the "License"); you may not use this file
|
||||
# except in compliance with the License. You may obtain a copy of
|
||||
# the License at http://www.mozilla.org/NPL/
|
||||
#
|
||||
# Software distributed under the License is distributed on an "AS
|
||||
# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
# implied. See the License for the specific language governing
|
||||
# rights and limitations under the License.
|
||||
#
|
||||
# The Original Code is mozilla.org code.
|
||||
#
|
||||
# The Initial Developer of the Original Code is Netscape
|
||||
# Communications Corporation. Portions created by Netscape are
|
||||
# Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
# Rights Reserved.
|
||||
#
|
||||
# Contributor(s):
|
||||
|
||||
DEPTH=..\..\..\..
|
||||
|
||||
MODULE = xmlextras
|
||||
XPIDL_MODULE = xmlsoap
|
||||
|
||||
XPIDLSRCS = \
|
||||
.\nsISOAPAttachments.idl \
|
||||
.\nsISOAPCall.idl \
|
||||
.\nsISOAPDecoder.idl \
|
||||
.\nsISOAPEncoder.idl \
|
||||
.\nsISOAPEncoding.idl \
|
||||
.\nsISOAPFault.idl \
|
||||
.\nsISOAPHeaderBlock.idl \
|
||||
.\nsISOAPMessage.idl \
|
||||
.\nsISOAPParameter.idl \
|
||||
.\nsISOAPResponse.idl \
|
||||
.\nsISOAPResponseListener.idl \
|
||||
.\nsISOAPService.idl \
|
||||
.\nsISOAPServiceRegistry.idl \
|
||||
.\nsISOAPTransport.idl \
|
||||
.\nsISOAPTransportListener.idl \
|
||||
$(NULL)
|
||||
|
||||
include <$(DEPTH)\config\rules.mak>
|
||||
|
||||
@@ -1,50 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 2001 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
|
||||
#include "nsISupports.idl"
|
||||
|
||||
/**
|
||||
* This interface permits attachment of SOAP attachments.
|
||||
*/
|
||||
|
||||
[scriptable, uuid(6192dcbe-1dd2-11b2-81ad-a4597614c4ae)]
|
||||
interface nsISOAPAttachments : nsISupports {
|
||||
|
||||
/**
|
||||
* Get the attachment associated with a particular identifier.
|
||||
*
|
||||
* @param aIdentifier The identifier of the attachment to be accessed.
|
||||
*
|
||||
* Appropriate return(s) must be identified.
|
||||
*/
|
||||
void getAttachment(in AString aIdentifier);
|
||||
|
||||
/**
|
||||
* Attach an attachment to the message.
|
||||
*
|
||||
* Appropriate argument(s) must be identified.
|
||||
*
|
||||
* @return The identifier of the attachment, to be referenced in SOAP encoding
|
||||
*/
|
||||
AString attach();
|
||||
|
||||
};
|
||||
@@ -1,90 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 2001 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
|
||||
#include "nsISupports.idl"
|
||||
#include "nsISOAPMessage.idl"
|
||||
|
||||
interface nsISOAPResponse;
|
||||
interface nsISOAPResponseListener;
|
||||
|
||||
/**
|
||||
* This interface is a convenience extension of the basic SOAP message,
|
||||
* which handles common patterns of calling, such as providing an
|
||||
* action URI in the HTTP header, locating and invoking the appropriate
|
||||
* transport based upon the protocol of the transportURI, and
|
||||
* automatically recieving the result in a new nsISOAPResponse object
|
||||
* which recieves an XML message.
|
||||
*/
|
||||
|
||||
[scriptable, uuid(a8fefe40-52bc-11d4-9a57-000064657374)]
|
||||
interface nsISOAPCall : nsISOAPMessage {
|
||||
|
||||
/**
|
||||
* The URI to which the message will be sent, identifying the
|
||||
* transport and transport-specific information about the
|
||||
* destination.
|
||||
* This does not have to match the <code>targetObjectURI</code>.
|
||||
*/
|
||||
attribute AString transportURI;
|
||||
|
||||
/**
|
||||
* Synchronously invoke the call. The method returns only when
|
||||
* we receive a response (or an error occurs). The
|
||||
* <code>transportURI</code> must have been set, the
|
||||
* parameter list (even if empty) must have been encoded,
|
||||
* and the transportURI must use some known protocol. A
|
||||
* synchronous call assumes that there will be exactly one
|
||||
* response per call.
|
||||
*
|
||||
* If not, an error is returned in the status of the response.
|
||||
*
|
||||
* @returns The SOAP response
|
||||
*/
|
||||
nsISOAPResponse invoke();
|
||||
|
||||
/**
|
||||
* Asynchronously invoke the call. At this point, the document
|
||||
* rooted by the Envelope element is encoded to form the body
|
||||
* of the SOAP message. The method returns immediately, and the
|
||||
* listener is invoked when we eventually receive a response
|
||||
* (or error or successful completion). The
|
||||
* <code>transportURI</code> must have been set, the
|
||||
* parameter list (even if empty) must have been encoded,
|
||||
* and the transportURI must use some known protocol.
|
||||
*
|
||||
* If not, an error is returned in the status of the response.
|
||||
*
|
||||
* @param aListener Handler to be invoked asynchronously after the
|
||||
* response is recieved. Should be null if no response is
|
||||
* expected.
|
||||
*/
|
||||
void asyncInvoke(in nsISOAPResponseListener aListener);
|
||||
};
|
||||
|
||||
%{ C++
|
||||
#define NS_SOAPCALL_CID \
|
||||
{ /* 87d21ec0-539d-11d4-9a59-00104bdf5339 */ \
|
||||
0x87d21ec0, 0x539d, 0x11d4, \
|
||||
{0x9a, 0x59, 0x00, 0x10, 0x4b, 0xdf, 0x53, 0x39} }
|
||||
#define NS_SOAPCALL_CONTRACTID \
|
||||
"@mozilla.org/xmlextras/soap/call;1"
|
||||
%}
|
||||
@@ -1,61 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 2001 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
|
||||
#include "nsISupports.idl"
|
||||
|
||||
interface nsISchemaType;
|
||||
interface nsISOAPEncoding;
|
||||
interface nsIDOMElement;
|
||||
interface nsIVariant;
|
||||
interface nsISOAPAttachments;
|
||||
|
||||
/**
|
||||
* This interface supplies decoding of a specific
|
||||
* part of a message XML DOM into appropriate objects
|
||||
* for the script or application.
|
||||
*/
|
||||
|
||||
[scriptable, uuid(4c2e02ae-1dd2-11b2-b1cd-c79dea3d46db)]
|
||||
interface nsISOAPDecoder : nsISupports {
|
||||
|
||||
/**
|
||||
* Decode the source DOM node
|
||||
*
|
||||
* @param aEncodings The encodings used to decode
|
||||
*
|
||||
* @param aEncodingStyleURI The encoding style
|
||||
*
|
||||
* @param aSource The DOM node to be decoded.
|
||||
*
|
||||
* @param aSchemaType The schema type of the source DOM node
|
||||
*
|
||||
* @param aAttachments Dispenses any attachments.
|
||||
*
|
||||
* @return The decoded variant, which is null if
|
||||
* the operation failed or did not return a result.
|
||||
*/
|
||||
nsIVariant decode(
|
||||
in nsISOAPEncoding aEncoding,
|
||||
in nsIDOMElement aSource,
|
||||
in nsISchemaType aSchemaType,
|
||||
in nsISOAPAttachments aAttachments);
|
||||
};
|
||||
@@ -1,69 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 2001 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
|
||||
#include "nsISupports.idl"
|
||||
|
||||
interface nsISchemaType;
|
||||
interface nsISOAPEncoding;
|
||||
interface nsIVariant;
|
||||
interface nsIDOMElement;
|
||||
interface nsISOAPAttachments;
|
||||
|
||||
/**
|
||||
* This interface permits encoding of variants.
|
||||
*/
|
||||
|
||||
[scriptable, uuid(fc33ffd6-1dd1-11b2-8750-fa62430a38b4)]
|
||||
interface nsISOAPEncoder : nsISupports {
|
||||
|
||||
/**
|
||||
* Encode the source variant.
|
||||
*
|
||||
* @param aEncodings The encodings to be used.
|
||||
*
|
||||
* @param aEncodingStyleURI The encoding style
|
||||
*
|
||||
* @param aSource The variant to be encoded.
|
||||
*
|
||||
* @param aNamespaceURI The namespace of the thing being coded
|
||||
*
|
||||
* @param aName The name of the thing being coded
|
||||
*
|
||||
* @param aSchemaType The schema type of the thing being encoded
|
||||
*
|
||||
* @param aDestination The node scope, if any, where the result
|
||||
* will live. If this is null, then the result must be
|
||||
* explicitly attached to the message.
|
||||
*
|
||||
* @return element which was inserted.
|
||||
*
|
||||
* @param aAttachments Accumulates any attachments.
|
||||
*/
|
||||
nsIDOMElement encode(
|
||||
in nsISOAPEncoding aEncoding,
|
||||
in nsIVariant aSource,
|
||||
in AString aNamespaceURI,
|
||||
in AString aName,
|
||||
in nsISchemaType aSchemaType,
|
||||
in nsISOAPAttachments aAttachments,
|
||||
in nsIDOMElement aDestination);
|
||||
};
|
||||
@@ -1,184 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 2001 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
|
||||
#include "nsISupports.idl"
|
||||
|
||||
interface nsISchemaType;
|
||||
interface nsIDOMElement;
|
||||
interface nsISOAPEncoder;
|
||||
interface nsISOAPDecoder;
|
||||
interface nsISOAPMessage;
|
||||
interface nsIVariant;
|
||||
interface nsISOAPAttachments;
|
||||
interface nsISchemaCollection;
|
||||
|
||||
/**
|
||||
* This interface keeps track of all the known types and how
|
||||
* each should be encoded (by type) or decoded (by
|
||||
* schema type)
|
||||
*/
|
||||
|
||||
[scriptable, uuid(9ae49600-1dd1-11b2-877f-e62f620c5e92)]
|
||||
interface nsISOAPEncoding : nsISupports {
|
||||
|
||||
/**
|
||||
* The name of the encoding as it is known to SOAP.
|
||||
*/
|
||||
readonly attribute AString styleURI;
|
||||
|
||||
/**
|
||||
* Get an alternative encoding.
|
||||
*
|
||||
* @param aStyleURI The style URI of the alternative encoding style.
|
||||
*
|
||||
* @param aCreateIf If true, then create the alternative style if it
|
||||
* does not already exist, otherwise return the existing encoding.
|
||||
*
|
||||
* @return The alternative encoding which corresponds to the
|
||||
* specified styleURI, or null if the spefied alternative encoding
|
||||
* does not exist and it was not requested that it be created.
|
||||
*/
|
||||
nsISOAPEncoding getStyle(
|
||||
in AString aStyleURI,
|
||||
in boolean aCreateIf);
|
||||
|
||||
/**
|
||||
* Set an encoder in the encoding.
|
||||
*
|
||||
* @param aSchemaNamespaceURI The schema namespace URI to serve as key.
|
||||
*
|
||||
* @param aSchemaType The schema type to serve as key.
|
||||
*
|
||||
* @param aEncoder The encoder to be specified or null to eliminate
|
||||
* the encoder.
|
||||
*
|
||||
* @return Old encoder registered under that type in the encoding, which
|
||||
* should be kept by the new encoder if it is to be called back.
|
||||
*/
|
||||
void setEncoder(in AString aSchemaNamespaceURI, in AString aSchemaType,
|
||||
in nsISOAPEncoder aEncoder);
|
||||
|
||||
/**
|
||||
* Get an encoder from the encoding.
|
||||
*
|
||||
* @param aSchemaNamespaceURI The schema namespace URI to serve as key.
|
||||
*
|
||||
* @param aSchemaType The schema type to serve as key.
|
||||
*
|
||||
* @return The encoder.
|
||||
*/
|
||||
nsISOAPEncoder getEncoder(in AString aSchemaNamespaceURI, in AString aSchemaType);
|
||||
|
||||
/**
|
||||
* Set a decoder in the encoding.
|
||||
*
|
||||
* @param aSchemaNamespaceURI The schema namespace URI to serve as key.
|
||||
*
|
||||
* @param aSchemaType The schema type to serve as key.
|
||||
*
|
||||
* @param aDecoder The decoder to be specified or null to eliminate
|
||||
* the decoder.
|
||||
*
|
||||
* @return Old decoder registered under that type in the encoding, which
|
||||
* should be kept by the new decoder if it is to be called back.
|
||||
*/
|
||||
void setDecoder(in AString aSchemaNamespaceURI, in AString aSchemaType,
|
||||
in nsISOAPDecoder aDecoder);
|
||||
|
||||
/**
|
||||
* Get a decoder from the encoding.
|
||||
*
|
||||
* @param aSchemaNamespaceURI The schema namespace URI to serve as key.
|
||||
*
|
||||
* @param aSchemaType The schema type to serve as key.
|
||||
*
|
||||
* @return The decoder.
|
||||
*/
|
||||
nsISOAPDecoder getDecoder(in AString aSchemaNamespaceURI, in AString aSchemaType);
|
||||
|
||||
attribute nsISOAPEncoder defaultEncoder;
|
||||
|
||||
attribute nsISOAPDecoder defaultDecoder;
|
||||
|
||||
attribute nsISchemaCollection schemaCollection;
|
||||
|
||||
/**
|
||||
* Encode the source variant
|
||||
*
|
||||
* @param aEncodings The encodings to be used.
|
||||
*
|
||||
* @param aEncodingStyleURI The encoding style
|
||||
*
|
||||
* @param aSource The variant to be encoded, soon to become a variant
|
||||
*
|
||||
* @param aNamespaceURI The namespace of the thing being coded
|
||||
*
|
||||
* @param aName The name of the thing being coded
|
||||
*
|
||||
* @param aSchemaType The schema type of the thing being encoded
|
||||
*
|
||||
* @param aDestination The node scope where the result will live.
|
||||
*
|
||||
* @param aAttachments Accumulates any attachments.
|
||||
*
|
||||
* @return The element which was inserted and encoded.
|
||||
*/
|
||||
nsIDOMElement encode(
|
||||
in nsIVariant aSource,
|
||||
in AString aNamespaceURI,
|
||||
in AString aName,
|
||||
in nsISchemaType aSchemaType,
|
||||
in nsISOAPAttachments aAttachments,
|
||||
in nsIDOMElement aDestination);
|
||||
|
||||
/**
|
||||
* Decode the source DOM node
|
||||
*
|
||||
* @param aEncodings The encodings used to decode
|
||||
*
|
||||
* @param aEncodingStyleURI The encoding style
|
||||
*
|
||||
* @param aSource The DOM node to be decoded.
|
||||
*
|
||||
* @param aSchemaType The schema type of the source DOM node
|
||||
*
|
||||
* @param aAttachments Dispenses any attachments.
|
||||
*
|
||||
* @return The decoded variant, soon to become a variant, which is null if
|
||||
* the operation failed or did not return a result.
|
||||
*/
|
||||
nsIVariant decode(
|
||||
in nsIDOMElement aSource,
|
||||
in nsISchemaType aSchemaType,
|
||||
in nsISOAPAttachments aAttachments);
|
||||
};
|
||||
|
||||
%{ C++
|
||||
#define NS_DEFAULTSOAPENCODER_CID \
|
||||
{ /* 06fb035c-1dd2-11b2-bc30-f6d8e314d6b9 */ \
|
||||
0x06fb035c, 0x1dd2, 0x11b2, \
|
||||
{0xbc, 0x30, 0xf6, 0xd8, 0xe3, 0x14, 0xd6, 0xb9} }
|
||||
#define NS_SOAPENCODING_CONTRACTID_PREFIX \
|
||||
"@mozilla.org/xmlextras/soap/encoding;1?uri="
|
||||
#define NS_DEFAULTSOAPENCODER_CONTRACTID \
|
||||
NS_SOAPENCODING_CONTRACTID_PREFIX "http://schemas.xmlsoap.org/soap/encoding/"
|
||||
%}
|
||||
@@ -1,69 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 2001 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
|
||||
#include "nsISupports.idl"
|
||||
|
||||
interface nsIDOMElement;
|
||||
|
||||
/**
|
||||
* This interface conveniently interprets information about a fault
|
||||
* that has been returned in a response message.
|
||||
*
|
||||
*/
|
||||
|
||||
[scriptable, uuid(99ec6694-535f-11d4-9a58-000064657374)]
|
||||
interface nsISOAPFault : nsISupports {
|
||||
/**
|
||||
* The DOM element representing the fault in the response SOAP message.
|
||||
* This must be set for the rest of the interface to function correctly.
|
||||
*/
|
||||
attribute nsIDOMElement element;
|
||||
|
||||
/**
|
||||
* The fault code
|
||||
*/
|
||||
readonly attribute AString faultCode;
|
||||
|
||||
/**
|
||||
* The fault string
|
||||
*/
|
||||
readonly attribute AString faultString;
|
||||
|
||||
/**
|
||||
* The fault actor if one was specified.
|
||||
*/
|
||||
readonly attribute AString faultActor;
|
||||
|
||||
/**
|
||||
* The DOM element representing the fault details
|
||||
*/
|
||||
readonly attribute nsIDOMElement detail;
|
||||
};
|
||||
|
||||
%{ C++
|
||||
#define NS_SOAPFAULT_CID \
|
||||
{ /* 87d21ec1-539d-11d4-9a59-00104bdf5339 */ \
|
||||
0x87d21ec1, 0x539d, 0x11d4, \
|
||||
{0x9a, 0x59, 0x00, 0x10, 0x4b, 0xdf, 0x53, 0x39} }
|
||||
#define NS_SOAPFAULT_CONTRACTID \
|
||||
"@mozilla.org/xmlextras/soap/fault;1"
|
||||
%}
|
||||
@@ -1,96 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 2001 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
|
||||
#include "nsISupports.idl"
|
||||
|
||||
interface nsIDOMElement;
|
||||
interface nsIVariant;
|
||||
interface nsISOAPEncoding;
|
||||
interface nsISchemaType;
|
||||
interface nsISOAPAttachments;
|
||||
|
||||
/**
|
||||
* This interface encapsulates an arbitrary header block to be used
|
||||
* by the soap serialization or protocol. It formalizes a type
|
||||
* string, a reference to the object, and a name.
|
||||
*/
|
||||
|
||||
[scriptable, uuid(063d4a4e-1dd2-11b2-a365-cbaf1651f140)]
|
||||
interface nsISOAPHeaderBlock : nsISupports {
|
||||
|
||||
/**
|
||||
* The namespace URI of the header block. Ignored if name is null.
|
||||
*/
|
||||
attribute AString namespaceURI;
|
||||
|
||||
/**
|
||||
* The name of the header block. If the header block is left unnamed, it
|
||||
* will be encoded using the element types defined in the SOAP-ENC
|
||||
* schema. For example, <code><SOAP-ENC:int>45</SOAP-ENC:int>
|
||||
* </code>
|
||||
*/
|
||||
attribute AString name;
|
||||
|
||||
/**
|
||||
* The actor URI of the header block.
|
||||
*/
|
||||
attribute AString actorURI;
|
||||
|
||||
/**
|
||||
* The encoding that was / will be applied to the
|
||||
* header block.
|
||||
*/
|
||||
attribute nsISOAPEncoding encoding;
|
||||
|
||||
/**
|
||||
* The schema type used to encode or decode the
|
||||
* header block.
|
||||
*/
|
||||
attribute nsISchemaType schemaType;
|
||||
|
||||
/**
|
||||
* The element which is the encoded value of this header block.
|
||||
* If this is set, value becomes a computed attribute
|
||||
* which is produced by decoding this element.
|
||||
*/
|
||||
attribute nsIDOMElement element;
|
||||
|
||||
/**
|
||||
* The native value which is the decoded value of
|
||||
* this header block. If this is set, element becomes null.
|
||||
*/
|
||||
attribute nsIVariant value;
|
||||
|
||||
/**
|
||||
* The attachments which were attached to the message.
|
||||
*/
|
||||
attribute nsISOAPAttachments attachments;
|
||||
};
|
||||
|
||||
%{ C++
|
||||
#define NS_SOAPHEADERBLOCK_CID \
|
||||
{ /* 5ad0eace-1dd2-11b2-a260-ff42edcaedb3 */ \
|
||||
0x5ad0eace, 0x1dd2, 0x11b2, \
|
||||
{0xa2, 0x60, 0xff, 0x42, 0xed, 0xca, 0xed, 0xb3} }
|
||||
#define NS_SOAPHEADERBLOCK_CONTRACTID \
|
||||
"@mozilla.org/xmlextras/soap/headerblock;1"
|
||||
%}
|
||||
@@ -1,196 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 2001 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
|
||||
#include "nsISupports.idl"
|
||||
|
||||
interface nsIDOMDocument;
|
||||
interface nsIDOMElement;
|
||||
interface nsISOAPEncoding;
|
||||
interface nsISOAPHeaderBlock;
|
||||
interface nsISOAPParameter;
|
||||
interface nsIVariant;
|
||||
|
||||
/**
|
||||
* 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.
|
||||
*/
|
||||
|
||||
[scriptable, uuid(3970815e-1dd2-11b2-a475-db4dac6826f1)]
|
||||
interface nsISOAPMessage : nsISupports {
|
||||
/**
|
||||
* 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.
|
||||
*/
|
||||
attribute nsIDOMDocument message;
|
||||
|
||||
/**
|
||||
* 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 attribute nsIDOMElement envelope;
|
||||
|
||||
/**
|
||||
* 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.
|
||||
*/
|
||||
readonly attribute nsIDOMElement header;
|
||||
|
||||
/**
|
||||
* 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.
|
||||
*/
|
||||
readonly attribute nsIDOMElement body;
|
||||
|
||||
/**
|
||||
* 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 attribute AString methodName;
|
||||
|
||||
/**
|
||||
* 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 attribute AString targetObjectURI;
|
||||
|
||||
/**
|
||||
* Encodes the specified parameters into this message, if
|
||||
* this message type supports it.
|
||||
*
|
||||
* @param aMethodName The name of the method being invoked
|
||||
* for rpc-style messages. For document-style messages,
|
||||
* this must be null.
|
||||
*
|
||||
* @param aTargetObjectURI The name of the target object
|
||||
* for rpc-style messages. For document-style messages,
|
||||
* this must be null.
|
||||
*
|
||||
* @param aHeaderBlockCount Number of header blocks in array to be
|
||||
* encoded. Must be 0 if header block array is null.
|
||||
*
|
||||
* @param aHeaderBlocks Array of header blocks to be encoded, which
|
||||
* may be null if there are no header blocks.
|
||||
*
|
||||
* @param aParameterCount Number of parameters in array
|
||||
* to be encoded. Must be 0 if parameter array is null.
|
||||
*
|
||||
* @param aParameters An array of parameters to be
|
||||
* encoded, which may null if there are no parameters.
|
||||
*/
|
||||
void encode(
|
||||
in AString aMethodName, in AString aTargetObjectURI,
|
||||
in PRUint32 aHeaderBlockCount,
|
||||
[array, size_is(aHeaderBlockCount)] in nsISOAPHeaderBlock aHeaderBlocks,
|
||||
in PRUint32 aParameterCount,
|
||||
[array, size_is(aParameterCount)] in nsISOAPParameter aParameters);
|
||||
|
||||
/**
|
||||
* Gathers the header blocks of a message so that they can be
|
||||
* accessed by a recipient.
|
||||
*
|
||||
* @param aCount Integer to receive the length of the list
|
||||
* of header blocks.
|
||||
*
|
||||
* @return Array of header blocks found in the message.
|
||||
*/
|
||||
void getHeaderBlocks(out PRUint32 aCount,
|
||||
[array, size_is(aCount), retval] out nsISOAPHeaderBlock aHeaderBlocks);
|
||||
|
||||
/**
|
||||
* Gathers the parameters of a message so that they can be
|
||||
* accessed by a recipient.
|
||||
*
|
||||
* @param aDocumentStyle If true, then the parameters
|
||||
* are looked for treating the message as a document
|
||||
* style message, otherwise it treated as an RPC-style
|
||||
* message.
|
||||
*
|
||||
* @param aCount Integer to receive the length of the list
|
||||
* of parameters.
|
||||
*
|
||||
* @return Array of parameters found in the message.
|
||||
*/
|
||||
void getParameters(in boolean aDocumentStyle,
|
||||
out PRUint32 aCount,
|
||||
[array, size_is(aCount), retval] out nsISOAPParameter aParameters);
|
||||
|
||||
/**
|
||||
* 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.
|
||||
*/
|
||||
attribute nsISOAPEncoding encoding;
|
||||
|
||||
/**
|
||||
* 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.
|
||||
*/
|
||||
attribute AString actionURI;
|
||||
};
|
||||
@@ -1,93 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 2001 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
|
||||
#include "nsISupports.idl"
|
||||
|
||||
interface nsIDOMElement;
|
||||
interface nsIVariant;
|
||||
interface nsISOAPEncoding;
|
||||
interface nsISchemaType;
|
||||
interface nsISOAPAttachments;
|
||||
|
||||
/**
|
||||
* This interface encapsulates an arbitrary parameter to be used
|
||||
* by the soap serialization or protocol. It formalizes a type
|
||||
* string, a reference to the object, and a name.
|
||||
*/
|
||||
|
||||
[scriptable, uuid(99ec6690-535f-11d4-9a58-000064657374)]
|
||||
interface nsISOAPParameter : nsISupports {
|
||||
|
||||
/**
|
||||
* The namespace URI of the parameter. Ignored if name is null.
|
||||
*/
|
||||
attribute AString namespaceURI;
|
||||
|
||||
/**
|
||||
* The name of the parameter. If the parameter is left unnamed, it
|
||||
* will be encoded using the element types defined in the SOAP-ENC
|
||||
* schema. For example, <code><SOAP-ENC:int>45</SOAP-ENC:int>
|
||||
* </code>
|
||||
*/
|
||||
attribute AString name;
|
||||
|
||||
/**
|
||||
* The encoding that was / will be applied to the
|
||||
* parameter.
|
||||
*/
|
||||
attribute nsISOAPEncoding encoding;
|
||||
|
||||
/**
|
||||
* The schema type used to encode or decode the
|
||||
* parameter.
|
||||
*/
|
||||
attribute nsISchemaType schemaType;
|
||||
|
||||
/**
|
||||
* The element which is the encoded value of this parameter.
|
||||
* If this is set, value becomes a computed attribute
|
||||
* which may be produced by decoding this element.
|
||||
*/
|
||||
attribute nsIDOMElement element;
|
||||
|
||||
/**
|
||||
* The native value which is the decoded value of
|
||||
* this parameter. If this is set, element becomes
|
||||
* null.
|
||||
*/
|
||||
attribute nsIVariant value;
|
||||
|
||||
/**
|
||||
* The attachments which were attached to the message
|
||||
* that may be needed to decode the parameter.
|
||||
*/
|
||||
attribute nsISOAPAttachments attachments;
|
||||
};
|
||||
|
||||
%{ C++
|
||||
#define NS_SOAPPARAMETER_CID \
|
||||
{ /* 87d21ec2-539d-11d4-9a59-00104bdf5339 */ \
|
||||
0x87d21ec2, 0x539d, 0x11d4, \
|
||||
{0x9a, 0x59, 0x00, 0x10, 0x4b, 0xdf, 0x53, 0x39} }
|
||||
#define NS_SOAPPARAMETER_CONTRACTID \
|
||||
"@mozilla.org/xmlextras/soap/parameter;1"
|
||||
%}
|
||||
@@ -1,63 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 2001 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
|
||||
#include "nsISupports.idl"
|
||||
#include "nsISOAPCall.idl"
|
||||
|
||||
interface nsISOAPParameter;
|
||||
interface nsISOAPFault;
|
||||
|
||||
/**
|
||||
* This is an extension of a message which contains extra functions
|
||||
* such as tracking, where appropriate, the original call that
|
||||
* produced the response message, identifying the fault, if any,
|
||||
* and supplying the return value.
|
||||
*/
|
||||
|
||||
[scriptable, uuid(99ec6691-535f-11d4-9a58-000064657374)]
|
||||
interface nsISOAPResponse : nsISOAPMessage {
|
||||
/**
|
||||
* The message which generated this response. There is no guarantee
|
||||
* that the message has not been modified since the original call
|
||||
* occurred. This is set automatically when invoking a call that
|
||||
* returns this response. This must also be set by a call processor
|
||||
* so that the transport can return a response to the correct caller.
|
||||
*/
|
||||
attribute nsISOAPCall respondingTo;
|
||||
|
||||
/**
|
||||
* The fault returned in the response, if one was generated. NULL
|
||||
* if there was no fault. This does not rely on the response
|
||||
* parameters having been deserialized.
|
||||
*/
|
||||
readonly attribute nsISOAPFault fault;
|
||||
|
||||
};
|
||||
|
||||
%{ C++
|
||||
#define NS_SOAPRESPONSE_CID \
|
||||
{ /* 87d21ec3-539d-11d4-9a59-00104bdf5339 */ \
|
||||
0x87d21ec3, 0x539d, 0x11d4, \
|
||||
{0x9a, 0x59, 0x00, 0x10, 0x4b, 0xdf, 0x53, 0x39} }
|
||||
#define NS_SOAPRESPONSE_CONTRACTID \
|
||||
"@mozilla.org/xmlextras/soap/response;1"
|
||||
%}
|
||||
@@ -1,61 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 2001 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
|
||||
#include "nsISupports.idl"
|
||||
|
||||
interface nsISOAPCall;
|
||||
interface nsISOAPResponse;
|
||||
|
||||
/**
|
||||
* This interface represents a response handler to be invoked whenever
|
||||
* a response of a particular call is recieved and when no more
|
||||
* responses are expected.
|
||||
*/
|
||||
|
||||
[scriptable, uuid(99ec6692-535f-11d4-9a58-000064657374)]
|
||||
interface nsISOAPResponseListener : nsISupports {
|
||||
/**
|
||||
* This method is invoked when we receive an asynchronous response to
|
||||
* a SOAP message. The listener is registered as part of the original
|
||||
* asynchronous call invocation.
|
||||
*
|
||||
* @param aResponse The decoded version of the response. If an
|
||||
* error occurred transmitting the response, the status field
|
||||
* of the response will contain an error code. The last call
|
||||
* to the listener may contain a null response, which should
|
||||
* only be interpreted as an error if your call expected more
|
||||
* results than it got. If the service or the transport
|
||||
* do not know whether to expect more results, then setting
|
||||
* the last parameter true may only be possible after the
|
||||
* last response has already been delivered.
|
||||
*
|
||||
* @param aLast True if this is the last call to the listener.
|
||||
*
|
||||
* @return True to make this the last call to the listener, even
|
||||
* if last was not true. Calls which expect a single response
|
||||
* should return true upon receiving that response to avoid
|
||||
* possibly recieving another callback with a null response
|
||||
* indicating that the last response was already sent.
|
||||
*/
|
||||
boolean handleResponse(in nsISOAPResponse aResponse,
|
||||
in nsISOAPCall aCall, in unsigned long status, in boolean aLast);
|
||||
};
|
||||
@@ -1,65 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 2001 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
|
||||
#include "nsISupports.idl"
|
||||
|
||||
interface nsISOAPMessage;
|
||||
interface nsISOAPResponseListener;
|
||||
|
||||
/**
|
||||
* This interface describes a service which may be
|
||||
* applied to incoming messages. The service is
|
||||
* responsible for determining whether the message
|
||||
* is one that it should process and rejecting it
|
||||
* if it is not. Services may be chained.
|
||||
*/
|
||||
[scriptable, uuid(9927fa40-1dd1-11b2-a8d1-857ad21b872c)]
|
||||
interface nsISOAPService : nsISupports {
|
||||
/**
|
||||
* Configuration object that may contain more info on the service
|
||||
*/
|
||||
attribute nsISupports configuration;
|
||||
|
||||
/**
|
||||
* Process an incoming message.
|
||||
*
|
||||
* @param aMessage message to be processed
|
||||
*
|
||||
* @param aListener listener to which to report results
|
||||
*
|
||||
* @return True if the message will be handled, false if
|
||||
* it should be given to some other service or fail.
|
||||
* In case of failure, a more detailed status will be
|
||||
* recorded in the message.
|
||||
*/
|
||||
boolean process(in nsISOAPMessage aMessage,
|
||||
in nsISOAPResponseListener aListener);
|
||||
};
|
||||
|
||||
%{ C++
|
||||
#define NS_SOAPJSSERVICE_CID \
|
||||
{ /* 26a41df2-1dd2-11b2-9f29-909e637afa0e */ \
|
||||
0x26a41df2, 0x1dd2, 0x11b2, \
|
||||
{0x9f, 0x29, 0x90, 0x9e, 0x63, 0x7a, 0xfa, 0x0e} }
|
||||
#define NS_SOAPJSSERVICE_CONTRACTID \
|
||||
"@mozilla.org/xmlextras/soap/jsservice;1"
|
||||
%}
|
||||
@@ -1,93 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 2001 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
|
||||
#include "nsISupports.idl"
|
||||
|
||||
interface nsIDOMElement;
|
||||
interface nsISOAPService;
|
||||
interface nsISOAPEncodingRegistry;
|
||||
|
||||
/**
|
||||
* This interface represents a registry of SOAP services.
|
||||
* This registry recieves transports to listen for messages
|
||||
* and services to hand the messages to. Service registries
|
||||
* may be created as required. Destroying a service registry
|
||||
* stops the registry's action. To temporarily register
|
||||
* services, create a new registry. For proper order of
|
||||
* listening precedence, registries should be destroyed
|
||||
* in reverse order. Otherwise, a listening priority
|
||||
* would be required.
|
||||
*/
|
||||
[scriptable, uuid(9790d6bc-1dd1-11b2-afe0-bcb310c078bf)]
|
||||
interface nsISOAPServiceRegistry {
|
||||
/**
|
||||
* Process a configuration and add the resulting sources
|
||||
* and services. This will fail if errors occur during
|
||||
* processing of the configuration.
|
||||
*
|
||||
* @param aConfiguration Root element of configuration XML.
|
||||
*/
|
||||
boolean addConfiguration(in nsIDOMElement aConfiguration);
|
||||
|
||||
/**
|
||||
* Add a transport to be serviced by the registered services.
|
||||
* This will fail if the specified source was already added
|
||||
* with the same setting of the capture flag.
|
||||
*
|
||||
* @param aTransport string specifying the transport to supply
|
||||
* messages for the service.
|
||||
*
|
||||
* @param aCapture True if capturing before later declarations
|
||||
*/
|
||||
void addSource(in AString aTransport, in boolean aCapture);
|
||||
|
||||
/**
|
||||
* Add a service to service the registered transports. This
|
||||
* will fail if the specified service was already added.
|
||||
*
|
||||
* @param aService Service to be serviced.
|
||||
*/
|
||||
void addService(in nsISOAPService aService);
|
||||
|
||||
/**
|
||||
* Registry identifying how to encode and decode
|
||||
* messages containing specific types, automatically
|
||||
* added to messages sent to services in this
|
||||
* registry.
|
||||
*/
|
||||
attribute nsISOAPEncodingRegistry encodings;
|
||||
};
|
||||
|
||||
%{ C++
|
||||
#define NS_SOAPSERVICEREGISTRY_CID \
|
||||
{ /* 3869184e-1dd2-11b2-aa36-d8333498043a */ \
|
||||
0x3869184e, 0x1dd2, 0x11b2, \
|
||||
{0xaa, 0x36, 0xd8, 0x33, 0x34, 0x98, 0x04, 0x3a} }
|
||||
#define NS_SOAPSERVICEREGISTRY_CONTRACTID \
|
||||
"@mozilla.org/xmlextras/soap/serviceregistry;1"
|
||||
#define NS_SOAPDEFAULTSERVICEREGISTRY_CID \
|
||||
{ /* 9120a01e-1dd2-11b2-a61f-906766927a4f */ \
|
||||
0x9120a01e, 0x1dd2, 0x11b2, \
|
||||
{0xa6, 0x1f, 0x90, 0x67, 0x66, 0x92, 0x7a, 0x4f} }
|
||||
#define NS_SOAPDEFAULTSERVICEREGISTRY_CONTRACTID \
|
||||
"@mozilla.org/xmlextras/soap/defaultserviceregistry;1"
|
||||
%}
|
||||
@@ -1,102 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 2001 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
|
||||
#include "nsISupports.idl"
|
||||
|
||||
interface nsISOAPTransportListener;
|
||||
interface nsISOAPCall;
|
||||
interface nsISOAPResponse;
|
||||
interface nsISOAPResponseListener;
|
||||
|
||||
[scriptable, uuid(99ec6695-535f-11d4-9a58-000064657374)]
|
||||
interface nsISOAPTransport : nsISupports {
|
||||
|
||||
/**
|
||||
* Send the specified message to the specified destination.
|
||||
* This will fail if synchronous calls are not supported or if there is any
|
||||
* failure in the actual message exchange. Failure of the call itself will be
|
||||
* contained in the response.
|
||||
*
|
||||
* @param aCall Actual message to be sent.
|
||||
*
|
||||
* @param aResponse Message to be recieved. Calling synchronously assumes that
|
||||
* exactly one response is expected.
|
||||
*/
|
||||
void syncCall( in nsISOAPCall aCall,
|
||||
in nsISOAPResponse aResponse);
|
||||
|
||||
/**
|
||||
* Send the specified message to the specified destination synchronously waiting
|
||||
* for completion and any response.
|
||||
* This will fail if there is any failure in the setup of the message exchange.
|
||||
* Later errors will only be known through the response listener. Failures of the
|
||||
* call itself will be contained in the response passed to the response listener.
|
||||
*
|
||||
* @param aCall Actual message to be sent.
|
||||
*
|
||||
* @param aListener Handler to be invoked (single threaded) as each response is
|
||||
* received and finally with null. If specified as null, no responses are returned.
|
||||
*
|
||||
* @param response Message to recieve response and be handled by listener. May be
|
||||
* null if listener is null.
|
||||
*/
|
||||
void asyncCall(in nsISOAPCall aCall,
|
||||
in nsISOAPResponseListener aListener,
|
||||
in nsISOAPResponse aResponse);
|
||||
|
||||
/**
|
||||
* Add listener for unsolicited messages arriving on the transport. Listeners
|
||||
* are provided with the opportunity to accept and process messages. Typically
|
||||
* a listener will be a service dispatcher. Listeners will be invoked in the
|
||||
* reverse order of declaration, allowing more local service dispatchers to
|
||||
* temporarily override permanent service dispatchers. This will fail if the
|
||||
* desired listener was already added to the transport with the specified
|
||||
* capture flag or if the transport does not support incoming messages.
|
||||
*
|
||||
* @param aListener The listener to recieve unsolicited messages from the
|
||||
* transport.
|
||||
*
|
||||
* @param aCapture True if the listener should capture the message before
|
||||
* later-declared services.
|
||||
*/
|
||||
void addListener(in nsISOAPTransportListener aListener, in boolean aCapture);
|
||||
|
||||
/**
|
||||
* Remove listener for unsolicited messages arriving on the transport. This
|
||||
* will fail if the specified listener was not added with the specified
|
||||
* capture setting.
|
||||
*
|
||||
* @param aListener The listener to stop from recieving unsolicited messages
|
||||
* from the transport.
|
||||
*
|
||||
* @param aCapture True if the listener was added to capture the message before
|
||||
* later-declared services (must be specified to remove, since a listener
|
||||
* may be registered as both).
|
||||
*/
|
||||
void removeListener(in nsISOAPTransportListener aListener, in boolean aCapture);
|
||||
};
|
||||
|
||||
%{ C++
|
||||
#define NS_SOAPTRANSPORT_CONTRACTID \
|
||||
"@mozilla.org/xmlextras/soap/transport;1"
|
||||
#define NS_SOAPTRANSPORT_CONTRACTID_PREFIX NS_SOAPTRANSPORT_CONTRACTID "?protocol="
|
||||
%}
|
||||
@@ -1,50 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 2001 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
|
||||
#include "nsISupports.idl"
|
||||
|
||||
interface nsIDOMDocument;
|
||||
interface nsISOAPMessage;
|
||||
|
||||
/**
|
||||
* This interface recieves control when an unsolicited transport
|
||||
* is recieved on a transport.
|
||||
*/
|
||||
|
||||
[scriptable, uuid(99ec6696-535f-11d4-9a58-000064657374)]
|
||||
interface nsISOAPTransportListener : nsISupports {
|
||||
|
||||
/**
|
||||
* This method is invoked when an unsolicited message is
|
||||
* recieved. First all listeners are tried in the order declared
|
||||
* with the capture flag set. Then all listeners are tried in
|
||||
* the reverse order declared with the capture flag clear.
|
||||
*
|
||||
* @param aMessage Actual message.
|
||||
*
|
||||
* @param aCapture True if the listener is being permitted to gain
|
||||
* control before all later-added listeners.
|
||||
*
|
||||
* @return true if message is handled, false if it was not
|
||||
*/
|
||||
boolean handleMessage(in nsISOAPMessage aMessage, in boolean aCapture);
|
||||
};
|
||||
@@ -1,52 +0,0 @@
|
||||
#
|
||||
# The contents of this file are subject to the Mozilla Public
|
||||
# License Version 1.1 (the "License"); you may not use this file
|
||||
# except in compliance with the License. You may obtain a copy of
|
||||
# the License at http://www.mozilla.org/MPL/
|
||||
#
|
||||
# Software distributed under the License is distributed on an "AS
|
||||
# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
# implied. See the License for the specific language governing
|
||||
# rights and limitations under the License.
|
||||
#
|
||||
# The Original Code is mozilla.org code.
|
||||
#
|
||||
# The Initial Developer of the Original Code is Netscape
|
||||
# Communications Corporation. Portions created by Netscape are
|
||||
# Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
# Rights Reserved.
|
||||
#
|
||||
# Contributor(s):
|
||||
#
|
||||
|
||||
DEPTH = ../../../..
|
||||
topsrcdir = ../../../..
|
||||
srcdir = .
|
||||
VPATH = .
|
||||
|
||||
include $(DEPTH)/config/autoconf.mk
|
||||
|
||||
MODULE = xmlextras
|
||||
LIBRARY_NAME = xmlextrassoap_s
|
||||
REQUIRES = xpcom string caps dom js widget layout xpconnect necko
|
||||
|
||||
CPPSRCS = \
|
||||
nsSOAPCall.cpp \
|
||||
nsDefaultSOAPEncoder.cpp\
|
||||
nsSOAPFault.cpp \
|
||||
nsSOAPHeaderBlock.cpp \
|
||||
nsSOAPJSValue.cpp \
|
||||
nsSOAPMessage.cpp \
|
||||
nsSOAPParameter.cpp \
|
||||
nsSOAPResponse.cpp \
|
||||
nsSOAPStruct.cpp \
|
||||
nsSOAPUtils.cpp \
|
||||
nsSOAPEncodingRegistry.cpp \
|
||||
$(NULL)
|
||||
|
||||
# we don't want the shared lib, but we want to force the creation of a
|
||||
# static lib.
|
||||
override NO_SHARED_LIB=1
|
||||
override NO_STATIC_LIB=
|
||||
|
||||
include $(topsrcdir)/config/rules.mk
|
||||
@@ -1,52 +0,0 @@
|
||||
#
|
||||
# The contents of this file are subject to the Mozilla Public
|
||||
# License Version 1.1 (the "License"); you may not use this file
|
||||
# except in compliance with the License. You may obtain a copy of
|
||||
# the License at http://www.mozilla.org/MPL/
|
||||
#
|
||||
# Software distributed under the License is distributed on an "AS
|
||||
# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
# implied. See the License for the specific language governing
|
||||
# rights and limitations under the License.
|
||||
#
|
||||
# The Original Code is mozilla.org code.
|
||||
#
|
||||
# The Initial Developer of the Original Code is Netscape
|
||||
# Communications Corporation. Portions created by Netscape are
|
||||
# Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
# Rights Reserved.
|
||||
#
|
||||
# Contributor(s):
|
||||
#
|
||||
|
||||
DEPTH = ../../../..
|
||||
topsrcdir = @top_srcdir@
|
||||
srcdir = @srcdir@
|
||||
VPATH = @srcdir@
|
||||
|
||||
include $(DEPTH)/config/autoconf.mk
|
||||
|
||||
MODULE = xmlextras
|
||||
LIBRARY_NAME = xmlextrassoap_s
|
||||
REQUIRES = xpcom string caps dom js widget xpconnect necko schema
|
||||
|
||||
CPPSRCS = \
|
||||
nsDefaultSOAPEncoder.cpp\
|
||||
nsHTTPSOAPTransport.cpp \
|
||||
nsSOAPCall.cpp \
|
||||
nsSOAPEncoding.cpp \
|
||||
nsSOAPFault.cpp \
|
||||
nsSOAPHeaderBlock.cpp \
|
||||
nsSOAPMessage.cpp \
|
||||
nsSOAPParameter.cpp \
|
||||
nsSOAPResponse.cpp \
|
||||
nsSOAPUtils.cpp \
|
||||
$(NULL)
|
||||
|
||||
# we don't want the shared lib, but we want to force the creation of a
|
||||
# static lib.
|
||||
FORCE_STATIC_LIB = 1
|
||||
#override NO_SHARED_LIB=1
|
||||
#override NO_STATIC_LIB=
|
||||
|
||||
include $(topsrcdir)/config/rules.mk
|
||||
@@ -1,64 +0,0 @@
|
||||
#!nmake
|
||||
#
|
||||
# The contents of this file are subject to the Netscape Public
|
||||
# License Version 1.1 (the "License"); you may not use this file
|
||||
# except in compliance with the License. You may obtain a copy of
|
||||
# the License at http://www.mozilla.org/NPL/
|
||||
#
|
||||
# Software distributed under the License is distributed on an "AS
|
||||
# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
# implied. See the License for the specific language governing
|
||||
# rights and limitations under the License.
|
||||
#
|
||||
# The Original Code is mozilla.org code.
|
||||
#
|
||||
# The Initial Developer of the Original Code is Netscape
|
||||
# Communications Corporation. Portions created by Netscape are
|
||||
# Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
# Rights Reserved.
|
||||
#
|
||||
# Contributor(s):
|
||||
|
||||
DEPTH=..\..\..\..
|
||||
|
||||
LIBRARY_NAME=xmlextrassoap_s
|
||||
MODULE=xmlextras
|
||||
|
||||
REQUIRES = \
|
||||
xpcom \
|
||||
string \
|
||||
caps \
|
||||
dom \
|
||||
js \
|
||||
widget \
|
||||
xpconnect \
|
||||
necko
|
||||
|
||||
DEFINES=-D_IMPL_NS_HTML -DWIN32_LEAN_AND_MEAN
|
||||
|
||||
OBJS= \
|
||||
.\$(OBJDIR)\nsDefaultSOAPEncoder.obj \
|
||||
.\$(OBJDIR)\nsHTTPSOAPTransport.obj \
|
||||
.\$(OBJDIR)\nsSOAPCall.obj \
|
||||
.\$(OBJDIR)\nsSOAPEncoding.obj \
|
||||
.\$(OBJDIR)\nsSOAPFault.obj \
|
||||
.\$(OBJDIR)\nsSOAPHeaderBlock.obj \
|
||||
.\$(OBJDIR)\nsSOAPMessage.obj \
|
||||
.\$(OBJDIR)\nsSOAPParameter.obj \
|
||||
.\$(OBJDIR)\nsSOAPResponse.obj \
|
||||
# .\$(OBJDIR)\nsSOAPStruct.obj \
|
||||
.\$(OBJDIR)\nsSOAPUtils.obj \
|
||||
$(NULL)
|
||||
|
||||
LCFLAGS = \
|
||||
$(LCFLAGS) \
|
||||
$(DEFINES) \
|
||||
$(NULL)
|
||||
|
||||
include <$(DEPTH)\config\rules.mak>
|
||||
|
||||
libs:: $(LIBRARY)
|
||||
$(MAKE_INSTALL) $(LIBRARY) $(DIST)\lib
|
||||
|
||||
clobber::
|
||||
rm -f $(DIST)\lib\$(LIBRARY_NAME).lib
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,34 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
|
||||
#ifndef nsDefaultSOAPEncoder_h__
|
||||
#define nsDefaultSOAPEncoder_h__
|
||||
|
||||
#include "nsSOAPEncoding.h"
|
||||
|
||||
class nsDefaultSOAPEncoder : public nsSOAPEncoding
|
||||
{
|
||||
public:
|
||||
nsDefaultSOAPEncoder();
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -1,196 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
|
||||
#include "nsHTTPSOAPTransport.h"
|
||||
#include "nsIComponentManager.h"
|
||||
#include "nsIDOMDocument.h"
|
||||
#include "nsString.h"
|
||||
#include "nsSOAPUtils.h"
|
||||
#include "nsSOAPCall.h"
|
||||
#include "nsSOAPResponse.h"
|
||||
#include "nsIDOMEventTarget.h"
|
||||
|
||||
nsHTTPSOAPTransport::nsHTTPSOAPTransport()
|
||||
{
|
||||
NS_INIT_ISUPPORTS();
|
||||
}
|
||||
|
||||
nsHTTPSOAPTransport::~nsHTTPSOAPTransport()
|
||||
{
|
||||
}
|
||||
|
||||
NS_IMPL_ISUPPORTS1_CI(nsHTTPSOAPTransport, nsISOAPTransport)
|
||||
|
||||
/* void syncCall (in nsISOAPCall aCall, in nsISOAPResponse aResponse); */
|
||||
NS_IMETHODIMP nsHTTPSOAPTransport::SyncCall(nsISOAPCall *aCall, nsISOAPResponse *aResponse)
|
||||
{
|
||||
NS_ENSURE_ARG(aCall);
|
||||
|
||||
nsresult rv;
|
||||
nsCOMPtr<nsIXMLHttpRequest> request;
|
||||
|
||||
request = do_CreateInstance(NS_XMLHTTPREQUEST_CONTRACTID, &rv);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
nsAutoString action;
|
||||
rv = aCall->GetActionURI(action);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
if (!AStringIsNull(action)) {
|
||||
rv = request->SetRequestHeader("SOAPAction", NS_ConvertUCS2toUTF8(action).get());
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
}
|
||||
|
||||
nsAutoString uri;
|
||||
rv = aCall->GetTransportURI(uri);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
if (!AStringIsNull(uri)) return NS_ERROR_NOT_INITIALIZED;
|
||||
|
||||
nsCOMPtr<nsIDOMDocument> messageDocument;
|
||||
rv = aCall->GetMessage(getter_AddRefs(messageDocument));
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
if (!messageDocument) return NS_ERROR_NOT_INITIALIZED;
|
||||
|
||||
rv = request->OpenRequest("POST", NS_ConvertUCS2toUTF8(uri).get(), PR_FALSE, nsnull, nsnull);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
rv = request->Send(messageDocument);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
request->GetStatus(&rv);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
if (aResponse) {
|
||||
nsCOMPtr<nsIDOMDocument> response;
|
||||
rv = request->GetResponseXML(getter_AddRefs(response));
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
rv = aResponse->SetMessage(response);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
class nsHTTPSOAPTransportCompletion : public nsIDOMEventListener
|
||||
{
|
||||
public:
|
||||
nsHTTPSOAPTransportCompletion();
|
||||
virtual ~nsHTTPSOAPTransportCompletion();
|
||||
|
||||
NS_DECL_ISUPPORTS
|
||||
|
||||
// nsIDOMEventListener
|
||||
NS_IMETHOD HandleEvent(nsIDOMEvent* aEvent);
|
||||
|
||||
protected:
|
||||
nsCOMPtr<nsISOAPCall> mCall;
|
||||
nsCOMPtr<nsISOAPResponse> mResponse;
|
||||
nsCOMPtr<nsIXMLHttpRequest> mRequest;
|
||||
nsCOMPtr<nsISOAPResponseListener> mListener;
|
||||
};
|
||||
|
||||
NS_IMPL_ISUPPORTS1(nsHTTPSOAPTransportCompletion, nsIDOMEventListener)
|
||||
|
||||
nsHTTPSOAPTransportCompletion::nsHTTPSOAPTransportCompletion()
|
||||
{
|
||||
NS_INIT_ISUPPORTS();
|
||||
}
|
||||
nsHTTPSOAPTransportCompletion::~nsHTTPSOAPTransportCompletion()
|
||||
{
|
||||
}
|
||||
NS_IMETHODIMP
|
||||
nsHTTPSOAPTransportCompletion::HandleEvent(nsIDOMEvent* aEvent)
|
||||
{
|
||||
nsresult rv;
|
||||
mRequest->GetStatus(&rv);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsCOMPtr<nsIDOMDocument> document;
|
||||
rv = mRequest->GetResponseXML(getter_AddRefs(document));
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
rv = mResponse->SetMessage(document);
|
||||
}
|
||||
}
|
||||
PRBool c; // In other transports, this may signal to stop returning if multiple returns
|
||||
mListener->HandleResponse(mResponse, mCall, (PRInt32)rv, PR_TRUE, &c);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/* void asyncCall (in nsISOAPCall aCall, in nsISOAPResponseListener aListener, in nsISOAPResponse aResponse); */
|
||||
NS_IMETHODIMP nsHTTPSOAPTransport::AsyncCall(nsISOAPCall *aCall, nsISOAPResponseListener *aListener, nsISOAPResponse *aResponse)
|
||||
{
|
||||
NS_ENSURE_ARG(aCall);
|
||||
|
||||
nsresult rv;
|
||||
nsCOMPtr<nsIXMLHttpRequest> request;
|
||||
|
||||
nsCOMPtr<nsIDOMEventTarget> eventTarget = do_QueryInterface(request, &rv);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
request = do_CreateInstance(NS_XMLHTTPREQUEST_CONTRACTID, &rv);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
nsAutoString action;
|
||||
rv = aCall->GetActionURI(action);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
if (!AStringIsNull(action)) {
|
||||
rv = request->SetRequestHeader("SOAPAction", NS_ConvertUCS2toUTF8(action).get());
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
}
|
||||
nsCOMPtr<nsIDOMEventListener> listener = new nsHTTPSOAPTransportCompletion();
|
||||
if (!listener) return NS_ERROR_OUT_OF_MEMORY;
|
||||
|
||||
nsAutoString uri;
|
||||
rv = aCall->GetTransportURI(uri);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
if (!AStringIsNull(uri)) return NS_ERROR_NOT_INITIALIZED;
|
||||
|
||||
nsCOMPtr<nsIDOMDocument> messageDocument;
|
||||
rv = aCall->GetMessage(getter_AddRefs(messageDocument));
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
if (!messageDocument) return NS_ERROR_NOT_INITIALIZED;
|
||||
|
||||
rv = request->OpenRequest("POST", NS_ConvertUCS2toUTF8(uri).get(), PR_TRUE, nsnull, nsnull);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
rv = request->Send(messageDocument);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
eventTarget->AddEventListener(NS_LITERAL_STRING("load"), listener, PR_FALSE);
|
||||
eventTarget->AddEventListener(NS_LITERAL_STRING("error"), listener, PR_FALSE);
|
||||
|
||||
rv = request->Send(messageDocument);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/* void addListener (in nsISOAPTransportListener aListener, in boolean aCapture); */
|
||||
NS_IMETHODIMP nsHTTPSOAPTransport::AddListener(nsISOAPTransportListener *aListener, PRBool aCapture)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
/* void removeListener (in nsISOAPTransportListener aListener, in boolean aCapture); */
|
||||
NS_IMETHODIMP nsHTTPSOAPTransport::RemoveListener(nsISOAPTransportListener *aListener, PRBool aCapture)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
@@ -1,50 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
|
||||
#ifndef nsHTTPSOAPTransport_h__
|
||||
#define nsHTTPSOAPTransport_h__
|
||||
|
||||
#include "nsISOAPTransport.h"
|
||||
#include "nsIXMLHttpRequest.h"
|
||||
#include "nsIDOMEventListener.h"
|
||||
#include "nsISOAPTransportListener.h"
|
||||
#include "nsCOMPtr.h"
|
||||
|
||||
class nsHTTPSOAPTransport : public nsISOAPTransport
|
||||
{
|
||||
public:
|
||||
nsHTTPSOAPTransport();
|
||||
virtual ~nsHTTPSOAPTransport();
|
||||
|
||||
NS_DECL_ISUPPORTS
|
||||
|
||||
// nsISOAPTransport
|
||||
NS_DECL_NSISOAPTRANSPORT
|
||||
};
|
||||
|
||||
#define NS_HTTPSOAPTRANSPORT_CID \
|
||||
{ /* d852ade0-5823-11d4-9a62-00104bdf5339 */ \
|
||||
0xd852ade0, 0x5823, 0x11d4, \
|
||||
{0x9a, 0x62, 0x00, 0x10, 0x4b, 0xdf, 0x53, 0x39} }
|
||||
#define NS_HTTPSOAPTRANSPORT_CONTRACTID NS_SOAPTRANSPORT_CONTRACTID_PREFIX "http"
|
||||
|
||||
#endif
|
||||
@@ -1,187 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
|
||||
#include "nsSOAPCall.h"
|
||||
#include "nsSOAPResponse.h"
|
||||
#include "nsSOAPUtils.h"
|
||||
#include "nsISOAPTransport.h"
|
||||
#include "nsIServiceManager.h"
|
||||
#include "nsIComponentManager.h"
|
||||
#include "nsIURI.h"
|
||||
#include "nsNetUtil.h"
|
||||
|
||||
/////////////////////////////////////////////
|
||||
//
|
||||
//
|
||||
/////////////////////////////////////////////
|
||||
|
||||
nsSOAPCall::nsSOAPCall()
|
||||
{
|
||||
}
|
||||
|
||||
nsSOAPCall::~nsSOAPCall()
|
||||
{
|
||||
}
|
||||
|
||||
NS_IMPL_CI_INTERFACE_GETTER2(nsSOAPCall, nsISOAPMessage, nsISOAPCall)
|
||||
NS_IMPL_ADDREF_INHERITED(nsSOAPCall, nsSOAPMessage)
|
||||
NS_IMPL_RELEASE_INHERITED(nsSOAPCall, nsSOAPMessage)
|
||||
|
||||
NS_INTERFACE_MAP_BEGIN(nsSOAPCall)
|
||||
NS_INTERFACE_MAP_ENTRY(nsISOAPCall)
|
||||
NS_IMPL_QUERY_CLASSINFO(nsSOAPCall)
|
||||
NS_INTERFACE_MAP_END_INHERITING(nsSOAPMessage)
|
||||
|
||||
/* attribute DOMString transportURI; */
|
||||
NS_IMETHODIMP nsSOAPCall::GetTransportURI(nsAWritableString & aTransportURI)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(&aTransportURI);
|
||||
aTransportURI.Assign(mTransportURI);
|
||||
return NS_OK;
|
||||
}
|
||||
NS_IMETHODIMP nsSOAPCall::SetTransportURI(const nsAReadableString & aTransportURI)
|
||||
{
|
||||
mTransportURI.Assign(aTransportURI);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsSOAPCall::GetTransport(nsISOAPTransport** aTransport)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aTransport);
|
||||
nsresult rv;
|
||||
nsCOMPtr<nsIURI> uri;
|
||||
nsXPIDLCString protocol;
|
||||
nsCString transportURI(ToNewCString(mTransportURI));
|
||||
|
||||
rv = NS_NewURI(getter_AddRefs(uri), transportURI.get());
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
uri->GetScheme(getter_Copies(protocol));
|
||||
|
||||
nsCAutoString transportContractid;
|
||||
transportContractid.Assign(NS_SOAPTRANSPORT_CONTRACTID_PREFIX);
|
||||
transportContractid.Append(protocol);
|
||||
|
||||
nsCOMPtr<nsISOAPTransport> transport = do_GetService(transportContractid.get(), &rv);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
*aTransport = transport.get();
|
||||
NS_ADDREF(*aTransport);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/* nsISOAPResponse invoke (); */
|
||||
NS_IMETHODIMP nsSOAPCall::Invoke(nsISOAPResponse **_retval)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(_retval);
|
||||
nsresult rv;
|
||||
nsCOMPtr<nsISOAPTransport> transport;
|
||||
|
||||
if (mTransportURI.Length() == 0) {
|
||||
return NS_ERROR_NOT_INITIALIZED;
|
||||
}
|
||||
|
||||
rv = GetTransport(getter_AddRefs(transport));
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
nsCOMPtr<nsISOAPResponse> response;
|
||||
response = new nsSOAPResponse();
|
||||
if (!response) return NS_ERROR_OUT_OF_MEMORY;
|
||||
rv = response->SetEncoding(mEncoding);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
rv = transport->SyncCall(this, response);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
return response->QueryInterface(NS_GET_IID(nsISOAPResponse), (void**)_retval);
|
||||
}
|
||||
|
||||
/* void asyncInvoke (in nsISOAPResponseListener listener); */
|
||||
NS_IMETHODIMP nsSOAPCall::AsyncInvoke(nsISOAPResponseListener *listener)
|
||||
{
|
||||
nsresult rv;
|
||||
nsCOMPtr<nsISOAPTransport> transport;
|
||||
|
||||
if (mTransportURI.Length() == 0) {
|
||||
return NS_ERROR_NOT_INITIALIZED;
|
||||
}
|
||||
|
||||
rv = GetTransport(getter_AddRefs(transport));
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
nsCOMPtr<nsISOAPResponse> response;
|
||||
response = new nsSOAPResponse();
|
||||
if (!response) return NS_ERROR_OUT_OF_MEMORY;
|
||||
rv = response->SetEncoding(mEncoding);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
rv = transport->AsyncCall(this, listener, response);
|
||||
return rv;
|
||||
}
|
||||
|
||||
static const char* kAllAccess = "AllAccess";
|
||||
|
||||
/* string canCreateWrapper (in nsIIDPtr iid); */
|
||||
NS_IMETHODIMP
|
||||
nsSOAPCall::CanCreateWrapper(const nsIID * iid, char **_retval)
|
||||
{
|
||||
if (iid->Equals(NS_GET_IID(nsISOAPCall))) {
|
||||
*_retval = nsCRT::strdup(kAllAccess);
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/* string canCallMethod (in nsIIDPtr iid, in wstring methodName); */
|
||||
NS_IMETHODIMP
|
||||
nsSOAPCall::CanCallMethod(const nsIID * iid, const PRUnichar *methodName, char **_retval)
|
||||
{
|
||||
if (iid->Equals(NS_GET_IID(nsISOAPCall))) {
|
||||
*_retval = nsCRT::strdup(kAllAccess);
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/* string canGetProperty (in nsIIDPtr iid, in wstring propertyName); */
|
||||
NS_IMETHODIMP
|
||||
nsSOAPCall::CanGetProperty(const nsIID * iid, const PRUnichar *propertyName, char **_retval)
|
||||
{
|
||||
if (iid->Equals(NS_GET_IID(nsISOAPCall))) {
|
||||
*_retval = nsCRT::strdup(kAllAccess);
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/* string canSetProperty (in nsIIDPtr iid, in wstring propertyName); */
|
||||
NS_IMETHODIMP
|
||||
nsSOAPCall::CanSetProperty(const nsIID * iid, const PRUnichar *propertyName, char **_retval)
|
||||
{
|
||||
if (iid->Equals(NS_GET_IID(nsISOAPCall))) {
|
||||
*_retval = nsCRT::strdup(kAllAccess);
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
@@ -1,58 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
|
||||
#ifndef nsSOAPCall_h__
|
||||
#define nsSOAPCall_h__
|
||||
|
||||
#include "nsString.h"
|
||||
#include "nsSOAPMessage.h"
|
||||
#include "nsISOAPCall.h"
|
||||
#include "nsISecurityCheckedComponent.h"
|
||||
#include "nsISOAPTransport.h"
|
||||
#include "nsISOAPResponseListener.h"
|
||||
#include "nsCOMPtr.h"
|
||||
|
||||
class nsSOAPCall : public nsSOAPMessage,
|
||||
public nsISOAPCall
|
||||
{
|
||||
public:
|
||||
nsSOAPCall();
|
||||
virtual ~nsSOAPCall();
|
||||
|
||||
NS_DECL_ISUPPORTS
|
||||
|
||||
// nsISOAPCall
|
||||
NS_FORWARD_NSISOAPMESSAGE(nsSOAPMessage::)
|
||||
|
||||
// nsISOAPCall
|
||||
NS_DECL_NSISOAPCALL
|
||||
|
||||
// nsISecurityCheckedComponent
|
||||
NS_DECL_NSISECURITYCHECKEDCOMPONENT
|
||||
|
||||
protected:
|
||||
|
||||
nsString mTransportURI;
|
||||
nsresult GetTransport(nsISOAPTransport** aTransport);
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -1,405 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
|
||||
#include "nsString.h"
|
||||
#include "nsISOAPParameter.h"
|
||||
#include "nsSOAPMessage.h"
|
||||
#include "nsISOAPEncoder.h"
|
||||
#include "nsISOAPDecoder.h"
|
||||
#include "nsSOAPEncoding.h"
|
||||
#include "nsSOAPUtils.h"
|
||||
#include "nsIServiceManager.h"
|
||||
#include "nsIComponentManager.h"
|
||||
#include "nsIDOMNodeList.h"
|
||||
#include "nsISchema.h"
|
||||
#include "nsISchemaLoader.h"
|
||||
#include "nsSOAPUtils.h"
|
||||
|
||||
// First comes the registry which shares between associated encodings but is never seen by xpconnect.
|
||||
|
||||
NS_IMPL_ISUPPORTS1(nsSOAPEncodingRegistry,nsISOAPEncoding)
|
||||
|
||||
nsSOAPEncodingRegistry::nsSOAPEncodingRegistry(nsISOAPEncoding* aEncoding): mEncodings(new nsSupportsHashtable)
|
||||
{
|
||||
NS_INIT_ISUPPORTS();
|
||||
|
||||
nsAutoString style;
|
||||
aEncoding->GetStyleURI(style);
|
||||
nsStringKey styleKey(style);
|
||||
mEncodings->Put(&styleKey, aEncoding);
|
||||
/* member initializers and constructor code */
|
||||
}
|
||||
|
||||
nsSOAPEncodingRegistry::~nsSOAPEncodingRegistry()
|
||||
{
|
||||
/* destructor code */
|
||||
delete mEncodings;
|
||||
}
|
||||
|
||||
nsresult nsSOAPEncodingRegistry::GetStyle(const nsAString& aStyleURI, PRBool aCreateIf, nsISOAPEncoding* * aEncoding)
|
||||
{
|
||||
NS_SOAP_ENSURE_ARG_STRING(aStyleURI);
|
||||
NS_ENSURE_ARG_POINTER(aEncoding);
|
||||
nsStringKey styleKey(aStyleURI);
|
||||
*aEncoding = (nsISOAPEncoding*)mEncodings->Get(&styleKey);
|
||||
if (!*aEncoding)
|
||||
{
|
||||
nsCOMPtr<nsISOAPEncoding> defaultEncoding;
|
||||
nsCAutoString encodingContractid;
|
||||
encodingContractid.Assign(NS_SOAPENCODING_CONTRACTID_PREFIX);
|
||||
encodingContractid.Append(NS_ConvertUCS2toUTF8(aStyleURI));
|
||||
defaultEncoding = do_GetService(encodingContractid.get());
|
||||
if (defaultEncoding || aCreateIf) {
|
||||
*aEncoding = new nsSOAPEncoding(aStyleURI, this, defaultEncoding);
|
||||
mEncodings->Put(&styleKey, *aEncoding);
|
||||
}
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
nsresult nsSOAPEncodingRegistry::SetSchemaCollection(nsISchemaCollection* aSchemaCollection)
|
||||
{
|
||||
NS_ENSURE_ARG(aSchemaCollection);
|
||||
mSchemaCollection = aSchemaCollection;
|
||||
return NS_OK;
|
||||
}
|
||||
nsresult nsSOAPEncodingRegistry::GetSchemaCollection(nsISchemaCollection** aSchemaCollection)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aSchemaCollection);
|
||||
if (!mSchemaCollection) {
|
||||
nsresult rv;
|
||||
nsCOMPtr<nsISchemaLoader>loader = do_CreateInstance(NS_SCHEMALOADER_CONTRACTID, &rv);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
mSchemaCollection = do_QueryInterface(loader);
|
||||
if (!mSchemaCollection) return NS_ERROR_FAILURE;
|
||||
}
|
||||
*aSchemaCollection = mSchemaCollection;
|
||||
NS_ADDREF(*aSchemaCollection);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/* readonly attribute AString styleURI; */
|
||||
NS_IMETHODIMP nsSOAPEncodingRegistry::GetStyleURI(nsAString & aStyleURI)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
/* nsISOAPEncoder setEncoder (in AString aSchemaNamespaceURI, in AString aSchemaType, in nsISOAPEncoder aEncoder); */
|
||||
NS_IMETHODIMP nsSOAPEncodingRegistry::SetEncoder(const nsAString & aSchemaNamespaceURI, const nsAString & aSchemaType, nsISOAPEncoder *aEncoder)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
/* nsISOAPEncoder getEncoder (in AString aSchemaNamespaceURI, in AString aSchemaType); */
|
||||
NS_IMETHODIMP nsSOAPEncodingRegistry::GetEncoder(const nsAString & aSchemaNamespaceURI, const nsAString & aSchemaType, nsISOAPEncoder **_retval)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
/* nsISOAPDecoder setDecoder (in AString aSchemaNamespaceURI, in AString aSchemaType, in nsISOAPDecoder aDecoder); */
|
||||
NS_IMETHODIMP nsSOAPEncodingRegistry::SetDecoder(const nsAString & aSchemaNamespaceURI, const nsAString & aSchemaType, nsISOAPDecoder *aDecoder)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
/* nsISOAPDecoder getDecoder (in AString aSchemaNamespaceURI, in AString aSchemaType); */
|
||||
NS_IMETHODIMP nsSOAPEncodingRegistry::GetDecoder(const nsAString & aSchemaNamespaceURI, const nsAString & aSchemaType, nsISOAPDecoder **_retval)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
/* attribute nsISOAPEncoder defaultEncoder; */
|
||||
NS_IMETHODIMP nsSOAPEncodingRegistry::GetDefaultEncoder(nsISOAPEncoder * *aDefaultEncoder)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
NS_IMETHODIMP nsSOAPEncodingRegistry::SetDefaultEncoder(nsISOAPEncoder * aDefaultEncoder)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
/* attribute nsISOAPDecoder defaultDecoder; */
|
||||
NS_IMETHODIMP nsSOAPEncodingRegistry::GetDefaultDecoder(nsISOAPDecoder * *aDefaultDecoder)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
NS_IMETHODIMP nsSOAPEncodingRegistry::SetDefaultDecoder(nsISOAPDecoder * aDefaultDecoder)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
/* nsIDOMElement encode (in nsIVariant aSource, in AString aNamespaceURI, in AString aName, in nsISchemaType aSchemaType, in nsISOAPAttachments aAttachments, in nsIDOMElement aDestination); */
|
||||
NS_IMETHODIMP nsSOAPEncodingRegistry::Encode(nsIVariant *aSource, const nsAString & aNamespaceURI, const nsAString & aName, nsISchemaType *aSchemaType, nsISOAPAttachments *aAttachments, nsIDOMElement *aDestination, nsIDOMElement **_retval)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
/* nsIVariant decode (in nsIDOMElement aSource, in nsISchemaType aSchemaType, in nsISOAPAttachments aAttachments); */
|
||||
NS_IMETHODIMP nsSOAPEncodingRegistry::Decode(nsIDOMElement *aSource, nsISchemaType *aSchemaType, nsISOAPAttachments *aAttachments, nsIVariant **_retval)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
// Second, we create the encodings themselves.
|
||||
|
||||
NS_IMPL_ISUPPORTS2(nsSOAPEncoding, nsISOAPEncoding, nsISecurityCheckedComponent)
|
||||
|
||||
nsSOAPEncoding::nsSOAPEncoding(): mEncoders(new nsSupportsHashtable),
|
||||
mDecoders(new nsSupportsHashtable)
|
||||
{
|
||||
NS_INIT_ISUPPORTS();
|
||||
|
||||
/* member initializers and constructor code */
|
||||
|
||||
mStyleURI.Assign(nsSOAPUtils::kSOAPEncodingURI);
|
||||
mDefaultEncoding = do_GetService(NS_DEFAULTSOAPENCODER_CONTRACTID);
|
||||
mRegistry = new nsSOAPEncodingRegistry(this);
|
||||
}
|
||||
|
||||
nsSOAPEncoding::nsSOAPEncoding(const nsAString& aStyleURI, nsSOAPEncodingRegistry* aRegistry, nsISOAPEncoding* aDefaultEncoding)
|
||||
: mEncoders(new nsSupportsHashtable), mDecoders(new nsSupportsHashtable)
|
||||
{
|
||||
NS_INIT_ISUPPORTS();
|
||||
|
||||
/* member initializers and constructor code */
|
||||
|
||||
mStyleURI.Assign(aStyleURI);
|
||||
mRegistry = aRegistry;
|
||||
mDefaultEncoding = aDefaultEncoding;
|
||||
}
|
||||
|
||||
nsSOAPEncoding::~nsSOAPEncoding()
|
||||
{
|
||||
/* destructor code */
|
||||
delete mEncoders;
|
||||
delete mDecoders;
|
||||
}
|
||||
|
||||
nsresult nsSOAPEncoding::SetSchemaCollection(nsISchemaCollection* aSchemaCollection)
|
||||
{
|
||||
NS_ENSURE_ARG(aSchemaCollection);
|
||||
return mRegistry->SetSchemaCollection(aSchemaCollection);
|
||||
}
|
||||
nsresult nsSOAPEncoding::GetSchemaCollection(nsISchemaCollection** aSchemaCollection)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aSchemaCollection);
|
||||
return mRegistry->GetSchemaCollection(aSchemaCollection);
|
||||
}
|
||||
|
||||
/* readonly attribute AString styleURI; */
|
||||
NS_IMETHODIMP nsSOAPEncoding::GetStyleURI(nsAString & aStyleURI)
|
||||
{
|
||||
NS_SOAP_ENSURE_ARG_STRING(aStyleURI);
|
||||
aStyleURI.Assign(mStyleURI);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/* nsISOAPEncoding getStyle (in AString aStyleURI, in boolean aCreateIf); */
|
||||
NS_IMETHODIMP nsSOAPEncoding::GetStyle(const nsAString & aStyleURI, PRBool aCreateIf, nsISOAPEncoding **_retval)
|
||||
{
|
||||
NS_SOAP_ENSURE_ARG_STRING(aStyleURI);
|
||||
NS_ENSURE_ARG_POINTER(_retval);
|
||||
return mRegistry->GetStyle(aStyleURI, aCreateIf, _retval);
|
||||
}
|
||||
|
||||
/* nsISOAPEncoder setEncoder (in AString aSchemaNamespaceURI, in AString aSchemaType, in nsISOAPEncoder aEncoder); */
|
||||
NS_IMETHODIMP nsSOAPEncoding::SetEncoder(const nsAString & aSchemaNamespaceURI, const nsAString & aSchemaType, nsISOAPEncoder *aEncoder)
|
||||
{
|
||||
NS_SOAP_ENSURE_ARG_STRING(aSchemaNamespaceURI);
|
||||
NS_SOAP_ENSURE_ARG_STRING(aSchemaType);
|
||||
NS_ENSURE_ARG(aEncoder);
|
||||
nsAutoString name(aSchemaNamespaceURI);
|
||||
name.Append(nsSOAPUtils::kEncodingSeparator);
|
||||
name.Append(aSchemaType);
|
||||
nsStringKey nameKey(name);
|
||||
if (aEncoder) {
|
||||
mEncoders->Put(&nameKey, aEncoder, nsnull);
|
||||
}
|
||||
else {
|
||||
mEncoders->Remove(&nameKey, nsnull);
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/* nsISOAPEncoder getEncoder (in AString aSchemaNamespaceURI, in AString aSchemaType); */
|
||||
NS_IMETHODIMP nsSOAPEncoding::GetEncoder(const nsAString & aSchemaNamespaceURI, const nsAString & aSchemaType, nsISOAPEncoder **_retval)
|
||||
{
|
||||
NS_SOAP_ENSURE_ARG_STRING(aSchemaNamespaceURI);
|
||||
NS_SOAP_ENSURE_ARG_STRING(aSchemaType);
|
||||
NS_ENSURE_ARG_POINTER(_retval);
|
||||
nsAutoString name(aSchemaNamespaceURI);
|
||||
name.Append(nsSOAPUtils::kEncodingSeparator);
|
||||
name.Append(aSchemaType);
|
||||
nsStringKey nameKey(name);
|
||||
*_retval = (nsISOAPEncoder*)mEncoders->Get(&nameKey);
|
||||
if (*_retval == nsnull && mDefaultEncoding != nsnull) {
|
||||
return mDefaultEncoding->GetEncoder(aSchemaNamespaceURI, aSchemaType, _retval);
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/* nsISOAPDecoder setDecoder (in AString aSchemaNamespaceURI, in AString aSchemaType, in nsISOAPDecoder aDecoder); */
|
||||
NS_IMETHODIMP nsSOAPEncoding::SetDecoder(const nsAString & aSchemaNamespaceURI, const nsAString & aSchemaType, nsISOAPDecoder *aDecoder)
|
||||
{
|
||||
NS_SOAP_ENSURE_ARG_STRING(aSchemaNamespaceURI);
|
||||
NS_SOAP_ENSURE_ARG_STRING(aSchemaType);
|
||||
nsAutoString name(aSchemaNamespaceURI);
|
||||
name.Append(nsSOAPUtils::kEncodingSeparator);
|
||||
name.Append(aSchemaType);
|
||||
nsStringKey nameKey(name);
|
||||
if (aDecoder) {
|
||||
mDecoders->Put(&nameKey, aDecoder, nsnull);
|
||||
}
|
||||
else {
|
||||
mDecoders->Remove(&nameKey, nsnull);
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/* nsISOAPDecoder getDecoder (in AString aSchemaNamespaceURI, in AString aSchemaType); */
|
||||
NS_IMETHODIMP nsSOAPEncoding::GetDecoder(const nsAString & aSchemaNamespaceURI, const nsAString & aSchemaType, nsISOAPDecoder **_retval)
|
||||
{
|
||||
NS_SOAP_ENSURE_ARG_STRING(aSchemaNamespaceURI);
|
||||
NS_SOAP_ENSURE_ARG_STRING(aSchemaType);
|
||||
NS_ENSURE_ARG_POINTER(_retval);
|
||||
nsAutoString name(aSchemaNamespaceURI);
|
||||
name.Append(nsSOAPUtils::kEncodingSeparator);
|
||||
name.Append(aSchemaType);
|
||||
nsStringKey nameKey(name);
|
||||
*_retval = (nsISOAPDecoder*)mDecoders->Get(&nameKey);
|
||||
if (*_retval == nsnull && mDefaultEncoding != nsnull) {
|
||||
return mDefaultEncoding->GetDecoder(aSchemaNamespaceURI, aSchemaType, _retval);
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/* nsIDOMElement encode (in nsIVariant aSource, in AString aNamespaceURI, in AString aName, in nsISchemaType aSchemaType, in nsISOAPAttachments aAttachments, in nsIDOMElement aDestination); */
|
||||
NS_IMETHODIMP nsSOAPEncoding::Encode(nsIVariant *aSource, const nsAString & aNamespaceURI, const nsAString & aName, nsISchemaType *aSchemaType, nsISOAPAttachments *aAttachments, nsIDOMElement *aDestination, nsIDOMElement **_retval)
|
||||
{
|
||||
NS_ENSURE_ARG(aSource);
|
||||
NS_ENSURE_ARG_POINTER(_retval);
|
||||
|
||||
nsCOMPtr<nsISOAPEncoder> encoder;
|
||||
nsresult rv = GetDefaultEncoder(getter_AddRefs(encoder));
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
if (encoder) {
|
||||
return encoder->Encode(this, aSource, aNamespaceURI, aName, aSchemaType, aAttachments, aDestination,
|
||||
_retval);
|
||||
}
|
||||
*_retval = nsnull;
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
/* nsIVariant decode (in nsIDOMElement aSource, in nsISchemaType aSchemaType, in nsISOAPAttachments aAttachments); */
|
||||
NS_IMETHODIMP nsSOAPEncoding::Decode(nsIDOMElement *aSource, nsISchemaType *aSchemaType, nsISOAPAttachments *aAttachments, nsIVariant **_retval)
|
||||
{
|
||||
NS_ENSURE_ARG(aSource);
|
||||
NS_ENSURE_ARG_POINTER(_retval);
|
||||
nsCOMPtr<nsISOAPDecoder> decoder;
|
||||
nsresult rv = GetDefaultDecoder(getter_AddRefs(decoder));
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
if (decoder) {
|
||||
return decoder->Decode(this, aSource, aSchemaType, aAttachments, _retval);
|
||||
}
|
||||
*_retval = nsnull;
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
/* attribute nsISOAPEncoder defaultEncoder; */
|
||||
NS_IMETHODIMP nsSOAPEncoding::GetDefaultEncoder(nsISOAPEncoder * *aDefaultEncoder)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aDefaultEncoder);
|
||||
if (mDefaultEncoding && !mDefaultEncoder) {
|
||||
return mDefaultEncoding->GetDefaultEncoder(aDefaultEncoder);
|
||||
}
|
||||
*aDefaultEncoder = mDefaultEncoder;
|
||||
NS_IF_ADDREF(*aDefaultEncoder);
|
||||
return NS_OK;
|
||||
}
|
||||
NS_IMETHODIMP nsSOAPEncoding::SetDefaultEncoder(nsISOAPEncoder * aDefaultEncoder)
|
||||
{
|
||||
mDefaultEncoder = aDefaultEncoder;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/* attribute nsISOAPDecoder defaultDecoder; */
|
||||
NS_IMETHODIMP nsSOAPEncoding::GetDefaultDecoder(nsISOAPDecoder * *aDefaultDecoder)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aDefaultDecoder);
|
||||
if (mDefaultEncoding && !mDefaultDecoder) {
|
||||
return mDefaultEncoding->GetDefaultDecoder(aDefaultDecoder);
|
||||
}
|
||||
*aDefaultDecoder = mDefaultDecoder;
|
||||
NS_IF_ADDREF(*aDefaultDecoder);
|
||||
return NS_OK;
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
NS_IMETHODIMP nsSOAPEncoding::SetDefaultDecoder(nsISOAPDecoder * aDefaultDecoder)
|
||||
{
|
||||
mDefaultDecoder = aDefaultDecoder;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
static const char* kAllAccess = "AllAccess";
|
||||
|
||||
/* string canCreateWrapper (in nsIIDPtr iid); */
|
||||
NS_IMETHODIMP
|
||||
nsSOAPEncoding::CanCreateWrapper(const nsIID * iid, char **_retval)
|
||||
{
|
||||
if (iid->Equals(NS_GET_IID(nsISOAPEncoding))) {
|
||||
*_retval = nsCRT::strdup(kAllAccess);
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/* string canCallMethod (in nsIIDPtr iid, in wstring methodName); */
|
||||
NS_IMETHODIMP
|
||||
nsSOAPEncoding::CanCallMethod(const nsIID * iid, const PRUnichar *methodName, char **_retval)
|
||||
{
|
||||
if (iid->Equals(NS_GET_IID(nsISOAPEncoding))) {
|
||||
*_retval = nsCRT::strdup(kAllAccess);
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/* string canGetProperty (in nsIIDPtr iid, in wstring propertyName); */
|
||||
NS_IMETHODIMP
|
||||
nsSOAPEncoding::CanGetProperty(const nsIID * iid, const PRUnichar *propertyName, char **_retval)
|
||||
{
|
||||
if (iid->Equals(NS_GET_IID(nsISOAPEncoding))) {
|
||||
*_retval = nsCRT::strdup(kAllAccess);
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/* string canSetProperty (in nsIIDPtr iid, in wstring propertyName); */
|
||||
NS_IMETHODIMP
|
||||
nsSOAPEncoding::CanSetProperty(const nsIID * iid, const PRUnichar *propertyName, char **_retval)
|
||||
{
|
||||
if (iid->Equals(NS_GET_IID(nsISOAPEncoding))) {
|
||||
*_retval = nsCRT::strdup(kAllAccess);
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
@@ -1,77 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
|
||||
#ifndef nsSOAPEncodingRegistry_h__
|
||||
#define nsSOAPEncodingRegistry_h__
|
||||
|
||||
#include "nsString.h"
|
||||
#include "nsISecurityCheckedComponent.h"
|
||||
#include "nsIDOMElement.h"
|
||||
#include "nsISOAPEncoding.h"
|
||||
#include "nsISOAPEncoder.h"
|
||||
#include "nsISOAPDecoder.h"
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsHashtable.h"
|
||||
#include "nsISchema.h"
|
||||
|
||||
class nsSOAPEncoding;
|
||||
|
||||
/* Header file */
|
||||
class nsSOAPEncodingRegistry : public nsISOAPEncoding
|
||||
{
|
||||
public:
|
||||
NS_DECL_ISUPPORTS
|
||||
NS_DECL_NSISOAPENCODING
|
||||
nsSOAPEncodingRegistry() {}
|
||||
nsSOAPEncodingRegistry(nsISOAPEncoding* aEncoding);
|
||||
virtual ~nsSOAPEncodingRegistry();
|
||||
protected:
|
||||
nsSupportsHashtable* mEncodings;
|
||||
nsCOMPtr<nsISchemaCollection> mSchemaCollection;
|
||||
};
|
||||
|
||||
class nsSOAPEncoding : public nsISOAPEncoding,
|
||||
public nsISecurityCheckedComponent
|
||||
{
|
||||
public:
|
||||
NS_DECL_ISUPPORTS
|
||||
|
||||
NS_DECL_NSISOAPENCODING
|
||||
|
||||
// nsISecurityCheckedComponent
|
||||
NS_DECL_NSISECURITYCHECKEDCOMPONENT
|
||||
|
||||
nsSOAPEncoding();
|
||||
nsSOAPEncoding(const nsAString& aStyleURI, nsSOAPEncodingRegistry * aRegistry, nsISOAPEncoding* aDefaultEncoding);
|
||||
virtual ~nsSOAPEncoding();
|
||||
/* additional members */
|
||||
|
||||
protected:
|
||||
nsString mStyleURI;
|
||||
nsSupportsHashtable* mEncoders;
|
||||
nsSupportsHashtable* mDecoders;
|
||||
nsCOMPtr<nsISOAPEncoding> mRegistry;
|
||||
nsCOMPtr<nsISOAPEncoding> mDefaultEncoding;
|
||||
nsCOMPtr<nsISOAPEncoder> mDefaultEncoder;
|
||||
nsCOMPtr<nsISOAPDecoder> mDefaultDecoder;
|
||||
};
|
||||
#endif
|
||||
@@ -1,154 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
|
||||
#include "nsSOAPFault.h"
|
||||
#include "nsSOAPUtils.h"
|
||||
#include "nsIDOMNodeList.h"
|
||||
|
||||
nsSOAPFault::nsSOAPFault(nsIDOMElement* aElement)
|
||||
{
|
||||
NS_INIT_ISUPPORTS();
|
||||
mFaultElement = aElement;
|
||||
}
|
||||
|
||||
nsSOAPFault::~nsSOAPFault()
|
||||
{
|
||||
}
|
||||
|
||||
NS_IMPL_ISUPPORTS2(nsSOAPFault, nsISOAPFault, nsISecurityCheckedComponent)
|
||||
|
||||
/* attribute nsIDOMElement element; */
|
||||
NS_IMETHODIMP nsSOAPFault::SetElement(nsIDOMElement *aElement)
|
||||
{
|
||||
mFaultElement = aElement;
|
||||
return NS_OK;
|
||||
}
|
||||
NS_IMETHODIMP nsSOAPFault::GetElement(nsIDOMElement * *aElement)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aElement);
|
||||
*aElement = mFaultElement;
|
||||
NS_IF_ADDREF(*aElement);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/* readonly attribute wstring faultCode; */
|
||||
NS_IMETHODIMP nsSOAPFault::GetFaultCode(nsAWritableString & aFaultCode)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(&aFaultCode);
|
||||
aFaultCode.Truncate();
|
||||
nsCOMPtr<nsIDOMElement> faultcode;
|
||||
nsSOAPUtils::GetSpecificChildElement(mFaultElement,
|
||||
nsSOAPUtils::kSOAPEnvURI,
|
||||
nsSOAPUtils::kFaultCodeTagName,
|
||||
getter_AddRefs(faultcode));
|
||||
if (faultcode) {
|
||||
nsSOAPUtils::GetElementTextContent(faultcode, aFaultCode);
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/* readonly attribute wstring faultString; */
|
||||
NS_IMETHODIMP nsSOAPFault::GetFaultString(nsAWritableString & aFaultString)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(&aFaultString);
|
||||
|
||||
aFaultString.Truncate();
|
||||
nsCOMPtr<nsIDOMElement> element;
|
||||
nsSOAPUtils::GetSpecificChildElement(mFaultElement, nsSOAPUtils::kSOAPEnvURI,
|
||||
nsSOAPUtils::kFaultStringTagName, getter_AddRefs(element));
|
||||
if (element) {
|
||||
nsSOAPUtils::GetElementTextContent(element, aFaultString);
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/* readonly attribute wstring faultActor; */
|
||||
NS_IMETHODIMP nsSOAPFault::GetFaultActor(nsAWritableString & aFaultActor)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(&aFaultActor);
|
||||
|
||||
aFaultActor.Truncate();
|
||||
nsCOMPtr<nsIDOMElement> element;
|
||||
nsSOAPUtils::GetSpecificChildElement(mFaultElement, nsSOAPUtils::kSOAPEnvURI,
|
||||
nsSOAPUtils::kFaultActorTagName, getter_AddRefs(element));
|
||||
if (element) {
|
||||
nsSOAPUtils::GetElementTextContent(element, aFaultActor);
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/* readonly attribute nsIDOMElement detail; */
|
||||
NS_IMETHODIMP nsSOAPFault::GetDetail(nsIDOMElement * *aDetail)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aDetail);
|
||||
|
||||
nsCOMPtr<nsIDOMElement> element;
|
||||
nsSOAPUtils::GetSpecificChildElement(mFaultElement, nsSOAPUtils::kSOAPEnvURI,
|
||||
nsSOAPUtils::kFaultDetailTagName, aDetail);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
static const char* kAllAccess = "AllAccess";
|
||||
|
||||
/* string canCreateWrapper (in nsIIDPtr iid); */
|
||||
NS_IMETHODIMP
|
||||
nsSOAPFault::CanCreateWrapper(const nsIID * iid, char **_retval)
|
||||
{
|
||||
if (iid->Equals(NS_GET_IID(nsISOAPFault))) {
|
||||
*_retval = nsCRT::strdup(kAllAccess);
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/* string canCallMethod (in nsIIDPtr iid, in wstring methodName); */
|
||||
NS_IMETHODIMP
|
||||
nsSOAPFault::CanCallMethod(const nsIID * iid, const PRUnichar *methodName, char **_retval)
|
||||
{
|
||||
if (iid->Equals(NS_GET_IID(nsISOAPFault))) {
|
||||
*_retval = nsCRT::strdup(kAllAccess);
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/* string canGetProperty (in nsIIDPtr iid, in wstring propertyName); */
|
||||
NS_IMETHODIMP
|
||||
nsSOAPFault::CanGetProperty(const nsIID * iid, const PRUnichar *propertyName, char **_retval)
|
||||
{
|
||||
if (iid->Equals(NS_GET_IID(nsISOAPFault))) {
|
||||
*_retval = nsCRT::strdup(kAllAccess);
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/* string canSetProperty (in nsIIDPtr iid, in wstring propertyName); */
|
||||
NS_IMETHODIMP
|
||||
nsSOAPFault::CanSetProperty(const nsIID * iid, const PRUnichar *propertyName, char **_retval)
|
||||
{
|
||||
if (iid->Equals(NS_GET_IID(nsISOAPFault))) {
|
||||
*_retval = nsCRT::strdup(kAllAccess);
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
@@ -1,51 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
|
||||
#ifndef nsSOAPFault_h__
|
||||
#define nsSOAPFault_h__
|
||||
|
||||
#include "nsString.h"
|
||||
#include "nsISOAPFault.h"
|
||||
#include "nsISecurityCheckedComponent.h"
|
||||
#include "nsIDOMElement.h"
|
||||
#include "nsCOMPtr.h"
|
||||
|
||||
class nsSOAPFault : public nsISOAPFault,
|
||||
public nsISecurityCheckedComponent
|
||||
{
|
||||
public:
|
||||
nsSOAPFault(nsIDOMElement* aElement);
|
||||
virtual ~nsSOAPFault();
|
||||
|
||||
NS_DECL_ISUPPORTS
|
||||
|
||||
// nsISOAPFault
|
||||
NS_DECL_NSISOAPFAULT
|
||||
|
||||
// nsISecurityCheckedComponent
|
||||
NS_DECL_NSISECURITYCHECKEDCOMPONENT
|
||||
|
||||
protected:
|
||||
nsCOMPtr<nsIDOMElement> mFaultElement;
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -1,297 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
|
||||
#include "nsString.h"
|
||||
#include "nsReadableUtils.h"
|
||||
#include "nsSOAPHeaderBlock.h"
|
||||
#include "nsSOAPUtils.h"
|
||||
#include "nsIServiceManager.h"
|
||||
#include "nsISOAPAttachments.h"
|
||||
|
||||
nsSOAPHeaderBlock::nsSOAPHeaderBlock()
|
||||
{
|
||||
NS_INIT_ISUPPORTS();
|
||||
}
|
||||
|
||||
nsSOAPHeaderBlock::~nsSOAPHeaderBlock()
|
||||
{
|
||||
}
|
||||
|
||||
NS_IMPL_ISUPPORTS3_CI(nsSOAPHeaderBlock,
|
||||
nsISOAPHeaderBlock,
|
||||
nsISecurityCheckedComponent,
|
||||
nsIJSNativeInitializer)
|
||||
|
||||
/* attribute AString namespaceURI; */
|
||||
NS_IMETHODIMP nsSOAPHeaderBlock::GetNamespaceURI(nsAWritableString & aNamespaceURI)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(&aNamespaceURI);
|
||||
if (mElement) {
|
||||
return mElement->GetNamespaceURI(aNamespaceURI);
|
||||
}
|
||||
else {
|
||||
aNamespaceURI.Assign(mNamespaceURI);
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
NS_IMETHODIMP nsSOAPHeaderBlock::SetNamespaceURI(const nsAReadableString & aNamespaceURI)
|
||||
{
|
||||
if (mElement) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
mNamespaceURI.Assign(aNamespaceURI);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/* attribute AString name; */
|
||||
NS_IMETHODIMP nsSOAPHeaderBlock::GetName(nsAWritableString & aName)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(&aName);
|
||||
if (mElement) {
|
||||
return mElement->GetLocalName(aName);
|
||||
}
|
||||
else {
|
||||
aName.Assign(mName);
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
NS_IMETHODIMP nsSOAPHeaderBlock::SetName(const nsAReadableString & aName)
|
||||
{
|
||||
if (mElement) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
mName.Assign(aName);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/* attribute AString actorURI; */
|
||||
NS_IMETHODIMP nsSOAPHeaderBlock::GetActorURI(nsAWritableString & aActorURI)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(&aActorURI);
|
||||
if (mElement) {
|
||||
return mElement->GetAttributeNS(nsSOAPUtils::kSOAPEnvURI,nsSOAPUtils::kActorAttribute,aActorURI);
|
||||
}
|
||||
else {
|
||||
aActorURI.Assign(mActorURI);
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
NS_IMETHODIMP nsSOAPHeaderBlock::SetActorURI(const nsAReadableString & aActorURI)
|
||||
{
|
||||
if (mElement) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
mActorURI.Assign(aActorURI);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/* attribute nsISOAPEncoding encoding; */
|
||||
NS_IMETHODIMP nsSOAPHeaderBlock::GetEncoding(nsISOAPEncoding* * aEncoding)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aEncoding);
|
||||
*aEncoding = mEncoding;
|
||||
NS_IF_ADDREF(*aEncoding);
|
||||
return NS_OK;
|
||||
}
|
||||
NS_IMETHODIMP nsSOAPHeaderBlock::SetEncoding(nsISOAPEncoding* aEncoding)
|
||||
{
|
||||
mEncoding = aEncoding;
|
||||
if (mElement) {
|
||||
mComputeValue = PR_TRUE;
|
||||
mValue = nsnull;
|
||||
mStatus = NS_OK;
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/* attribute nsISchemaType schemaType; */
|
||||
NS_IMETHODIMP nsSOAPHeaderBlock::GetSchemaType(nsISchemaType* * aSchemaType)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aSchemaType);
|
||||
*aSchemaType = mSchemaType;
|
||||
NS_IF_ADDREF(*aSchemaType);
|
||||
return NS_OK;
|
||||
}
|
||||
NS_IMETHODIMP nsSOAPHeaderBlock::SetSchemaType(nsISchemaType* aSchemaType)
|
||||
{
|
||||
mSchemaType = aSchemaType;
|
||||
if (mElement) {
|
||||
mComputeValue = PR_TRUE;
|
||||
mValue = nsnull;
|
||||
mStatus = NS_OK;
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/* attribute nsISOAPAttachments attachments; */
|
||||
NS_IMETHODIMP nsSOAPHeaderBlock::GetAttachments(nsISOAPAttachments* * aAttachments)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aAttachments);
|
||||
*aAttachments = mAttachments;
|
||||
NS_IF_ADDREF(*aAttachments);
|
||||
return NS_OK;
|
||||
}
|
||||
NS_IMETHODIMP nsSOAPHeaderBlock::SetAttachments(nsISOAPAttachments* aAttachments)
|
||||
{
|
||||
mAttachments = aAttachments;
|
||||
if (mElement) {
|
||||
mComputeValue = PR_TRUE;
|
||||
mValue = nsnull;
|
||||
mStatus = NS_OK;
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/* attribute nsIDOMElement element; */
|
||||
NS_IMETHODIMP nsSOAPHeaderBlock::GetElement(nsIDOMElement* * aElement)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aElement);
|
||||
*aElement = mElement;
|
||||
NS_IF_ADDREF(*aElement);
|
||||
return NS_OK;
|
||||
}
|
||||
NS_IMETHODIMP nsSOAPHeaderBlock::SetElement(nsIDOMElement* aElement)
|
||||
{
|
||||
mElement = aElement;
|
||||
mNamespaceURI.SetLength(0);
|
||||
mName.SetLength(0);
|
||||
mActorURI.SetLength(0);
|
||||
mComputeValue = PR_TRUE;
|
||||
mValue = nsnull;
|
||||
mStatus = NS_OK;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/* attribute nsIVariant value; */
|
||||
NS_IMETHODIMP nsSOAPHeaderBlock::GetValue(nsIVariant* * aValue)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aValue);
|
||||
if (mElement // Check for auto-computation
|
||||
&& mComputeValue
|
||||
&& mEncoding)
|
||||
{
|
||||
mComputeValue = PR_FALSE;
|
||||
mStatus = mEncoding->Decode(mElement, mSchemaType, mAttachments, getter_AddRefs(mValue));
|
||||
}
|
||||
*aValue = mValue;
|
||||
NS_IF_ADDREF(*aValue);
|
||||
return mElement ? mStatus : NS_OK;
|
||||
}
|
||||
NS_IMETHODIMP nsSOAPHeaderBlock::SetValue(nsIVariant* aValue)
|
||||
{
|
||||
mValue = aValue;
|
||||
mComputeValue = PR_FALSE;
|
||||
mElement = nsnull;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsSOAPHeaderBlock::Initialize(JSContext *cx, JSObject *obj,
|
||||
PRUint32 argc, jsval *argv)
|
||||
{
|
||||
|
||||
// Get the arguments.
|
||||
|
||||
nsCOMPtr<nsIVariant> value;
|
||||
nsAutoString name;
|
||||
nsAutoString namespaceURI;
|
||||
nsAutoString actorURI;
|
||||
nsCOMPtr<nsISupports> schemaType;
|
||||
nsCOMPtr<nsISupports> encoding;
|
||||
|
||||
if (!JS_ConvertArguments(cx, argc, argv, "/%iv %is %is %is %ip %ip",
|
||||
getter_AddRefs(value),
|
||||
NS_STATIC_CAST(nsAString*, &name),
|
||||
NS_STATIC_CAST(nsAString*, &namespaceURI),
|
||||
NS_STATIC_CAST(nsAString*, &actorURI),
|
||||
getter_AddRefs(schemaType),
|
||||
getter_AddRefs(encoding))) return NS_ERROR_ILLEGAL_VALUE;
|
||||
|
||||
nsresult rc = SetValue(value);
|
||||
if (NS_FAILED(rc)) return rc;
|
||||
rc = SetName(name);
|
||||
if (NS_FAILED(rc)) return rc;
|
||||
rc = SetNamespaceURI(namespaceURI);
|
||||
if (NS_FAILED(rc)) return rc;
|
||||
rc = SetActorURI(actorURI);
|
||||
if (NS_FAILED(rc)) return rc;
|
||||
if (schemaType) {
|
||||
nsCOMPtr<nsISchemaType> v = do_QueryInterface(schemaType, &rc);
|
||||
if (NS_FAILED(rc)) return rc;
|
||||
rc = SetSchemaType(v);
|
||||
if (NS_FAILED(rc)) return rc;
|
||||
}
|
||||
if (encoding) {
|
||||
nsCOMPtr<nsISOAPEncoding> v = do_QueryInterface(encoding, &rc);
|
||||
if (NS_FAILED(rc)) return rc;
|
||||
rc = SetEncoding(v);
|
||||
if (NS_FAILED(rc)) return rc;
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
static const char* kAllAccess = "AllAccess";
|
||||
|
||||
/* string canCreateWrapper (in nsIIDPtr iid); */
|
||||
NS_IMETHODIMP
|
||||
nsSOAPHeaderBlock::CanCreateWrapper(const nsIID * iid, char **_retval)
|
||||
{
|
||||
if (iid->Equals(NS_GET_IID(nsISOAPHeaderBlock))) {
|
||||
*_retval = nsCRT::strdup(kAllAccess);
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/* string canCallMethod (in nsIIDPtr iid, in wstring methodName); */
|
||||
NS_IMETHODIMP
|
||||
nsSOAPHeaderBlock::CanCallMethod(const nsIID * iid, const PRUnichar *methodName, char **_retval)
|
||||
{
|
||||
if (iid->Equals(NS_GET_IID(nsISOAPHeaderBlock))) {
|
||||
*_retval = nsCRT::strdup(kAllAccess);
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/* string canGetProperty (in nsIIDPtr iid, in wstring propertyName); */
|
||||
NS_IMETHODIMP
|
||||
nsSOAPHeaderBlock::CanGetProperty(const nsIID * iid, const PRUnichar *propertyName, char **_retval)
|
||||
{
|
||||
if (iid->Equals(NS_GET_IID(nsISOAPHeaderBlock))) {
|
||||
*_retval = nsCRT::strdup(kAllAccess);
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/* string canSetProperty (in nsIIDPtr iid, in wstring propertyName); */
|
||||
NS_IMETHODIMP
|
||||
nsSOAPHeaderBlock::CanSetProperty(const nsIID * iid, const PRUnichar *propertyName, char **_retval)
|
||||
{
|
||||
if (iid->Equals(NS_GET_IID(nsISOAPHeaderBlock))) {
|
||||
*_retval = nsCRT::strdup(kAllAccess);
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
@@ -1,70 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
|
||||
#ifndef nsSOAPHeaderBlock_h__
|
||||
#define nsSOAPHeaderBlock_h__
|
||||
|
||||
#include "nsString.h"
|
||||
#include "nsIVariant.h"
|
||||
#include "nsISOAPHeaderBlock.h"
|
||||
#include "nsISecurityCheckedComponent.h"
|
||||
#include "nsIJSNativeInitializer.h"
|
||||
#include "nsISOAPEncoding.h"
|
||||
#include "nsISchema.h"
|
||||
#include "nsIDOMElement.h"
|
||||
#include "nsISOAPAttachments.h"
|
||||
#include "nsCOMPtr.h"
|
||||
|
||||
class nsSOAPHeaderBlock : public nsISOAPHeaderBlock,
|
||||
public nsISecurityCheckedComponent,
|
||||
public nsIJSNativeInitializer
|
||||
{
|
||||
public:
|
||||
nsSOAPHeaderBlock();
|
||||
virtual ~nsSOAPHeaderBlock();
|
||||
|
||||
NS_DECL_ISUPPORTS
|
||||
|
||||
// nsISOAPHeaderBlock
|
||||
NS_DECL_NSISOAPHEADERBLOCK
|
||||
|
||||
// nsISecurityCheckedComponent
|
||||
NS_DECL_NSISECURITYCHECKEDCOMPONENT
|
||||
|
||||
// nsIJSNativeInitializer
|
||||
NS_IMETHOD Initialize(JSContext *cx, JSObject *obj,
|
||||
PRUint32 argc, jsval *argv);
|
||||
|
||||
protected:
|
||||
nsString mNamespaceURI;
|
||||
nsString mName;
|
||||
nsString mActorURI;
|
||||
nsCOMPtr<nsISOAPEncoding> mEncoding;
|
||||
nsCOMPtr<nsISchemaType> mSchemaType;
|
||||
nsCOMPtr<nsISOAPAttachments> mAttachments;
|
||||
nsCOMPtr<nsIDOMElement> mElement;
|
||||
nsCOMPtr<nsIVariant> mValue;
|
||||
nsresult mStatus;
|
||||
PRBool mComputeValue;
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -1,475 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
|
||||
#include "nsIServiceManager.h"
|
||||
#include "nsMemory.h"
|
||||
#include "nsIComponentManager.h"
|
||||
#include "nsSOAPUtils.h"
|
||||
#include "nsSOAPMessage.h"
|
||||
#include "nsSOAPParameter.h"
|
||||
#include "nsSOAPHeaderBlock.h"
|
||||
#include "nsSOAPEncoding.h"
|
||||
#include "nsIDOMDocument.h"
|
||||
#include "nsIDOMParser.h"
|
||||
#include "nsIDOMElement.h"
|
||||
#include "nsIDOMNamedNodeMap.h"
|
||||
|
||||
static NS_DEFINE_CID(kDOMParserCID, NS_DOMPARSER_CID);
|
||||
/////////////////////////////////////////////
|
||||
//
|
||||
//
|
||||
/////////////////////////////////////////////
|
||||
|
||||
nsSOAPMessage::nsSOAPMessage()
|
||||
{
|
||||
NS_INIT_ISUPPORTS();
|
||||
}
|
||||
|
||||
nsSOAPMessage::~nsSOAPMessage()
|
||||
{
|
||||
}
|
||||
|
||||
NS_IMPL_ISUPPORTS2(nsSOAPMessage,
|
||||
nsISOAPMessage,
|
||||
nsISecurityCheckedComponent)
|
||||
|
||||
/* attribute nsIDOMDocument message; */
|
||||
NS_IMETHODIMP nsSOAPMessage::GetMessage(nsIDOMDocument * *aMessage)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aMessage);
|
||||
*aMessage = mMessage;
|
||||
NS_IF_ADDREF(*aMessage);
|
||||
return NS_OK;
|
||||
}
|
||||
NS_IMETHODIMP nsSOAPMessage::SetMessage(nsIDOMDocument * aMessage)
|
||||
{
|
||||
mMessage = aMessage;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/* readonly attribute nsIDOMElement envelope; */
|
||||
NS_IMETHODIMP nsSOAPMessage::GetEnvelope(nsIDOMElement * *aEnvelope)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aEnvelope);
|
||||
|
||||
if (mMessage) {
|
||||
nsCOMPtr<nsIDOMElement> root;
|
||||
mMessage->GetDocumentElement(getter_AddRefs(root));
|
||||
if (root) {
|
||||
nsAutoString name, namespaceURI;
|
||||
root->GetLocalName(name);
|
||||
root->GetNamespaceURI(namespaceURI);
|
||||
if (name.Equals(nsSOAPUtils::kEnvelopeTagName)
|
||||
&& namespaceURI.Equals(nsSOAPUtils::kSOAPEnvURI))
|
||||
{
|
||||
*aEnvelope = root;
|
||||
NS_ADDREF(*aEnvelope);
|
||||
return NS_OK;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
*aEnvelope = nsnull;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/* readonly attribute nsIDOMElement header; */
|
||||
NS_IMETHODIMP nsSOAPMessage::GetHeader(nsIDOMElement * *aHeader)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aHeader);
|
||||
nsCOMPtr<nsIDOMElement> env;
|
||||
GetEnvelope(getter_AddRefs(env));
|
||||
if (env) {
|
||||
nsSOAPUtils::GetSpecificChildElement(env,
|
||||
nsSOAPUtils::kSOAPEnvURI, nsSOAPUtils::kHeaderTagName,
|
||||
aHeader);
|
||||
}
|
||||
else {
|
||||
*aHeader = nsnull;
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/* readonly attribute nsIDOMElement body; */
|
||||
NS_IMETHODIMP nsSOAPMessage::GetBody(nsIDOMElement * *aBody)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aBody);
|
||||
nsCOMPtr<nsIDOMElement> env;
|
||||
GetEnvelope(getter_AddRefs(env));
|
||||
if (env) {
|
||||
nsSOAPUtils::GetSpecificChildElement(env,
|
||||
nsSOAPUtils::kSOAPEnvURI, nsSOAPUtils::kBodyTagName,
|
||||
aBody);
|
||||
}
|
||||
else {
|
||||
*aBody = nsnull;
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/* attribute DOMString actionURI; */
|
||||
NS_IMETHODIMP nsSOAPMessage::GetActionURI(nsAWritableString & aActionURI)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(&aActionURI);
|
||||
aActionURI.Assign(mActionURI);
|
||||
return NS_OK;
|
||||
}
|
||||
NS_IMETHODIMP nsSOAPMessage::SetActionURI(const nsAReadableString & aActionURI)
|
||||
{
|
||||
mActionURI.Assign(aActionURI);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/* readonly attribute AString methodName; */
|
||||
NS_IMETHODIMP nsSOAPMessage::GetMethodName(nsAString & aMethodName)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(&aMethodName);
|
||||
nsCOMPtr<nsIDOMElement> body;
|
||||
GetBody(getter_AddRefs(body));
|
||||
if (body) {
|
||||
nsCOMPtr<nsIDOMElement> method;
|
||||
nsSOAPUtils::GetFirstChildElement(body, getter_AddRefs(method));
|
||||
if (method) {
|
||||
body->GetLocalName(aMethodName);
|
||||
return NS_OK;
|
||||
}
|
||||
}
|
||||
aMethodName.SetLength(0);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/* readonly attribute AString targetObjectURI; */
|
||||
NS_IMETHODIMP nsSOAPMessage::GetTargetObjectURI(nsAString & aTargetObjectURI)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(&aTargetObjectURI);
|
||||
nsCOMPtr<nsIDOMElement> body;
|
||||
GetBody(getter_AddRefs(body));
|
||||
if (body) {
|
||||
nsCOMPtr<nsIDOMElement> method;
|
||||
nsSOAPUtils::GetFirstChildElement(body, getter_AddRefs(method));
|
||||
if (method) {
|
||||
body->GetNamespaceURI(aTargetObjectURI);
|
||||
return NS_OK;
|
||||
}
|
||||
}
|
||||
aTargetObjectURI.SetLength(0);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_NAMED_LITERAL_STRING(kEmptySOAPDocStr, "<SOAP-ENV:Envelope xmlns:SOAP-ENV=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:SOAP-ENC=\"http://schemas.xmlsoap.org/soap/encoding/\" xmlns:xsi=\"http://www.w3.org/1999/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/1999/XMLSchema\"><SOAP-ENV:Header></SOAP-ENV:Header><SOAP-ENV:Body></SOAP-ENV:Body></SOAP-ENV:Envelope>");
|
||||
|
||||
/* void encode (in AString aMethodName, in AString aTargetObjectURI, in PRUint32 aHeaderBlockCount, [array, size_is (aHeaderBlockCount)] in nsISOAPHeaderBlock aHeaderBlocks, in PRUint32 aParameterCount, [array, size_is (aParameterCount)] in nsISOAPParameter aParameters); */
|
||||
NS_IMETHODIMP nsSOAPMessage::Encode(const nsAString & aMethodName, const nsAString & aTargetObjectURI, PRUint32 aHeaderBlockCount, nsISOAPHeaderBlock **aHeaderBlocks, PRUint32 aParameterCount, nsISOAPParameter **aParameters)
|
||||
{
|
||||
|
||||
// Construct the message skeleton
|
||||
|
||||
nsresult rv;
|
||||
nsCOMPtr<nsIDOMNode> ignored;
|
||||
nsCOMPtr<nsIDOMParser> parser = do_CreateInstance(kDOMParserCID, &rv);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
nsAutoString docstr;
|
||||
rv = parser->ParseFromString(kEmptySOAPDocStr.get(), "text/xml",
|
||||
getter_AddRefs(mMessage));
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
// Declare the default encoding if one exists
|
||||
|
||||
if (mEncoding) {
|
||||
nsCOMPtr<nsIDOMElement> envelope;
|
||||
rv = GetEnvelope(getter_AddRefs(envelope));
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
if (envelope) {
|
||||
nsAutoString enc;
|
||||
mEncoding->GetStyleURI(enc);
|
||||
envelope->SetAttributeNS(nsSOAPUtils::kSOAPEncodingURI, nsSOAPUtils::kEncodingStyleAttribute, enc);
|
||||
}
|
||||
}
|
||||
|
||||
// Encode and add headers, if any were specified
|
||||
|
||||
if (aHeaderBlockCount) {
|
||||
nsCOMPtr<nsIDOMElement> parent;
|
||||
rv = GetHeader(getter_AddRefs(parent));
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
nsCOMPtr<nsISupports> next;
|
||||
nsCOMPtr<nsISOAPHeaderBlock> header;
|
||||
nsCOMPtr<nsIDOMElement> element;
|
||||
nsCOMPtr<nsISOAPEncoding> encoding;
|
||||
nsCOMPtr<nsISchemaType> schemaType;
|
||||
nsCOMPtr<nsIVariant> value;
|
||||
nsAutoString name;
|
||||
nsAutoString namespaceURI;
|
||||
nsAutoString actorURI;
|
||||
for (PRUint32 i = 0; i < aHeaderBlockCount; i++) {
|
||||
header = aHeaderBlocks[i];
|
||||
if (!header) return NS_ERROR_FAILURE;
|
||||
rv = header->GetElement(getter_AddRefs(element));
|
||||
if (element) {
|
||||
nsCOMPtr<nsIDOMNode> node1 = (nsIDOMElement*)element;
|
||||
nsCOMPtr<nsIDOMNode> node2;
|
||||
rv = mMessage->ImportNode(node1, PR_TRUE, getter_AddRefs(node1));
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
rv = parent->AppendChild(node2, getter_AddRefs(node1));
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
element = do_QueryInterface(node1);
|
||||
}
|
||||
else {
|
||||
rv = header->GetNamespaceURI(namespaceURI);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
rv = header->GetName(name);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
rv = header->GetActorURI(actorURI);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
rv = header->GetEncoding(getter_AddRefs(encoding));
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
if (!encoding) {
|
||||
encoding = mEncoding;
|
||||
}
|
||||
rv = header->GetSchemaType(getter_AddRefs(schemaType));
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
rv = header->GetValue(getter_AddRefs(value));
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
rv = encoding->Encode(value, namespaceURI, name,
|
||||
schemaType, nsnull, parent, getter_AddRefs(element));
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
if (!actorURI.IsEmpty()) {
|
||||
element->SetAttributeNS(nsSOAPUtils::kSOAPEnvPrefix, nsSOAPUtils::kActorAttribute, actorURI);
|
||||
}
|
||||
if (mEncoding != encoding) {
|
||||
nsAutoString enc;
|
||||
encoding->GetStyleURI(enc);
|
||||
element->SetAttributeNS(nsSOAPUtils::kSOAPEncodingURI, nsSOAPUtils::kEncodingStyleAttribute, enc);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
nsCOMPtr<nsIDOMElement> body;
|
||||
rv = GetBody(getter_AddRefs(body));
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
// Only produce a call element if mMethodName was non-empty
|
||||
|
||||
if (!aMethodName.IsEmpty()) {
|
||||
nsCOMPtr<nsIDOMElement> call;
|
||||
rv = mMessage->CreateElementNS(aTargetObjectURI, aMethodName, getter_AddRefs(call));
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
nsCOMPtr<nsIDOMNode> ignored;
|
||||
rv = body->AppendChild(call, getter_AddRefs(ignored));
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
body = call;
|
||||
nsAutoString prefix;
|
||||
rv = nsSOAPUtils::MakeNamespacePrefixFixed(body, aTargetObjectURI, prefix);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
if (!prefix.IsEmpty()) {
|
||||
rv = body->SetPrefix(prefix);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
}
|
||||
}
|
||||
|
||||
// Encode and add all of the parameters into the body
|
||||
|
||||
nsCOMPtr<nsISupports> next;
|
||||
nsCOMPtr<nsISOAPParameter> param;
|
||||
nsCOMPtr<nsIDOMElement> element;
|
||||
nsCOMPtr<nsISOAPEncoding> encoding;
|
||||
nsCOMPtr<nsISchemaType> schemaType;
|
||||
nsCOMPtr<nsIVariant> value;
|
||||
nsAutoString name;
|
||||
nsAutoString namespaceURI;
|
||||
for (PRUint32 i = 0; i < aParameterCount; i++) {
|
||||
param = aParameters[i];
|
||||
if (!param) return NS_ERROR_FAILURE;
|
||||
rv = param->GetElement(getter_AddRefs(element));
|
||||
if (element) {
|
||||
nsCOMPtr<nsIDOMNode> node1 = (nsIDOMElement*)element;
|
||||
nsCOMPtr<nsIDOMNode> node2;
|
||||
rv = mMessage->ImportNode(node1, PR_TRUE, getter_AddRefs(node1));
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
rv = body->AppendChild(node2, getter_AddRefs(node1));
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
element = do_QueryInterface(node1);
|
||||
}
|
||||
else {
|
||||
rv = param->GetNamespaceURI(namespaceURI);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
rv = param->GetName(name);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
rv = param->GetEncoding(getter_AddRefs(encoding));
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
if (!encoding) {
|
||||
encoding = mEncoding;
|
||||
}
|
||||
rv = param->GetSchemaType(getter_AddRefs(schemaType));
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
rv = param->GetValue(getter_AddRefs(value));
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
rv = encoding->Encode(value, namespaceURI, name,
|
||||
schemaType, nsnull, body, getter_AddRefs(element));
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
if (mEncoding != encoding) {
|
||||
nsAutoString enc;
|
||||
encoding->GetStyleURI(enc);
|
||||
element->SetAttributeNS(nsSOAPUtils::kSOAPEncodingURI, nsSOAPUtils::kEncodingStyleAttribute, enc);
|
||||
}
|
||||
}
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
static NS_DEFINE_CID(kMemoryCID, NS_MEMORY_CID);
|
||||
|
||||
/* void getHeaderBlocks (out PRUint32 aCount, [array, size_is (aCount), retval] out nsISOAPHeaderBlock aHeaderBlocks); */
|
||||
NS_IMETHODIMP nsSOAPMessage::GetHeaderBlocks(PRUint32 *aCount, nsISOAPHeaderBlock ***aHeaderBlocks)
|
||||
{
|
||||
nsCOMPtr<nsIMemory> memory = do_GetService(kMemoryCID);
|
||||
*aCount = 0;
|
||||
*aHeaderBlocks = nsnull;
|
||||
int count = 0;
|
||||
int length = 0;
|
||||
nsCOMPtr<nsIDOMElement> element;
|
||||
nsresult rv = GetHeader(getter_AddRefs(element));
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
nsCOMPtr<nsIDOMElement> next;
|
||||
nsCOMPtr<nsISOAPHeaderBlock> header;
|
||||
nsSOAPUtils::GetFirstChildElement(element, getter_AddRefs(next));
|
||||
while (next) {
|
||||
if (length == count) {
|
||||
length = length ? 2 * length : 10;
|
||||
*aHeaderBlocks = (nsISOAPHeaderBlock* *)memory->Realloc(*aHeaderBlocks, length * sizeof(**aHeaderBlocks));
|
||||
}
|
||||
element = next;
|
||||
header = new nsSOAPHeaderBlock();
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
// XXX can't addref a COMPTr
|
||||
//NS_ADDREF(header);
|
||||
(*aHeaderBlocks)[(*aCount)++] = header;
|
||||
rv = header->SetElement(element);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
nsSOAPUtils::GetNextSiblingElement(element, getter_AddRefs(next));
|
||||
}
|
||||
if (*aCount) {
|
||||
*aHeaderBlocks = (nsISOAPHeaderBlock* *)memory->Realloc(*aHeaderBlocks, (*aCount) * sizeof(**aHeaderBlocks));
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/* void getParameters (in boolean aDocumentStyle, out PRUint32 aCount, [array, size_is (aCount), retval] out nsISOAPParameter aParameters); */
|
||||
NS_IMETHODIMP nsSOAPMessage::GetParameters(PRBool aDocumentStyle, PRUint32 *aCount, nsISOAPParameter ***aParameters)
|
||||
{
|
||||
nsCOMPtr<nsIMemory> memory = do_GetService(kMemoryCID);
|
||||
*aCount = 0;
|
||||
*aParameters = nsnull;
|
||||
int count = 0;
|
||||
int length = 0;
|
||||
nsCOMPtr<nsIDOMElement> element;
|
||||
nsresult rv = GetHeader(getter_AddRefs(element));
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
nsCOMPtr<nsIDOMElement> next;
|
||||
nsCOMPtr<nsISOAPParameter> param;
|
||||
nsSOAPUtils::GetFirstChildElement(element, getter_AddRefs(next));
|
||||
while (next) {
|
||||
if (length == count) {
|
||||
length = length ? 2 * length : 10;
|
||||
*aParameters = (nsISOAPParameter* *)memory->Realloc(*aParameters, length * sizeof(**aParameters));
|
||||
}
|
||||
element = next;
|
||||
param = new nsSOAPParameter();
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
// XXX can't addref a COMPTr
|
||||
//NS_ADDREF(param);
|
||||
(*aParameters)[(*aCount)++] = param;
|
||||
rv = param->SetElement(element);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
nsSOAPUtils::GetNextSiblingElement(element, getter_AddRefs(next));
|
||||
}
|
||||
if (*aCount) {
|
||||
*aParameters = (nsISOAPParameter* *)memory->Realloc(*aParameters, (*aCount) * sizeof(**aParameters));
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/* attribute nsISOAPEncoding encoding; */
|
||||
NS_IMETHODIMP nsSOAPMessage::GetEncoding(nsISOAPEncoding* * aEncoding)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aEncoding);
|
||||
if (!mEncoding) {
|
||||
mEncoding = new nsSOAPEncoding();
|
||||
if (!mEncoding)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
*aEncoding = mEncoding;
|
||||
NS_IF_ADDREF(*aEncoding);
|
||||
return NS_OK;
|
||||
}
|
||||
NS_IMETHODIMP nsSOAPMessage::SetEncoding(nsISOAPEncoding* aEncoding)
|
||||
{
|
||||
mEncoding = aEncoding;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
static const char*kAllAccess = "AllAccess";
|
||||
|
||||
/* string canCreateWrapper (in nsIIDPtr iid); */
|
||||
NS_IMETHODIMP
|
||||
nsSOAPMessage::CanCreateWrapper(const nsIID * iid, char**_retval)
|
||||
{
|
||||
if (iid->Equals(NS_GET_IID(nsISOAPMessage))) {
|
||||
*_retval = nsCRT::strdup(kAllAccess);
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/* string canCallMethod (in nsIIDPtr iid, in wstring methodName); */
|
||||
NS_IMETHODIMP
|
||||
nsSOAPMessage::CanCallMethod(const nsIID * iid, const PRUnichar*methodName, char**_retval)
|
||||
{
|
||||
if (iid->Equals(NS_GET_IID(nsISOAPMessage))) {
|
||||
*_retval = nsCRT::strdup(kAllAccess);
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/* string canGetProperty (in nsIIDPtr iid, in wstring propertyName); */
|
||||
NS_IMETHODIMP
|
||||
nsSOAPMessage::CanGetProperty(const nsIID * iid, const PRUnichar*propertyName, char**_retval)
|
||||
{
|
||||
if (iid->Equals(NS_GET_IID(nsISOAPMessage))) {
|
||||
*_retval = nsCRT::strdup(kAllAccess);
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/* string canSetProperty (in nsIIDPtr iid, in wstring propertyName); */
|
||||
NS_IMETHODIMP
|
||||
nsSOAPMessage::CanSetProperty(const nsIID * iid, const PRUnichar*propertyName, char**_retval)
|
||||
{
|
||||
if (iid->Equals(NS_GET_IID(nsISOAPMessage))) {
|
||||
*_retval = nsCRT::strdup(kAllAccess);
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
@@ -1,58 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
|
||||
#ifndef nsSOAPMessage_h__
|
||||
#define nsSOAPMessage_h__
|
||||
|
||||
#include "nsString.h"
|
||||
#include "nsISOAPEncoding.h"
|
||||
#include "nsISOAPMessage.h"
|
||||
#include "nsISecurityCheckedComponent.h"
|
||||
#include "nsIDOMElement.h"
|
||||
#include "nsIDOMDocument.h"
|
||||
#include "nsISupportsArray.h"
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsIVariant.h"
|
||||
|
||||
class nsSOAPMessage : public nsISOAPMessage,
|
||||
public nsISecurityCheckedComponent
|
||||
{
|
||||
public:
|
||||
nsSOAPMessage();
|
||||
virtual ~nsSOAPMessage();
|
||||
|
||||
NS_DECL_ISUPPORTS
|
||||
|
||||
// nsISOAPMessage
|
||||
NS_DECL_NSISOAPMESSAGE
|
||||
|
||||
// nsISecurityCheckedComponent
|
||||
NS_DECL_NSISECURITYCHECKEDCOMPONENT
|
||||
|
||||
protected:
|
||||
|
||||
nsCOMPtr<nsIDOMDocument> mMessage;
|
||||
nsCOMPtr<nsISOAPEncoding> mEncoding;
|
||||
nsString mActionURI;
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -1,271 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
|
||||
#include "nsString.h"
|
||||
#include "nsReadableUtils.h"
|
||||
#include "nsSOAPParameter.h"
|
||||
#include "nsSOAPUtils.h"
|
||||
#include "nsIServiceManager.h"
|
||||
#include "nsISOAPAttachments.h"
|
||||
|
||||
nsSOAPParameter::nsSOAPParameter()
|
||||
{
|
||||
NS_INIT_ISUPPORTS();
|
||||
}
|
||||
|
||||
nsSOAPParameter::~nsSOAPParameter()
|
||||
{
|
||||
}
|
||||
|
||||
NS_IMPL_ISUPPORTS3_CI(nsSOAPParameter,
|
||||
nsISOAPParameter,
|
||||
nsISecurityCheckedComponent,
|
||||
nsIJSNativeInitializer)
|
||||
|
||||
/* attribute AString namespaceURI; */
|
||||
NS_IMETHODIMP nsSOAPParameter::GetNamespaceURI(nsAWritableString & aNamespaceURI)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(&aNamespaceURI);
|
||||
if (mElement) {
|
||||
return mElement->GetNamespaceURI(aNamespaceURI);
|
||||
}
|
||||
else {
|
||||
aNamespaceURI.Assign(mNamespaceURI);
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
NS_IMETHODIMP nsSOAPParameter::SetNamespaceURI(const nsAReadableString & aNamespaceURI)
|
||||
{
|
||||
if (mElement) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
mNamespaceURI.Assign(aNamespaceURI);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/* attribute AString name; */
|
||||
NS_IMETHODIMP nsSOAPParameter::GetName(nsAWritableString & aName)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(&aName);
|
||||
if (mElement) {
|
||||
return mElement->GetLocalName(aName);
|
||||
}
|
||||
else {
|
||||
aName.Assign(mName);
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
NS_IMETHODIMP nsSOAPParameter::SetName(const nsAReadableString & aName)
|
||||
{
|
||||
if (mElement) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
mName.Assign(aName);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/* attribute nsISOAPEncoding encoding; */
|
||||
NS_IMETHODIMP nsSOAPParameter::GetEncoding(nsISOAPEncoding* * aEncoding)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aEncoding);
|
||||
*aEncoding = mEncoding;
|
||||
NS_IF_ADDREF(*aEncoding);
|
||||
return NS_OK;
|
||||
}
|
||||
NS_IMETHODIMP nsSOAPParameter::SetEncoding(nsISOAPEncoding* aEncoding)
|
||||
{
|
||||
mEncoding = aEncoding;
|
||||
if (mElement) {
|
||||
mComputeValue = PR_TRUE;
|
||||
mValue = nsnull;
|
||||
mStatus = NS_OK;
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/* attribute nsISchemaType schemaType; */
|
||||
NS_IMETHODIMP nsSOAPParameter::GetSchemaType(nsISchemaType* * aSchemaType)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aSchemaType);
|
||||
*aSchemaType = mSchemaType;
|
||||
NS_IF_ADDREF(*aSchemaType);
|
||||
return NS_OK;
|
||||
}
|
||||
NS_IMETHODIMP nsSOAPParameter::SetSchemaType(nsISchemaType* aSchemaType)
|
||||
{
|
||||
mSchemaType = aSchemaType;
|
||||
if (mElement) {
|
||||
mComputeValue = PR_TRUE;
|
||||
mValue = nsnull;
|
||||
mStatus = NS_OK;
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/* attribute nsISOAPAttachments attachments; */
|
||||
NS_IMETHODIMP nsSOAPParameter::GetAttachments(nsISOAPAttachments* * aAttachments)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aAttachments);
|
||||
*aAttachments = mAttachments;
|
||||
NS_IF_ADDREF(*aAttachments);
|
||||
return NS_OK;
|
||||
}
|
||||
NS_IMETHODIMP nsSOAPParameter::SetAttachments(nsISOAPAttachments* aAttachments)
|
||||
{
|
||||
mAttachments = aAttachments;
|
||||
if (mElement) {
|
||||
mComputeValue = PR_TRUE;
|
||||
mValue = nsnull;
|
||||
mStatus = NS_OK;
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/* attribute nsIDOMElement element; */
|
||||
NS_IMETHODIMP nsSOAPParameter::GetElement(nsIDOMElement* * aElement)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aElement);
|
||||
*aElement = mElement;
|
||||
NS_IF_ADDREF(*aElement);
|
||||
return NS_OK;
|
||||
}
|
||||
NS_IMETHODIMP nsSOAPParameter::SetElement(nsIDOMElement* aElement)
|
||||
{
|
||||
mElement = aElement;
|
||||
mNamespaceURI.SetLength(0);
|
||||
mName.SetLength(0);
|
||||
mComputeValue = PR_TRUE;
|
||||
mValue = nsnull;
|
||||
mStatus = NS_OK;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/* attribute nsIVariant value; */
|
||||
NS_IMETHODIMP nsSOAPParameter::GetValue(nsIVariant* * aValue)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aValue);
|
||||
if (mElement // Check for auto-computation
|
||||
&& mComputeValue
|
||||
&& mEncoding)
|
||||
{
|
||||
mComputeValue = PR_FALSE;
|
||||
mStatus = mEncoding->Decode(mElement, mSchemaType, mAttachments, getter_AddRefs(mValue));
|
||||
}
|
||||
*aValue = mValue;
|
||||
NS_IF_ADDREF(*aValue);
|
||||
return mElement ? mStatus : NS_OK;
|
||||
}
|
||||
NS_IMETHODIMP nsSOAPParameter::SetValue(nsIVariant* aValue)
|
||||
{
|
||||
mValue = aValue;
|
||||
mComputeValue = PR_FALSE;
|
||||
mElement = nsnull;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsSOAPParameter::Initialize(JSContext *cx, JSObject *obj,
|
||||
PRUint32 argc, jsval *argv)
|
||||
{
|
||||
|
||||
// Get the arguments.
|
||||
|
||||
nsCOMPtr<nsIVariant> value;
|
||||
nsAutoString name;
|
||||
nsAutoString namespaceURI;
|
||||
nsCOMPtr<nsISupports> schemaType;
|
||||
nsCOMPtr<nsISupports> encoding;
|
||||
|
||||
if (!JS_ConvertArguments(cx, argc, argv, "/%iv %is %is %ip %ip",
|
||||
getter_AddRefs(value),
|
||||
NS_STATIC_CAST(nsAString*, &name),
|
||||
NS_STATIC_CAST(nsAString*, &namespaceURI),
|
||||
getter_AddRefs(schemaType),
|
||||
getter_AddRefs(encoding))) return NS_ERROR_ILLEGAL_VALUE;
|
||||
|
||||
nsresult rc = SetValue(value);
|
||||
if (NS_FAILED(rc)) return rc;
|
||||
rc = SetName(name);
|
||||
if (NS_FAILED(rc)) return rc;
|
||||
rc = SetNamespaceURI(namespaceURI);
|
||||
if (NS_FAILED(rc)) return rc;
|
||||
if (schemaType) {
|
||||
nsCOMPtr<nsISchemaType> v = do_QueryInterface(schemaType, &rc);
|
||||
if (NS_FAILED(rc)) return rc;
|
||||
rc = SetSchemaType(v);
|
||||
if (NS_FAILED(rc)) return rc;
|
||||
}
|
||||
if (encoding) {
|
||||
nsCOMPtr<nsISOAPEncoding> v = do_QueryInterface(encoding, &rc);
|
||||
if (NS_FAILED(rc)) return rc;
|
||||
rc = SetEncoding(v);
|
||||
if (NS_FAILED(rc)) return rc;
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
static const char* kAllAccess = "AllAccess";
|
||||
|
||||
/* string canCreateWrapper (in nsIIDPtr iid); */
|
||||
NS_IMETHODIMP
|
||||
nsSOAPParameter::CanCreateWrapper(const nsIID * iid, char **_retval)
|
||||
{
|
||||
if (iid->Equals(NS_GET_IID(nsISOAPParameter))) {
|
||||
*_retval = nsCRT::strdup(kAllAccess);
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/* string canCallMethod (in nsIIDPtr iid, in wstring methodName); */
|
||||
NS_IMETHODIMP
|
||||
nsSOAPParameter::CanCallMethod(const nsIID * iid, const PRUnichar *methodName, char **_retval)
|
||||
{
|
||||
if (iid->Equals(NS_GET_IID(nsISOAPParameter))) {
|
||||
*_retval = nsCRT::strdup(kAllAccess);
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/* string canGetProperty (in nsIIDPtr iid, in wstring propertyName); */
|
||||
NS_IMETHODIMP
|
||||
nsSOAPParameter::CanGetProperty(const nsIID * iid, const PRUnichar *propertyName, char **_retval)
|
||||
{
|
||||
if (iid->Equals(NS_GET_IID(nsISOAPParameter))) {
|
||||
*_retval = nsCRT::strdup(kAllAccess);
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/* string canSetProperty (in nsIIDPtr iid, in wstring propertyName); */
|
||||
NS_IMETHODIMP
|
||||
nsSOAPParameter::CanSetProperty(const nsIID * iid, const PRUnichar *propertyName, char **_retval)
|
||||
{
|
||||
if (iid->Equals(NS_GET_IID(nsISOAPParameter))) {
|
||||
*_retval = nsCRT::strdup(kAllAccess);
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
@@ -1,69 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
|
||||
#ifndef nsSOAPParameter_h__
|
||||
#define nsSOAPParameter_h__
|
||||
|
||||
#include "nsString.h"
|
||||
#include "nsIVariant.h"
|
||||
#include "nsISOAPParameter.h"
|
||||
#include "nsISecurityCheckedComponent.h"
|
||||
#include "nsIJSNativeInitializer.h"
|
||||
#include "nsISOAPEncoding.h"
|
||||
#include "nsISchema.h"
|
||||
#include "nsIDOMElement.h"
|
||||
#include "nsISOAPAttachments.h"
|
||||
#include "nsCOMPtr.h"
|
||||
|
||||
class nsSOAPParameter : public nsISOAPParameter,
|
||||
public nsISecurityCheckedComponent,
|
||||
public nsIJSNativeInitializer
|
||||
{
|
||||
public:
|
||||
nsSOAPParameter();
|
||||
virtual ~nsSOAPParameter();
|
||||
|
||||
NS_DECL_ISUPPORTS
|
||||
|
||||
// nsISOAPParameter
|
||||
NS_DECL_NSISOAPPARAMETER
|
||||
|
||||
// nsISecurityCheckedComponent
|
||||
NS_DECL_NSISECURITYCHECKEDCOMPONENT
|
||||
|
||||
// nsIJSNativeInitializer
|
||||
NS_IMETHOD Initialize(JSContext *cx, JSObject *obj,
|
||||
PRUint32 argc, jsval *argv);
|
||||
|
||||
protected:
|
||||
nsString mNamespaceURI;
|
||||
nsString mName;
|
||||
nsCOMPtr<nsISOAPEncoding> mEncoding;
|
||||
nsCOMPtr<nsISchemaType> mSchemaType;
|
||||
nsCOMPtr<nsISOAPAttachments> mAttachments;
|
||||
nsCOMPtr<nsIDOMElement> mElement;
|
||||
nsCOMPtr<nsIVariant> mValue;
|
||||
nsresult mStatus;
|
||||
PRBool mComputeValue;
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -1,122 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
|
||||
#include "nsSOAPResponse.h"
|
||||
#include "nsSOAPUtils.h"
|
||||
#include "nsSOAPFault.h"
|
||||
#include "nsISOAPParameter.h"
|
||||
|
||||
nsSOAPResponse::nsSOAPResponse()
|
||||
{
|
||||
}
|
||||
|
||||
nsSOAPResponse::~nsSOAPResponse()
|
||||
{
|
||||
/* destructor code */
|
||||
}
|
||||
|
||||
NS_IMPL_ISUPPORTS_INHERITED1(nsSOAPResponse, nsSOAPMessage, nsISOAPResponse)
|
||||
|
||||
/* attribute nsISOAPCall respondingTo; */
|
||||
NS_IMETHODIMP nsSOAPResponse::GetRespondingTo(nsISOAPCall * *aRespondingTo)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aRespondingTo);
|
||||
*aRespondingTo = mRespondingTo;
|
||||
NS_IF_ADDREF(*aRespondingTo);
|
||||
return NS_OK;
|
||||
}
|
||||
NS_IMETHODIMP nsSOAPResponse::SetRespondingTo(nsISOAPCall * aRespondingTo)
|
||||
{
|
||||
mRespondingTo = aRespondingTo;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/* readonly attribute nsISOAPFault fault; */
|
||||
NS_IMETHODIMP nsSOAPResponse::GetFault(nsISOAPFault * *aFault)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aFault);
|
||||
nsCOMPtr<nsIDOMElement> body;
|
||||
|
||||
*aFault = nsnull;
|
||||
GetBody(getter_AddRefs(body));
|
||||
if (body) {
|
||||
nsSOAPUtils::GetSpecificChildElement(body,
|
||||
nsSOAPUtils::kSOAPEnvURI, nsSOAPUtils::kFaultTagName,
|
||||
getter_AddRefs(body));
|
||||
if (body) {
|
||||
*aFault = new nsSOAPFault(body);
|
||||
if (!*aFault)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
NS_ADDREF(*aFault);
|
||||
}
|
||||
}
|
||||
else {
|
||||
*aFault = nsnull;
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
static const char* kAllAccess = "AllAccess";
|
||||
|
||||
/* string canCreateWrapper (in nsIIDPtr iid); */
|
||||
NS_IMETHODIMP
|
||||
nsSOAPResponse::CanCreateWrapper(const nsIID * iid, char **_retval)
|
||||
{
|
||||
if (iid->Equals(NS_GET_IID(nsISOAPResponse))) {
|
||||
*_retval = nsCRT::strdup(kAllAccess);
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/* string canCallMethod (in nsIIDPtr iid, in wstring methodName); */
|
||||
NS_IMETHODIMP
|
||||
nsSOAPResponse::CanCallMethod(const nsIID * iid, const PRUnichar *methodName, char **_retval)
|
||||
{
|
||||
if (iid->Equals(NS_GET_IID(nsISOAPResponse))) {
|
||||
*_retval = nsCRT::strdup(kAllAccess);
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/* string canGetProperty (in nsIIDPtr iid, in wstring propertyName); */
|
||||
NS_IMETHODIMP
|
||||
nsSOAPResponse::CanGetProperty(const nsIID * iid, const PRUnichar *propertyName, char **_retval)
|
||||
{
|
||||
if (iid->Equals(NS_GET_IID(nsISOAPResponse))) {
|
||||
*_retval = nsCRT::strdup(kAllAccess);
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/* string canSetProperty (in nsIIDPtr iid, in wstring propertyName); */
|
||||
NS_IMETHODIMP
|
||||
nsSOAPResponse::CanSetProperty(const nsIID * iid, const PRUnichar *propertyName, char **_retval)
|
||||
{
|
||||
if (iid->Equals(NS_GET_IID(nsISOAPResponse))) {
|
||||
*_retval = nsCRT::strdup(kAllAccess);
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
@@ -1,56 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
|
||||
#ifndef nsSOAPResponse_h__
|
||||
#define nsSOAPResponse_h__
|
||||
|
||||
#include "nsString.h"
|
||||
#include "nsSOAPCall.h"
|
||||
#include "nsISOAPResponse.h"
|
||||
#include "nsISecurityCheckedComponent.h"
|
||||
#include "nsIDOMDocument.h"
|
||||
#include "nsIDOMElement.h"
|
||||
#include "nsCOMPtr.h"
|
||||
|
||||
class nsSOAPResponse : public nsSOAPMessage,
|
||||
public nsISOAPResponse
|
||||
{
|
||||
public:
|
||||
NS_DECL_ISUPPORTS
|
||||
|
||||
// nsISOAPResponse
|
||||
NS_FORWARD_NSISOAPMESSAGE(nsSOAPMessage::)
|
||||
|
||||
// nsISOAPResponse
|
||||
NS_DECL_NSISOAPRESPONSE
|
||||
|
||||
// nsISecurityCheckedComponent
|
||||
NS_DECL_NSISECURITYCHECKEDCOMPONENT
|
||||
|
||||
nsSOAPResponse();
|
||||
virtual ~nsSOAPResponse();
|
||||
|
||||
protected:
|
||||
nsCOMPtr<nsISOAPCall> mRespondingTo;
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -1,237 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
|
||||
#include "nsString.h"
|
||||
#include "nsSOAPStruct.h"
|
||||
#include "nsSOAPUtils.h"
|
||||
#include "nsSupportsArray.h"
|
||||
#include "nsIXPConnect.h"
|
||||
#include "nsIServiceManager.h"
|
||||
#include "nsIComponentManager.h"
|
||||
#include "nsISOAPParameter.h"
|
||||
#include "nsSOAPJSValue.h"
|
||||
#include "jsapi.h"
|
||||
|
||||
NS_IMPL_ISUPPORTS3(nsSOAPStruct, nsISOAPStruct, nsIXPCScriptable, nsISecurityCheckedComponent)
|
||||
|
||||
nsSOAPStruct::nsSOAPStruct(): mMembers(new nsSupportsHashtable)
|
||||
{
|
||||
NS_INIT_ISUPPORTS();
|
||||
|
||||
/* member initializers and constructor code */
|
||||
}
|
||||
|
||||
nsSOAPStruct::~nsSOAPStruct()
|
||||
{
|
||||
/* destructor code */
|
||||
delete mMembers;
|
||||
}
|
||||
|
||||
class nsSOAPStructEnumerator : public nsISimpleEnumerator
|
||||
{
|
||||
public:
|
||||
NS_DECL_ISUPPORTS
|
||||
|
||||
// nsISimpleEnumerator methods:
|
||||
NS_DECL_NSISIMPLEENUMERATOR
|
||||
|
||||
// nsSOAPStructEnumerator methods:
|
||||
|
||||
nsSOAPStructEnumerator(nsSOAPStruct* aStruct);
|
||||
virtual ~nsSOAPStructEnumerator();
|
||||
|
||||
protected:
|
||||
nsCOMPtr<nsSupportsArray> mMembers;
|
||||
PRUint32 mCurrent;
|
||||
};
|
||||
|
||||
PRBool StructEnumFunc(nsHashKey *aKey, void *aData, void* aClosure)
|
||||
{
|
||||
nsISupportsArray* members = NS_STATIC_CAST(nsISupportsArray*,aClosure);
|
||||
nsISOAPParameter* parameter = NS_STATIC_CAST(nsISOAPParameter*,aData);
|
||||
members->AppendElement(parameter);
|
||||
return PR_TRUE;
|
||||
}
|
||||
|
||||
nsSOAPStructEnumerator::nsSOAPStructEnumerator(nsSOAPStruct* aStruct)
|
||||
: mMembers(new nsSupportsArray()), mCurrent(0)
|
||||
{
|
||||
NS_INIT_REFCNT();
|
||||
aStruct->mMembers->Enumerate(&StructEnumFunc, mMembers);
|
||||
}
|
||||
|
||||
nsSOAPStructEnumerator::~nsSOAPStructEnumerator()
|
||||
{
|
||||
}
|
||||
|
||||
NS_IMPL_ISUPPORTS1(nsSOAPStructEnumerator, nsISimpleEnumerator)
|
||||
|
||||
NS_IMETHODIMP nsSOAPStructEnumerator::GetNext(nsISupports** aItem)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aItem);
|
||||
PRUint32 count;
|
||||
mMembers->Count(&count);
|
||||
if (mCurrent < count) {
|
||||
*aItem = mMembers->ElementAt(mCurrent++);
|
||||
return NS_OK;
|
||||
}
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsSOAPStructEnumerator::HasMoreElements(PRBool* aResult)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aResult);
|
||||
PRUint32 count;
|
||||
mMembers->Count(&count);
|
||||
*aResult = mCurrent < count;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/* readonly attribute nsISimpleEnumerator members; */
|
||||
NS_IMETHODIMP nsSOAPStruct::GetMembers(nsISimpleEnumerator * *aMembers)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aMembers);
|
||||
*aMembers = new nsSOAPStructEnumerator(this);
|
||||
if (aMembers) {
|
||||
NS_ADDREF(*aMembers);
|
||||
return NS_OK;
|
||||
}
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsSOAPStruct::GetMember(const nsAReadableString& aName, nsISOAPParameter* *aMember)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aMember);
|
||||
nsStringKey nameKey(aName);
|
||||
*aMember = NS_STATIC_CAST(nsISOAPParameter*, mMembers->Get(&nameKey));
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
// The nsIXPCScriptable map declaration that will generate stubs for us...
|
||||
#define XPC_MAP_CLASSNAME nsSOAPStruct
|
||||
#define XPC_MAP_QUOTED_CLASSNAME "SOAPStruct"
|
||||
#define XPC_MAP_WANT_SETPROPERTY
|
||||
#define XPC_MAP_WANT_GETPROPERTY
|
||||
#define XPC_MAP_FLAGS nsIXPCScriptable::USE_JSSTUB_FOR_ADDPROPERTY | \
|
||||
nsIXPCScriptable::USE_JSSTUB_FOR_DELPROPERTY | \
|
||||
nsIXPCScriptable::USE_JSSTUB_FOR_SETPROPERTY
|
||||
#include "xpc_map_end.h" /* This will #undef the above */
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsSOAPStruct::GetProperty(nsIXPConnectWrappedNative *wrapper, JSContext *cx,
|
||||
JSObject *obj, jsval id, jsval *vp,
|
||||
PRBool *_retval)
|
||||
{
|
||||
if (JSVAL_IS_STRING(id)) {
|
||||
JSString* str = JSVAL_TO_STRING(id);
|
||||
const PRUnichar* name = NS_REINTERPRET_CAST(const PRUnichar *,
|
||||
JS_GetStringChars(str));
|
||||
nsDependentString namestr(name);
|
||||
nsStringKey nameKey(namestr);
|
||||
nsCOMPtr<nsISOAPParameter> parameter = dont_AddRef(NS_STATIC_CAST(nsISOAPParameter*, mMembers->Get(&nameKey)));
|
||||
if (parameter == nsnull)
|
||||
return NS_OK;
|
||||
nsAutoString type;
|
||||
parameter->GetType(type);
|
||||
nsCOMPtr<nsISupports> value;
|
||||
parameter->GetValue(getter_AddRefs(value));
|
||||
return nsSOAPJSValue::ConvertValueToJSVal(cx,
|
||||
value,
|
||||
type,
|
||||
vp);
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsSOAPStruct::SetProperty(nsIXPConnectWrappedNative *wrapper, JSContext *cx,
|
||||
JSObject *obj, jsval id, jsval *vp,
|
||||
PRBool *_retval)
|
||||
{
|
||||
if (JSVAL_IS_STRING(id)) {
|
||||
JSString* str = JSVAL_TO_STRING(id);
|
||||
const PRUnichar* name = NS_REINTERPRET_CAST(const PRUnichar *,
|
||||
JS_GetStringChars(str));
|
||||
nsDependentString namestr(name);
|
||||
nsStringKey nameKey(namestr);
|
||||
nsCOMPtr<nsISupports> value;
|
||||
nsAutoString type;
|
||||
nsresult rc = nsSOAPJSValue::ConvertJSValToValue(cx,
|
||||
*vp,
|
||||
getter_AddRefs(value),
|
||||
type);
|
||||
if (NS_FAILED(rc))
|
||||
return rc;
|
||||
nsCOMPtr<nsISOAPParameter> parameter = do_CreateInstance(NS_SOAPPARAMETER_CONTRACTID);
|
||||
parameter->SetName(namestr);
|
||||
parameter->SetValue(value);
|
||||
parameter->SetType(type);
|
||||
mMembers->Put(&nameKey, parameter);
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
static const char* kAllAccess = "AllAccess";
|
||||
|
||||
/* string canCreateWrapper (in nsIIDPtr iid); */
|
||||
NS_IMETHODIMP
|
||||
nsSOAPStruct::CanCreateWrapper(const nsIID * iid, char **_retval)
|
||||
{
|
||||
if (iid->Equals(NS_GET_IID(nsISOAPStruct))) {
|
||||
*_retval = nsCRT::strdup(kAllAccess);
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/* string canCallMethod (in nsIIDPtr iid, in wstring methodName); */
|
||||
NS_IMETHODIMP
|
||||
nsSOAPStruct::CanCallMethod(const nsIID * iid, const PRUnichar *methodName, char **_retval)
|
||||
{
|
||||
if (iid->Equals(NS_GET_IID(nsISOAPStruct))) {
|
||||
*_retval = nsCRT::strdup(kAllAccess);
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/* string canGetProperty (in nsIIDPtr iid, in wstring propertyName); */
|
||||
NS_IMETHODIMP
|
||||
nsSOAPStruct::CanGetProperty(const nsIID * iid, const PRUnichar *propertyName, char **_retval)
|
||||
{
|
||||
if (iid->Equals(NS_GET_IID(nsISOAPStruct))) {
|
||||
*_retval = nsCRT::strdup(kAllAccess);
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/* string canSetProperty (in nsIIDPtr iid, in wstring propertyName); */
|
||||
NS_IMETHODIMP
|
||||
nsSOAPStruct::CanSetProperty(const nsIID * iid, const PRUnichar *propertyName, char **_retval)
|
||||
{
|
||||
if (iid->Equals(NS_GET_IID(nsISOAPStruct))) {
|
||||
*_retval = nsCRT::strdup(kAllAccess);
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
@@ -1,62 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
|
||||
#ifndef nsSOAPStruct_h__
|
||||
#define nsSOAPStruct_h__
|
||||
|
||||
#include "nsString.h"
|
||||
#include "nsISOAPStruct.h"
|
||||
#include "nsIXPCScriptable.h"
|
||||
#include "nsISecurityCheckedComponent.h"
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsHashtable.h"
|
||||
|
||||
class nsSOAPStructEnumerator;
|
||||
|
||||
class nsSOAPStruct : public nsISOAPStruct,
|
||||
public nsIXPCScriptable,
|
||||
public nsISecurityCheckedComponent
|
||||
{
|
||||
public:
|
||||
nsSOAPStruct();
|
||||
virtual ~nsSOAPStruct();
|
||||
|
||||
NS_DECL_ISUPPORTS
|
||||
|
||||
// nsISOAPStruct
|
||||
NS_DECL_NSISOAPSTRUCT
|
||||
|
||||
// nsISOAPStruct
|
||||
NS_DECL_NSIXPCSCRIPTABLE
|
||||
|
||||
// nsISecurityCheckedComponent
|
||||
NS_DECL_NSISECURITYCHECKEDCOMPONENT
|
||||
|
||||
nsresult SetMember(nsISOAPParameter *member);
|
||||
|
||||
protected:
|
||||
nsSupportsHashtable* mMembers;
|
||||
|
||||
friend nsSOAPStructEnumerator;
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -1,426 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
|
||||
#include "nsSOAPUtils.h"
|
||||
#include "nsIDOMText.h"
|
||||
#include "nsIDOMNamedNodeMap.h"
|
||||
#include "nsCOMPtr.h"
|
||||
|
||||
NS_NAMED_LITERAL_STRING(nsSOAPUtils::kSOAPEnvURI,"http://schemas.xmlsoap.org/soap/envelope/");
|
||||
NS_NAMED_LITERAL_STRING(nsSOAPUtils::kSOAPEncodingURI,"http://schemas.xmlsoap.org/soap/encoding/");
|
||||
NS_NAMED_LITERAL_STRING(nsSOAPUtils::kSOAPEnvPrefix,"SOAP-ENV");
|
||||
NS_NAMED_LITERAL_STRING(nsSOAPUtils::kSOAPEncodingPrefix,"SOAP-ENC");
|
||||
NS_NAMED_LITERAL_STRING(nsSOAPUtils::kXSIURI,"http://www.w3.org/1999/XMLSchema-instance");
|
||||
NS_NAMED_LITERAL_STRING(nsSOAPUtils::kXSDURI,"http://www.w3.org/1999/XMLSchema");
|
||||
NS_NAMED_LITERAL_STRING(nsSOAPUtils::kXSIPrefix,"xsi");
|
||||
NS_NAMED_LITERAL_STRING(nsSOAPUtils::kXSITypeAttribute,"type");
|
||||
NS_NAMED_LITERAL_STRING(nsSOAPUtils::kXSDPrefix,"xsd");
|
||||
NS_NAMED_LITERAL_STRING(nsSOAPUtils::kEncodingStyleAttribute,"encodingStyle");
|
||||
NS_NAMED_LITERAL_STRING(nsSOAPUtils::kActorAttribute,"actor");
|
||||
NS_NAMED_LITERAL_STRING(nsSOAPUtils::kEnvelopeTagName,"Envelope");
|
||||
NS_NAMED_LITERAL_STRING(nsSOAPUtils::kHeaderTagName,"Header");
|
||||
NS_NAMED_LITERAL_STRING(nsSOAPUtils::kBodyTagName,"Body");
|
||||
NS_NAMED_LITERAL_STRING(nsSOAPUtils::kFaultTagName,"Fault");
|
||||
NS_NAMED_LITERAL_STRING(nsSOAPUtils::kFaultCodeTagName,"faultcode");
|
||||
NS_NAMED_LITERAL_STRING(nsSOAPUtils::kFaultStringTagName,"faultstring");
|
||||
NS_NAMED_LITERAL_STRING(nsSOAPUtils::kFaultActorTagName,"faultactor");
|
||||
NS_NAMED_LITERAL_STRING(nsSOAPUtils::kFaultDetailTagName,"detail");
|
||||
|
||||
NS_NAMED_LITERAL_STRING(nsSOAPUtils::kEncodingSeparator,"#");
|
||||
NS_NAMED_LITERAL_STRING(nsSOAPUtils::kQualifiedSeparator,":");
|
||||
|
||||
NS_NAMED_LITERAL_STRING(nsSOAPUtils::kXMLNamespaceNamespaceURI, "htp://www.w3.org/2000/xmlns/");
|
||||
NS_NAMED_LITERAL_STRING(nsSOAPUtils::kXMLNamespaceURI, "htp://www.w3.org/XML/1998/namespace");
|
||||
NS_NAMED_LITERAL_STRING(nsSOAPUtils::kXMLPrefix, "xml:");
|
||||
NS_NAMED_LITERAL_STRING(nsSOAPUtils::kXMLNamespacePrefix, "xmlns:");
|
||||
|
||||
void
|
||||
nsSOAPUtils::GetSpecificChildElement(
|
||||
nsIDOMElement *aParent,
|
||||
const nsAReadableString& aNamespace,
|
||||
const nsAReadableString& aType,
|
||||
nsIDOMElement * *aElement)
|
||||
{
|
||||
nsCOMPtr<nsIDOMElement> sibling;
|
||||
|
||||
*aElement = nsnull;
|
||||
GetFirstChildElement(aParent, getter_AddRefs(sibling));
|
||||
if (sibling)
|
||||
{
|
||||
GetSpecificSiblingElement(sibling,
|
||||
aNamespace, aType, aElement);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
nsSOAPUtils::GetSpecificSiblingElement(
|
||||
nsIDOMElement *aSibling,
|
||||
const nsAReadableString& aNamespace,
|
||||
const nsAReadableString& aType,
|
||||
nsIDOMElement * *aElement)
|
||||
{
|
||||
nsCOMPtr<nsIDOMElement> sibling;
|
||||
|
||||
*aElement = nsnull;
|
||||
sibling = aSibling;
|
||||
do {
|
||||
nsAutoString name, namespaceURI;
|
||||
sibling->GetLocalName(name);
|
||||
sibling->GetNamespaceURI(namespaceURI);
|
||||
if (name.Equals(aType)
|
||||
&& namespaceURI.Equals(nsSOAPUtils::kSOAPEnvURI))
|
||||
{
|
||||
*aElement = sibling;
|
||||
NS_ADDREF(*aElement);
|
||||
return;
|
||||
}
|
||||
nsCOMPtr<nsIDOMElement> temp = sibling;
|
||||
GetNextSiblingElement(temp, getter_AddRefs(sibling));
|
||||
} while (sibling);
|
||||
}
|
||||
|
||||
void
|
||||
nsSOAPUtils::GetFirstChildElement(nsIDOMElement* aParent,
|
||||
nsIDOMElement** aElement)
|
||||
{
|
||||
nsCOMPtr<nsIDOMNode> child;
|
||||
|
||||
*aElement = nsnull;
|
||||
aParent->GetFirstChild(getter_AddRefs(child));
|
||||
while (child) {
|
||||
PRUint16 type;
|
||||
child->GetNodeType(&type);
|
||||
if (nsIDOMNode::ELEMENT_NODE == type) {
|
||||
child->QueryInterface(NS_GET_IID(nsIDOMElement), (void**)aElement);
|
||||
break;
|
||||
}
|
||||
nsCOMPtr<nsIDOMNode> temp = child;
|
||||
GetNextSibling(temp, getter_AddRefs(child));
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
nsSOAPUtils::GetNextSiblingElement(nsIDOMElement* aStart,
|
||||
nsIDOMElement** aElement)
|
||||
{
|
||||
nsCOMPtr<nsIDOMNode> sibling;
|
||||
|
||||
*aElement = nsnull;
|
||||
GetNextSibling(aStart, getter_AddRefs(sibling));
|
||||
while (sibling) {
|
||||
PRUint16 type;
|
||||
sibling->GetNodeType(&type);
|
||||
if (nsIDOMNode::ELEMENT_NODE == type) {
|
||||
sibling->QueryInterface(NS_GET_IID(nsIDOMElement), (void**)aElement);
|
||||
break;
|
||||
}
|
||||
nsCOMPtr<nsIDOMNode> temp = sibling;
|
||||
GetNextSibling(temp, getter_AddRefs(sibling));
|
||||
}
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsSOAPUtils::GetElementTextContent(nsIDOMElement* aElement,
|
||||
nsAWritableString& aText)
|
||||
{
|
||||
nsCOMPtr<nsIDOMNode> child;
|
||||
nsAutoString rtext;
|
||||
aElement->GetFirstChild(getter_AddRefs(child));
|
||||
while (child) {
|
||||
PRUint16 type;
|
||||
child->GetNodeType(&type);
|
||||
if (nsIDOMNode::TEXT_NODE == type
|
||||
|| nsIDOMNode::CDATA_SECTION_NODE == type) {
|
||||
nsCOMPtr<nsIDOMText> text = do_QueryInterface(child);
|
||||
nsAutoString data;
|
||||
text->GetData(data);
|
||||
rtext.Append(data);
|
||||
}
|
||||
else if (nsIDOMNode::ELEMENT_NODE == type) {
|
||||
return NS_ERROR_ILLEGAL_VALUE; // This was interpreted as a simple value, yet had complex content in it.
|
||||
}
|
||||
nsCOMPtr<nsIDOMNode> temp = child;
|
||||
GetNextSibling(temp, getter_AddRefs(child));
|
||||
}
|
||||
aText.Assign(rtext);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
PRBool
|
||||
nsSOAPUtils::HasChildElements(nsIDOMElement* aElement)
|
||||
{
|
||||
nsCOMPtr<nsIDOMNode> child;
|
||||
|
||||
aElement->GetFirstChild(getter_AddRefs(child));
|
||||
while (child) {
|
||||
PRUint16 type;
|
||||
child->GetNodeType(&type);
|
||||
if (nsIDOMNode::ELEMENT_NODE == type) {
|
||||
return PR_TRUE;
|
||||
}
|
||||
nsCOMPtr<nsIDOMNode> temp = child;
|
||||
GetNextSibling(temp, getter_AddRefs(child));
|
||||
}
|
||||
|
||||
return PR_FALSE;
|
||||
}
|
||||
|
||||
void
|
||||
nsSOAPUtils::GetNextSibling(nsIDOMNode* aSibling, nsIDOMNode **aNext)
|
||||
{
|
||||
nsCOMPtr<nsIDOMNode> last;
|
||||
nsCOMPtr<nsIDOMNode> current;
|
||||
PRUint16 type;
|
||||
|
||||
*aNext = nsnull;
|
||||
last = aSibling;
|
||||
|
||||
last->GetNodeType(&type);
|
||||
if (nsIDOMNode::ENTITY_REFERENCE_NODE == type) {
|
||||
last->GetFirstChild(getter_AddRefs(current));
|
||||
if (!last)
|
||||
{
|
||||
last->GetNextSibling(getter_AddRefs(current));
|
||||
}
|
||||
}
|
||||
else {
|
||||
last->GetNextSibling(getter_AddRefs(current));
|
||||
}
|
||||
while (!current)
|
||||
{
|
||||
last->GetParentNode(getter_AddRefs(current));
|
||||
current->GetNodeType(&type);
|
||||
if (nsIDOMNode::ENTITY_REFERENCE_NODE == type) {
|
||||
last = current;
|
||||
last->GetNextSibling(getter_AddRefs(current));
|
||||
}
|
||||
else {
|
||||
current = nsnull;
|
||||
break;
|
||||
}
|
||||
}
|
||||
*aNext = current;
|
||||
NS_IF_ADDREF(*aNext);
|
||||
}
|
||||
nsresult nsSOAPUtils::GetNamespaceURI(nsIDOMElement* aScope,
|
||||
const nsAReadableString & aQName,
|
||||
nsAWritableString & aURI)
|
||||
{
|
||||
aURI.Truncate(0);
|
||||
PRInt32 i = aQName.FindChar(':');
|
||||
if (i < 0) {
|
||||
return NS_OK;
|
||||
}
|
||||
nsAutoString prefix;
|
||||
aQName.Left(prefix, i);
|
||||
|
||||
if (prefix.Equals(kXMLPrefix)) {
|
||||
aURI.Assign(kXMLNamespaceURI);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult rc;
|
||||
nsCOMPtr<nsIDOMNode> current = aScope;
|
||||
nsCOMPtr<nsIDOMNamedNodeMap> attrs;
|
||||
nsCOMPtr<nsIDOMNode> temp;
|
||||
nsAutoString value;
|
||||
while (current != nsnull) {
|
||||
rc = current->GetAttributes(getter_AddRefs(attrs));
|
||||
if (NS_FAILED(rc)) return rc;
|
||||
if (attrs) {
|
||||
rc = attrs->GetNamedItemNS(kXMLNamespaceNamespaceURI, prefix, getter_AddRefs(temp));
|
||||
if (NS_FAILED(rc)) return rc;
|
||||
if (temp != nsnull)
|
||||
return temp->GetNodeValue(aURI);
|
||||
}
|
||||
rc = current->GetParentNode(getter_AddRefs(temp));
|
||||
if (NS_FAILED(rc)) return rc;
|
||||
current = temp;
|
||||
}
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
nsresult nsSOAPUtils::GetLocalName(const nsAReadableString & aQName,
|
||||
nsAWritableString & aLocalName)
|
||||
{
|
||||
PRInt32 i = aQName.FindChar(':');
|
||||
if (i < 0)
|
||||
aLocalName = aQName;
|
||||
else
|
||||
aQName.Mid(aLocalName, i, aQName.Length() - i);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsSOAPUtils::MakeNamespacePrefix(nsIDOMElement* aScope,
|
||||
const nsAReadableString & aURI,
|
||||
nsAWritableString & aPrefix)
|
||||
{
|
||||
// This may change for level 3 serialization, so be sure to gut this
|
||||
// and call the standardized level 3 method when it is available.
|
||||
aPrefix.Truncate(0);
|
||||
if (aURI.IsEmpty())
|
||||
return NS_OK;
|
||||
if (aURI.Equals(nsSOAPUtils::kXMLNamespaceURI)) {
|
||||
aPrefix.Assign(nsSOAPUtils::kXMLPrefix);
|
||||
return NS_OK;
|
||||
}
|
||||
nsCOMPtr<nsIDOMNode> current = aScope;
|
||||
nsCOMPtr<nsIDOMNamedNodeMap> attrs;
|
||||
nsCOMPtr<nsIDOMNode> temp;
|
||||
nsAutoString tstr;
|
||||
nsresult rc;
|
||||
PRUint32 maxns = 0; // Keep track of max generated NS
|
||||
for (;;) {
|
||||
rc = current->GetAttributes(getter_AddRefs(attrs));
|
||||
if (NS_FAILED(rc)) return rc;
|
||||
if (attrs) {
|
||||
PRUint32 i = 0;
|
||||
for (;;)
|
||||
{
|
||||
attrs->Item(i++, getter_AddRefs(temp));
|
||||
if (!temp)
|
||||
break;
|
||||
temp->GetNamespaceURI(tstr);
|
||||
if (!tstr.Equals(nsSOAPUtils::kXMLNamespaceNamespaceURI))
|
||||
continue;
|
||||
temp->GetNodeValue(tstr);
|
||||
if (tstr.Equals(aURI)) {
|
||||
nsAutoString prefix;
|
||||
rc = temp->GetLocalName(prefix);
|
||||
if (NS_FAILED(rc)) return rc;
|
||||
nsCOMPtr<nsIDOMNode> check = aScope;
|
||||
PRBool hasDecl;
|
||||
nsCOMPtr<nsIDOMElement> echeck;
|
||||
while (check != current) { // Make sure prefix is not overridden
|
||||
echeck = do_QueryInterface(check);
|
||||
if (echeck) {
|
||||
rc = echeck->HasAttributeNS(nsSOAPUtils::kXMLNamespaceNamespaceURI, prefix, &hasDecl);
|
||||
if (NS_FAILED(rc)) return rc;
|
||||
if (hasDecl)
|
||||
break;
|
||||
current->GetParentNode(getter_AddRefs(temp));
|
||||
current = temp;
|
||||
}
|
||||
}
|
||||
if (check == current) {
|
||||
aPrefix.Assign(prefix);
|
||||
return NS_OK;
|
||||
}
|
||||
}
|
||||
rc = temp->GetLocalName(tstr);
|
||||
if (NS_FAILED(rc))
|
||||
return rc;
|
||||
else { // Decode the generated namespace into a number
|
||||
nsReadingIterator<PRUnichar> i1;
|
||||
nsReadingIterator<PRUnichar> i2;
|
||||
tstr.BeginReading(i1);
|
||||
tstr.EndReading(i2);
|
||||
if (i1 == i2 || *i1 != 'n')
|
||||
continue;
|
||||
i1++;
|
||||
if (i1 == i2 || *i1 != 's')
|
||||
continue;
|
||||
i1++;
|
||||
PRUint32 n = 0;
|
||||
while (i1 != i2) {
|
||||
PRUnichar c = *i1;
|
||||
i1++;
|
||||
if (c < '0' || c > '9') {
|
||||
n = 0;
|
||||
break;
|
||||
}
|
||||
n = n * 10 + (c - '0');
|
||||
}
|
||||
if (n > maxns)
|
||||
maxns = n;
|
||||
}
|
||||
}
|
||||
}
|
||||
current->GetParentNode(getter_AddRefs(temp));
|
||||
if (temp)
|
||||
current = temp;
|
||||
else
|
||||
break;
|
||||
}
|
||||
// Create a unique prefix...
|
||||
PRUint32 len = 3;
|
||||
PRUint32 c = maxns + 1;
|
||||
while (c >= 10) {
|
||||
c = c / 10;
|
||||
len++;
|
||||
}
|
||||
// Set the length and write it backwards since that's the easiest way..
|
||||
aPrefix.SetLength(len);
|
||||
nsWritingIterator<PRUnichar> i2;
|
||||
aPrefix.EndWriting(i2);
|
||||
c = maxns + 1;
|
||||
while (c > 0) {
|
||||
PRUint32 r = c % 10;
|
||||
c = c / 10;
|
||||
i2--;
|
||||
*i2 = (PRUnichar)(r + '0');
|
||||
}
|
||||
i2--;
|
||||
*i2 = 's';
|
||||
i2--;
|
||||
*i2 = 'n';
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsSOAPUtils::MakeNamespacePrefixFixed(nsIDOMElement* aScope,
|
||||
const nsAReadableString & aURI,
|
||||
nsAWritableString & aPrefix)
|
||||
{
|
||||
if (aURI.Equals(kSOAPEncodingURI))
|
||||
aPrefix = kSOAPEncodingPrefix;
|
||||
else if (aURI.Equals(kSOAPEnvURI))
|
||||
aPrefix = kSOAPEnvPrefix;
|
||||
else if (aURI.Equals(kXSIURI))
|
||||
aPrefix = kXSIPrefix;
|
||||
else if (aURI.Equals(kXSDURI))
|
||||
aPrefix = kXSDPrefix;
|
||||
else
|
||||
return MakeNamespacePrefix(aScope, aURI, aPrefix);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
PRBool nsSOAPUtils::StartsWith(nsAReadableString& aSuper,
|
||||
nsAReadableString& aSub)
|
||||
{
|
||||
PRUint32 c1 = aSuper.Length();
|
||||
PRUint32 c2 = aSub.Length();
|
||||
if (c1 < c2) return PR_FALSE;
|
||||
if (c1 == c2) return aSuper.Equals(aSub);
|
||||
nsReadingIterator<PRUnichar> i1;
|
||||
nsReadingIterator<PRUnichar> i2;
|
||||
aSuper.BeginReading(i1);
|
||||
aSub.BeginReading(i2);
|
||||
while (c2--) {
|
||||
if (*i1 != *i2) return PR_FALSE;
|
||||
i1++;
|
||||
i2++;
|
||||
}
|
||||
return PR_TRUE;
|
||||
}
|
||||
@@ -1,109 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
|
||||
#ifndef nsSOAPUtils_h__
|
||||
#define nsSOAPUtils_h__
|
||||
|
||||
#include "nsString.h"
|
||||
#include "nsIDOMElement.h"
|
||||
|
||||
class nsSOAPUtils {
|
||||
public:
|
||||
static void GetSpecificChildElement(nsIDOMElement *aParent,
|
||||
const nsAReadableString& aNamespace,
|
||||
const nsAReadableString& aType,
|
||||
nsIDOMElement * *aElement);
|
||||
static void GetSpecificSiblingElement(nsIDOMElement *aSibling,
|
||||
const nsAReadableString& aNamespace,
|
||||
const nsAReadableString& aType,
|
||||
nsIDOMElement * *aElement);
|
||||
static void GetFirstChildElement(nsIDOMElement* aParent,
|
||||
nsIDOMElement** aElement);
|
||||
static void GetNextSiblingElement(nsIDOMElement* aStart,
|
||||
nsIDOMElement** aElement);
|
||||
static nsresult GetElementTextContent(nsIDOMElement* aElement,
|
||||
nsAWritableString& aText);
|
||||
static PRBool HasChildElements(nsIDOMElement* aElement);
|
||||
|
||||
static void GetNextSibling(nsIDOMNode* aSibling,
|
||||
nsIDOMNode **aNext);
|
||||
static nsresult MakeNamespacePrefix(nsIDOMElement* aElement,
|
||||
const nsAReadableString & aURI,
|
||||
nsAWritableString & aPrefix);
|
||||
static nsresult MakeNamespacePrefixFixed(nsIDOMElement* aElement,
|
||||
const nsAReadableString & aURI,
|
||||
nsAWritableString & aPrefix);
|
||||
static nsresult GetNamespaceURI(nsIDOMElement* aElement,
|
||||
const nsAReadableString & aQName,
|
||||
nsAWritableString & aURI);
|
||||
static nsresult GetLocalName(const nsAReadableString & aQName,
|
||||
nsAWritableString & aLocalName);
|
||||
|
||||
// All those missing string functions have to come from somewhere...
|
||||
|
||||
static PRBool StartsWith(nsAReadableString& aSuper,
|
||||
nsAReadableString& aSub);
|
||||
static nsDependentString kSOAPEnvURI;
|
||||
static nsDependentString kSOAPEncodingURI;
|
||||
static nsDependentString kSOAPEnvPrefix;
|
||||
static nsDependentString kSOAPEncodingPrefix;
|
||||
static nsDependentString kXSIURI;
|
||||
static nsDependentString kXSDURI;
|
||||
static nsDependentString kXSIPrefix;
|
||||
static nsDependentString kXSITypeAttribute;
|
||||
static nsDependentString kXSDPrefix;
|
||||
static nsDependentString kEncodingStyleAttribute;
|
||||
static nsDependentString kActorAttribute;
|
||||
static nsDependentString kEnvelopeTagName;
|
||||
static nsDependentString kHeaderTagName;
|
||||
static nsDependentString kBodyTagName;
|
||||
static nsDependentString kFaultTagName;
|
||||
static nsDependentString kFaultCodeTagName;
|
||||
static nsDependentString kFaultStringTagName;
|
||||
static nsDependentString kFaultActorTagName;
|
||||
static nsDependentString kFaultDetailTagName;
|
||||
static nsDependentString kEncodingSeparator;
|
||||
static nsDependentString kQualifiedSeparator;
|
||||
static nsDependentString kXMLNamespaceNamespaceURI;
|
||||
static nsDependentString kXMLNamespaceURI;
|
||||
static nsDependentString kXMLNamespacePrefix;
|
||||
static nsDependentString kXMLPrefix;
|
||||
};
|
||||
|
||||
// Used to support null strings.
|
||||
|
||||
inline PRBool AStringIsNull(const nsAReadableString& aString)
|
||||
{
|
||||
return aString.IsVoid() || aString.IsEmpty(); // Get rid of empty hack when string implementations support.
|
||||
}
|
||||
|
||||
inline void SetAStringToNull(nsAWritableString& aString)
|
||||
{
|
||||
aString.Truncate();
|
||||
aString.SetIsVoid(PR_TRUE);
|
||||
}
|
||||
|
||||
#define NS_SOAP_ENSURE_ARG_STRING(arg) \
|
||||
NS_ENSURE_FALSE(AStringIsNull(arg), NS_ERROR_INVALID_ARG)
|
||||
|
||||
|
||||
#endif
|
||||
39
mozilla/xpinstall/Makefile.in
Normal file
39
mozilla/xpinstall/Makefile.in
Normal file
@@ -0,0 +1,39 @@
|
||||
#!gmake
|
||||
#
|
||||
# The contents of this file are subject to the Netscape Public License
|
||||
# Version 1.0 (the "License"); you may not use this file except in
|
||||
# compliance with the License. You may obtain a copy of the License at
|
||||
# http://www.mozilla.org/NPL/
|
||||
#
|
||||
# Software distributed under the License is distributed on an "AS IS" basis,
|
||||
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
# for the specific language governing rights and limitations under the
|
||||
# License.
|
||||
#
|
||||
# The Original Code is Mozilla Communicator client code,
|
||||
# released March 31, 1998.
|
||||
#
|
||||
# The Initial Developer of the Original Code is Netscape Communications
|
||||
# Corporation. Portions created by Netscape are
|
||||
# Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||
# Reserved.
|
||||
#
|
||||
# Contributors:
|
||||
# Daniel Veditz <dveditz@netscape.com>
|
||||
# Douglas Turner <dougt@netscape.com>
|
||||
|
||||
|
||||
DEPTH = ..
|
||||
topsrcdir = @top_srcdir@
|
||||
srcdir = @srcdir@
|
||||
VPATH = @srcdir@
|
||||
|
||||
include $(DEPTH)/config/autoconf.mk
|
||||
|
||||
DIRS = public
|
||||
|
||||
include $(topsrcdir)/config/config.mk
|
||||
|
||||
include $(topsrcdir)/config/rules.mk
|
||||
|
||||
|
||||
BIN
mozilla/xpinstall/macbuild/xpinstall.mcp
Normal file
BIN
mozilla/xpinstall/macbuild/xpinstall.mcp
Normal file
Binary file not shown.
BIN
mozilla/xpinstall/macbuild/xpinstallIDL.mcp
Normal file
BIN
mozilla/xpinstall/macbuild/xpinstallIDL.mcp
Normal file
Binary file not shown.
30
mozilla/xpinstall/makefile.win
Normal file
30
mozilla/xpinstall/makefile.win
Normal file
@@ -0,0 +1,30 @@
|
||||
#!nmake
|
||||
#
|
||||
# The contents of this file are subject to the Netscape Public License
|
||||
# Version 1.0 (the "License"); you may not use this file except in
|
||||
# compliance with the License. You may obtain a copy of the License at
|
||||
# http://www.mozilla.org/NPL/
|
||||
#
|
||||
# Software distributed under the License is distributed on an "AS IS" basis,
|
||||
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
# for the specific language governing rights and limitations under the
|
||||
# License.
|
||||
#
|
||||
# The Original Code is Mozilla Communicator client code,
|
||||
# released March 31, 1998.
|
||||
#
|
||||
# The Initial Developer of the Original Code is Netscape Communications
|
||||
# Corporation. Portions created by Netscape are
|
||||
# Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||
# Reserved.
|
||||
#
|
||||
# Contributors:
|
||||
# Daniel Veditz <dveditz@netscape.com>
|
||||
# Douglas Turner <dougt@netscape.com>
|
||||
|
||||
|
||||
DEPTH=..
|
||||
|
||||
DIRS= public res src
|
||||
|
||||
include <$(DEPTH)\config\rules.mak>
|
||||
33
mozilla/xpinstall/notifier/SoftwareUpdate-Source-1.rdf
Normal file
33
mozilla/xpinstall/notifier/SoftwareUpdate-Source-1.rdf
Normal file
@@ -0,0 +1,33 @@
|
||||
<RDF:RDF xmlns:RDF="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
||||
xmlns:NC="http://home.netscape.com/NC-rdf#">
|
||||
|
||||
<RDF:Bag ID="NC:SoftwareUpdateRoot">
|
||||
<RDF:li>
|
||||
<RDF:Bag ID="NC:NewSoftwareToday" NC:title="New Software">
|
||||
|
||||
<RDF:li>
|
||||
<RDF:Description ID="AimUpdate344">
|
||||
<NC:type resource="http://home.netscape.com/NC-rdf#SoftwarePackage" />
|
||||
<NC:title>AOL AIM</NC:title>
|
||||
<NC:description>An Instant Message Client</NC:description>
|
||||
<NC:version>3.4.1.12</NC:version>
|
||||
<NC:registryKey>/AOL/AIM/</NC:registryKey>
|
||||
<NC:url>http://home.netscape.com/index.html</NC:url>
|
||||
</RDF:Description>
|
||||
</RDF:li>
|
||||
|
||||
<RDF:li>
|
||||
<RDF:Description ID="PGPPlugin345">
|
||||
<NC:type resource="http://home.netscape.com/NC-rdf#SoftwarePackage" />
|
||||
<NC:title>PGP Plugin For Mozilla</NC:title>
|
||||
<NC:description>A high grade encryption plugin</NC:description>
|
||||
<NC:version>1.1.2.0</NC:version>
|
||||
<NC:registryKey>/PGP/ROCKS/</NC:registryKey>
|
||||
<NC:url>http://home.netscape.com/index.html</NC:url>
|
||||
</RDF:Description>
|
||||
</RDF:li>
|
||||
|
||||
</RDF:Bag>
|
||||
</RDF:li>
|
||||
</RDF:Bag>
|
||||
</RDF:RDF>
|
||||
57
mozilla/xpinstall/notifier/SoftwareUpdate.css
Normal file
57
mozilla/xpinstall/notifier/SoftwareUpdate.css
Normal file
@@ -0,0 +1,57 @@
|
||||
window {
|
||||
display: block;
|
||||
}
|
||||
|
||||
tree {
|
||||
display: table;
|
||||
background-color: #FFFFFF;
|
||||
border: none;
|
||||
border-spacing: 0px;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
treecol {
|
||||
display: table-column;
|
||||
width: 200px;
|
||||
}
|
||||
|
||||
treeitem {
|
||||
display: table-row;
|
||||
}
|
||||
|
||||
treehead {
|
||||
display: table-header-group;
|
||||
}
|
||||
|
||||
treebody {
|
||||
display: table-row-group;
|
||||
}
|
||||
|
||||
treecell {
|
||||
display: table-cell;
|
||||
font-family: Verdana, Sans-Serif;
|
||||
font-size: 8pt;
|
||||
}
|
||||
|
||||
treecell[selectedcell] {
|
||||
background-color: yellow;
|
||||
}
|
||||
|
||||
|
||||
treehead treeitem treecell {
|
||||
background-color: #c0c0c0;
|
||||
border: outset 1px;
|
||||
border-color: white #707070 #707070 white;
|
||||
padding-left: 4px;
|
||||
}
|
||||
|
||||
treeitem[type="http://home.netscape.com/NC-rdf#SoftwarePackage"] > treecell > titledbutton {
|
||||
list-style-image: url("resource:/res/rdf/SoftwareUpdatePackage.gif");
|
||||
}
|
||||
|
||||
treeitem[type="http://home.netscape.com/NC-rdf#Folder"] > treecell > titledbutton {
|
||||
list-style-image: url("resource:/res/rdf/bookmark-folder-closed.gif");
|
||||
|
||||
treeitem[type="http://home.netscape.com/NC-rdf#Folder"][open="true"] > treecell > titledbutton {
|
||||
list-style-image: url("resource:/res/rdf/bookmark-folder-open.gif");
|
||||
}
|
||||
123
mozilla/xpinstall/notifier/SoftwareUpdate.js
Normal file
123
mozilla/xpinstall/notifier/SoftwareUpdate.js
Normal file
@@ -0,0 +1,123 @@
|
||||
// the rdf service
|
||||
var RDF = Components.classes['component://netscape/rdf/rdf-service'].getService();
|
||||
RDF = RDF.QueryInterface(Components.interfaces.nsIRDFService);
|
||||
|
||||
function getAttr(registry,service,attr_name)
|
||||
{
|
||||
var attr = registry.GetTarget(service,
|
||||
RDF.GetResource('http://home.netscape.com/NC-rdf#' + attr_name),
|
||||
true);
|
||||
if (attr)
|
||||
attr = attr.QueryInterface(Components.interfaces.nsIRDFLiteral);
|
||||
|
||||
if (attr)
|
||||
attr = attr.Value;
|
||||
|
||||
return attr;
|
||||
}
|
||||
|
||||
function Init()
|
||||
{
|
||||
// this is the main rdf file.
|
||||
|
||||
var mainRegistry = RDF.GetDataSource('resource://res/rdf/SoftwareUpdates.rdf');
|
||||
|
||||
var mainContainer = Components.classes['component://netscape/rdf/container'].createInstance();
|
||||
mainContainer = mainContainer.QueryInterface(Components.interfaces.nsIRDFContainer);
|
||||
|
||||
mainContainer.Init(mainRegistry, RDF.GetResource('NC:SoftwareUpdateDataSources'));
|
||||
|
||||
// Now enumerate all of the softwareupdate datasources.
|
||||
var mainEnumerator = mainContainer.GetElements();
|
||||
while (mainEnumerator.HasMoreElements())
|
||||
{
|
||||
var aDistributor = mainEnumerator.GetNext();
|
||||
aDistributor = aDistributor.QueryInterface(Components.interfaces.nsIRDFResource);
|
||||
|
||||
var distributorContainer = Components.classes['component://netscape/rdf/container'].createInstance();
|
||||
distributorContainer = distributorContainer.QueryInterface(Components.interfaces.nsIRDFContainer);
|
||||
|
||||
var distributorRegistry = RDF.GetDataSource(aDistributor.Value);
|
||||
var distributorResource = RDF.GetResource('NC:SoftwareUpdateRoot');
|
||||
|
||||
distributorContainer.Init(distributorRegistry, distributorResource);
|
||||
|
||||
// Now enumerate all of the distributorContainer's packages.
|
||||
|
||||
var distributorEnumerator = distributorContainer.GetElements();
|
||||
|
||||
while (distributorEnumerator.HasMoreElements())
|
||||
{
|
||||
var aPackage = distributorEnumerator.GetNext();
|
||||
aPackage = aPackage.QueryInterface(Components.interfaces.nsIRDFResource);
|
||||
|
||||
// remove any that we do not want.
|
||||
|
||||
if (getAttr(distributorRegistry, aPackage, 'title') == "AOL AIM")
|
||||
{
|
||||
//distributorContainer.RemoveElement(aPackage, true);
|
||||
}
|
||||
}
|
||||
var tree = document.getElementById('tree');
|
||||
|
||||
// Add it to the tree control's composite datasource.
|
||||
tree.database.AddDataSource(distributorRegistry);
|
||||
|
||||
}
|
||||
|
||||
// Install all of the stylesheets in the softwareupdate Registry into the
|
||||
// panel.
|
||||
|
||||
// TODO
|
||||
|
||||
// XXX hack to force the tree to rebuild
|
||||
var treebody = document.getElementById('NC:SoftwareUpdateRoot');
|
||||
treebody.setAttribute('id', 'NC:SoftwareUpdateRoot');
|
||||
}
|
||||
|
||||
|
||||
function OpenURL(event, node)
|
||||
{
|
||||
if (node.getAttribute('type') == "http://home.netscape.com/NC-rdf#SoftwarePackage")
|
||||
{
|
||||
url = node.getAttribute('url');
|
||||
|
||||
/*window.open(url,'bookmarks');*/
|
||||
|
||||
var toolkitCore = XPAppCoresManager.Find("ToolkitCore");
|
||||
if (!toolkitCore)
|
||||
{
|
||||
toolkitCore = new ToolkitCore();
|
||||
if (toolkitCore)
|
||||
{
|
||||
toolkitCore.Init("ToolkitCore");
|
||||
}
|
||||
}
|
||||
|
||||
if (toolkitCore)
|
||||
{
|
||||
toolkitCore.ShowWindow(url,window);
|
||||
}
|
||||
|
||||
dump("OpenURL(" + url + ")\n");
|
||||
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
// To get around "window.onload" not working in viewer.
|
||||
function Boot()
|
||||
{
|
||||
var tree = document.getElementById('tree');
|
||||
if (tree == null) {
|
||||
setTimeout(Boot, 0);
|
||||
}
|
||||
else {
|
||||
Init();
|
||||
}
|
||||
}
|
||||
|
||||
setTimeout('Boot()', 0);
|
||||
|
||||
30
mozilla/xpinstall/notifier/SoftwareUpdate.xul
Normal file
30
mozilla/xpinstall/notifier/SoftwareUpdate.xul
Normal file
@@ -0,0 +1,30 @@
|
||||
<?xml version="1.0"?>
|
||||
<?xml-stylesheet href="resource:/res/rdf/sidebar.css" type="text/css"?>
|
||||
<?xml-stylesheet href="resource:/res/rdf/SoftwareUpdate.css" type="text/css"?>
|
||||
<window
|
||||
xmlns:html="http://www.w3.org/TR/REC-html40"
|
||||
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
||||
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
|
||||
|
||||
<html:script src="SoftwareUpdate.js"/>
|
||||
|
||||
<tree id="tree"
|
||||
flex="100%"
|
||||
datasources="rdf:softwareupdates"
|
||||
ondblclick="return OpenURL(event, event.target.parentNode);">
|
||||
|
||||
<treecol rdf:resource="http://home.netscape.com/NC-rdf#title" />
|
||||
<treecol rdf:resource="http://home.netscape.com/NC-rdf#description" />
|
||||
<treecol rdf:resource="http://home.netscape.com/NC-rdf#version" />
|
||||
|
||||
<treehead>
|
||||
<treeitem>
|
||||
<treecell>Title</treecell>
|
||||
<treecell>Description</treecell>
|
||||
<treecell>Version</treecell>
|
||||
</treeitem>
|
||||
</treehead>
|
||||
|
||||
<treebody id="NC:SoftwareUpdateRoot" rdf:containment="http://home.netscape.com/NC-rdf#child" />
|
||||
</tree>
|
||||
</window>
|
||||
BIN
mozilla/xpinstall/notifier/SoftwareUpdatePackage.gif
Normal file
BIN
mozilla/xpinstall/notifier/SoftwareUpdatePackage.gif
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 201 B |
7
mozilla/xpinstall/notifier/SoftwareUpdates.rdf
Normal file
7
mozilla/xpinstall/notifier/SoftwareUpdates.rdf
Normal file
@@ -0,0 +1,7 @@
|
||||
<RDF:RDF xmlns:RDF="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
||||
xmlns:NC="http://home.netscape.com/softwareupdate-schema#">
|
||||
|
||||
<RDF:Bag ID="NC:SoftwareUpdateDataSources">
|
||||
<RDF:li resource="resource:/res/rdf/SoftwareUpdate-Source-1.rdf" />
|
||||
</RDF:Bag>
|
||||
</RDF:RDF>
|
||||
6
mozilla/xpinstall/public/MANIFEST
Normal file
6
mozilla/xpinstall/public/MANIFEST
Normal file
@@ -0,0 +1,6 @@
|
||||
#
|
||||
# This is a list of local files which get copied to the mozilla:dist directory
|
||||
#
|
||||
|
||||
nsISoftwareUpdate.h
|
||||
nsSoftwareUpdateIIDs.h
|
||||
47
mozilla/xpinstall/public/Makefile.in
Normal file
47
mozilla/xpinstall/public/Makefile.in
Normal file
@@ -0,0 +1,47 @@
|
||||
#!gmake
|
||||
#
|
||||
# The contents of this file are subject to the Netscape Public License
|
||||
# Version 1.0 (the "License"); you may not use this file except in
|
||||
# compliance with the License. You may obtain a copy of the License at
|
||||
# http://www.mozilla.org/NPL/
|
||||
#
|
||||
# Software distributed under the License is distributed on an "AS IS" basis,
|
||||
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
# for the specific language governing rights and limitations under the
|
||||
# License.
|
||||
#
|
||||
# The Original Code is Mozilla Communicator client code,
|
||||
# released March 31, 1998.
|
||||
#
|
||||
# The Initial Developer of the Original Code is Netscape Communications
|
||||
# Corporation. Portions created by Netscape are
|
||||
# Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||
# Reserved.
|
||||
#
|
||||
# Contributors:
|
||||
# Daniel Veditz <dveditz@netscape.com>
|
||||
# Douglas Turner <dougt@netscape.com>
|
||||
|
||||
DEPTH = ../..
|
||||
topsrcdir = @top_srcdir@
|
||||
srcdir = @srcdir@
|
||||
VPATH = @srcdir@
|
||||
|
||||
include $(DEPTH)/config/autoconf.mk
|
||||
|
||||
MODULE = xpinstall
|
||||
|
||||
XPIDLSRCS = nsIXPInstallProgress.idl
|
||||
|
||||
EXPORTS = \
|
||||
nsIDOMInstallTriggerGlobal.h \
|
||||
nsIDOMInstallVersion.h \
|
||||
nsSoftwareUpdateIIDs.h \
|
||||
nsISoftwareUpdate.h \
|
||||
$(NULL)
|
||||
|
||||
EXPORTS := $(addprefix $(srcdir)/, $(EXPORTS))
|
||||
|
||||
include $(topsrcdir)/config/config.mk
|
||||
|
||||
include $(topsrcdir)/config/rules.mk
|
||||
113
mozilla/xpinstall/public/idl/Install.idl
Normal file
113
mozilla/xpinstall/public/idl/Install.idl
Normal file
@@ -0,0 +1,113 @@
|
||||
interface Install
|
||||
{
|
||||
/* IID: { 0x18c2f988, 0xb09f, 0x11d2, \
|
||||
{0xbc, 0xde, 0x00, 0x80, 0x5f, 0x0e, 0x13, 0x53}} */
|
||||
|
||||
const int BAD_PACKAGE_NAME = -200;
|
||||
const int UNEXPECTED_ERROR = -201;
|
||||
const int ACCESS_DENIED = -202;
|
||||
const int TOO_MANY_CERTIFICATES = -203; /* Installer file must have 1 certificate */
|
||||
const int NO_INSTALLER_CERTIFICATE = -204; /* Installer file must have a certificate */
|
||||
const int NO_CERTIFICATE = -205; /* Extracted file is not signed */
|
||||
const int NO_MATCHING_CERTIFICATE = -206; /* Extracted file does not match installer certificate */
|
||||
const int UNKNOWN_JAR_FILE = -207; /* JAR file has not been opened */
|
||||
const int INVALID_ARGUMENTS = -208; /* Bad arguments to a function */
|
||||
const int ILLEGAL_RELATIVE_PATH = -209; /* Illegal relative path */
|
||||
const int USER_CANCELLED = -210; /* User cancelled */
|
||||
const int INSTALL_NOT_STARTED = -211;
|
||||
const int SILENT_MODE_DENIED = -212;
|
||||
const int NO_SUCH_COMPONENT = -213; /* no such component in the registry. */
|
||||
const int FILE_DOES_NOT_EXIST = -214; /* File cannot be deleted as it does not exist */
|
||||
const int FILE_READ_ONLY = -215; /* File cannot be deleted as it is read only. */
|
||||
const int FILE_IS_DIRECTORY = -216; /* File cannot be deleted as it is a directory */
|
||||
const int NETWORK_FILE_IS_IN_USE = -217; /* File on the network is in-use */
|
||||
const int APPLE_SINGLE_ERR = -218; /* error in AppleSingle unpacking */
|
||||
const int INVALID_PATH_ERR = -219; /* GetFolder() did not like the folderID */
|
||||
const int PATCH_BAD_DIFF = -220; /* error in GDIFF patch */
|
||||
const int PATCH_BAD_CHECKSUM_TARGET = -221; /* source file doesn't checksum */
|
||||
const int PATCH_BAD_CHECKSUM_RESULT = -222; /* final patched file fails checksum */
|
||||
const int UNINSTALL_FAILED = -223; /* error while uninstalling a package */
|
||||
const int GESTALT_UNKNOWN_ERR = -5550;
|
||||
const int GESTALT_INVALID_ARGUMENT = -5551;
|
||||
|
||||
const int SUCCESS = 0;
|
||||
const int REBOOT_NEEDED = 999;
|
||||
|
||||
/* install types */
|
||||
const int LIMITED_INSTALL = 0;
|
||||
const int FULL_INSTALL = 1;
|
||||
const int NO_STATUS_DLG = 2;
|
||||
const int NO_FINALIZE_DLG = 4;
|
||||
|
||||
// these should not be public...
|
||||
/* message IDs*/
|
||||
const int SU_INSTALL_FILE_UNEXPECTED_MSG_ID = 0;
|
||||
const int SU_DETAILS_REPLACE_FILE_MSG_ID = 1;
|
||||
const int SU_DETAILS_INSTALL_FILE_MSG_ID = 2;
|
||||
//////////////////////////
|
||||
|
||||
readonly attribute wstring UserPackageName;
|
||||
readonly attribute wstring RegPackageName;
|
||||
|
||||
void Install();
|
||||
|
||||
void AbortInstall();
|
||||
|
||||
long AddDirectory( in wstring regName,
|
||||
in wstring version,
|
||||
in wstring jarSource,
|
||||
in InstallFolder folder,
|
||||
in wstring subdir,
|
||||
in boolean forceMode );
|
||||
|
||||
|
||||
long AddSubcomponent( in wstring regName,
|
||||
in wstring version,
|
||||
in wstring jarSource,
|
||||
in InstallFolder folder,
|
||||
in wstring targetName,
|
||||
in boolean forceMode );
|
||||
|
||||
long DeleteComponent( in wstring registryName);
|
||||
|
||||
long DeleteFile( in InstallFolder folder,
|
||||
in wstring relativeFileName );
|
||||
|
||||
long DiskSpaceAvailable( in InstallFolder folder );
|
||||
|
||||
long Execute(in wstring jarSource, in wstring args);
|
||||
|
||||
long FinalizeInstall();
|
||||
|
||||
long Gestalt (in wstring selector);
|
||||
|
||||
InstallFolder GetComponentFolder( in wstring regName,
|
||||
in wstring subdirectory);
|
||||
|
||||
InstallFolder GetFolder(in wstring targetFolder,
|
||||
in wstring subdirectory);
|
||||
|
||||
long GetLastError();
|
||||
|
||||
long GetWinProfile(in InstallFolder folder, in wstring file);
|
||||
|
||||
long GetWinRegistry();
|
||||
|
||||
long Patch( in wstring regName,
|
||||
in wstring version,
|
||||
in wstring jarSource,
|
||||
in InstallFolder folder,
|
||||
in wstring targetName );
|
||||
|
||||
void ResetError();
|
||||
|
||||
void SetPackageFolder( in InstallFolder folder );
|
||||
|
||||
long StartInstall( in wstring userPackageName,
|
||||
in wstring packageName,
|
||||
in wstring version,
|
||||
in long flags );
|
||||
|
||||
long Uninstall( in wstring packageName);
|
||||
|
||||
};
|
||||
24
mozilla/xpinstall/public/idl/InstallTrigger.idl
Normal file
24
mozilla/xpinstall/public/idl/InstallTrigger.idl
Normal file
@@ -0,0 +1,24 @@
|
||||
interface InstallTriggerGlobal
|
||||
{
|
||||
/* IID: { 0x18c2f987, 0xb09f, 0x11d2, \
|
||||
{0xbc, 0xde, 0x00, 0x80, 0x5f, 0x0e, 0x13, 0x53}} */
|
||||
|
||||
const int MAJOR_DIFF = 4;
|
||||
const int MINOR_DIFF = 3;
|
||||
const int REL_DIFF = 2;
|
||||
const int BLD_DIFF = 1;
|
||||
const int EQUAL = 0;
|
||||
|
||||
boolean UpdateEnabled ();
|
||||
|
||||
long StartSoftwareUpdate(in wstring URL);
|
||||
|
||||
long ConditionalSoftwareUpdate( in wstring URL,
|
||||
in wstring regName,
|
||||
in long diffLevel,
|
||||
in wstring version,
|
||||
in long mode);
|
||||
|
||||
long CompareVersion( in wstring regName, in wstring version );
|
||||
|
||||
};
|
||||
34
mozilla/xpinstall/public/idl/InstallVersion.idl
Normal file
34
mozilla/xpinstall/public/idl/InstallVersion.idl
Normal file
@@ -0,0 +1,34 @@
|
||||
interface InstallVersion
|
||||
{
|
||||
/* IID: { 0x18c2f986, 0xb09f, 0x11d2, \
|
||||
{0xbc, 0xde, 0x00, 0x80, 0x5f, 0x0e, 0x13, 0x53}} */
|
||||
|
||||
const int EQUAL = 0;
|
||||
const int BLD_DIFF = 1;
|
||||
const int BLD_DIFF_MINUS = -1;
|
||||
const int REL_DIFF = 2;
|
||||
const int REL_DIFF_MINUS = -2;
|
||||
const int MINOR_DIFF = 3;
|
||||
const int MINOR_DIFF_MINUS = -3;
|
||||
const int MAJOR_DIFF = 4;
|
||||
const int MAJOR_DIFF_MINUS = -4;
|
||||
|
||||
attribute int major;
|
||||
attribute int minor;
|
||||
attribute int release;
|
||||
attribute int build;
|
||||
|
||||
void InstallVersion();
|
||||
|
||||
void init(in wstring versionString);
|
||||
/*
|
||||
void init(in int major, in int minor, in int release, in int build);
|
||||
*/
|
||||
wstring toString();
|
||||
|
||||
/* int compareTo(in wstring version);
|
||||
int compareTo(in int major, in int minor, in int release, in int build);
|
||||
*/
|
||||
int compareTo(in InstallVersion versionObject);
|
||||
|
||||
};
|
||||
36
mozilla/xpinstall/public/makefile.win
Normal file
36
mozilla/xpinstall/public/makefile.win
Normal file
@@ -0,0 +1,36 @@
|
||||
#!nmake
|
||||
#
|
||||
# The contents of this file are subject to the Netscape Public License
|
||||
# Version 1.0 (the "License"); you may not use this file except in
|
||||
# compliance with the License. You may obtain a copy of the License at
|
||||
# http://www.mozilla.org/NPL/
|
||||
#
|
||||
# Software distributed under the License is distributed on an "AS IS" basis,
|
||||
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
# for the specific language governing rights and limitations under the
|
||||
# License.
|
||||
#
|
||||
# The Original Code is Mozilla Communicator client code,
|
||||
# released March 31, 1998.
|
||||
#
|
||||
# The Initial Developer of the Original Code is Netscape Communications
|
||||
# Corporation. Portions created by Netscape are
|
||||
# Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||
# Reserved.
|
||||
#
|
||||
# Contributors:
|
||||
# Daniel Veditz <dveditz@netscape.com>
|
||||
# Douglas Turner <dougt@netscape.com>
|
||||
|
||||
MODULE=xpinstall
|
||||
DEPTH=..\..
|
||||
|
||||
EXPORTS= nsIDOMInstallTriggerGlobal.h \
|
||||
nsIDOMInstallVersion.h \
|
||||
nsSoftwareUpdateIIDs.h \
|
||||
nsISoftwareUpdate.h
|
||||
|
||||
XPIDLSRCS = .\nsIXPInstallProgress.idl
|
||||
|
||||
include <$(DEPTH)\config\config.mak>
|
||||
include <$(DEPTH)\config\rules.mak>
|
||||
1
mozilla/xpinstall/public/nsIDOMInstall.h
Normal file
1
mozilla/xpinstall/public/nsIDOMInstall.h
Normal file
@@ -0,0 +1 @@
|
||||
#error
|
||||
96
mozilla/xpinstall/public/nsIDOMInstallTriggerGlobal.h
Normal file
96
mozilla/xpinstall/public/nsIDOMInstallTriggerGlobal.h
Normal file
@@ -0,0 +1,96 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public License
|
||||
* Version 1.0 (the "NPL"); you may not use this file except in
|
||||
* compliance with the NPL. You may obtain a copy of the NPL at
|
||||
* http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the NPL is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
|
||||
* for the specific language governing rights and limitations under the
|
||||
* NPL.
|
||||
*
|
||||
* The Initial Developer of this code under the NPL is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||
* Reserved.
|
||||
*/
|
||||
/* AUTO-GENERATED. DO NOT EDIT!!! */
|
||||
|
||||
#ifndef nsIDOMInstallTriggerGlobal_h__
|
||||
#define nsIDOMInstallTriggerGlobal_h__
|
||||
|
||||
#include "nsISupports.h"
|
||||
#include "nsString.h"
|
||||
#include "nsIScriptContext.h"
|
||||
|
||||
|
||||
#define NS_IDOMINSTALLTRIGGERGLOBAL_IID \
|
||||
{ 0x18c2f987, 0xb09f, 0x11d2, \
|
||||
{0xbc, 0xde, 0x00, 0x80, 0x5f, 0x0e, 0x13, 0x53}}
|
||||
|
||||
class nsIDOMInstallTriggerGlobal : public nsISupports {
|
||||
public:
|
||||
static const nsIID& IID() { static nsIID iid = NS_IDOMINSTALLTRIGGERGLOBAL_IID; return iid; }
|
||||
enum {
|
||||
MAJOR_DIFF = 4,
|
||||
MINOR_DIFF = 3,
|
||||
REL_DIFF = 2,
|
||||
BLD_DIFF = 1,
|
||||
EQUAL = 0
|
||||
};
|
||||
|
||||
NS_IMETHOD UpdateEnabled(PRBool* aReturn)=0;
|
||||
|
||||
NS_IMETHOD StartSoftwareUpdate(const nsString& aURL, PRInt32* aReturn)=0;
|
||||
NS_IMETHOD StartSoftwareUpdate(const nsString& aURL, PRInt32 aFlags, PRInt32* aReturn)=0;
|
||||
|
||||
NS_IMETHOD ConditionalSoftwareUpdate(const nsString& aURL, const nsString& aRegName, PRInt32 aDiffLevel, const nsString& aVersion, PRInt32 aMode, PRInt32* aReturn)=0;
|
||||
NS_IMETHOD ConditionalSoftwareUpdate(const nsString& aURL, const nsString& aRegName, PRInt32 aDiffLevel, nsIDOMInstallVersion* aVersion, PRInt32 aMode, PRInt32* aReturn)=0;
|
||||
NS_IMETHOD ConditionalSoftwareUpdate(const nsString& aURL, const nsString& aRegName, nsIDOMInstallVersion* aVersion, PRInt32 aMode, PRInt32* aReturn)=0;
|
||||
NS_IMETHOD ConditionalSoftwareUpdate(const nsString& aURL, const nsString& aRegName, const nsString& aVersion, PRInt32 aMode, PRInt32* aReturn)=0;
|
||||
NS_IMETHOD ConditionalSoftwareUpdate(const nsString& aURL, const nsString& aRegName, const nsString& aVersion, PRInt32* aReturn)=0;
|
||||
NS_IMETHOD ConditionalSoftwareUpdate(const nsString& aURL, const nsString& aRegName, nsIDOMInstallVersion* aVersion, PRInt32* aReturn)=0;
|
||||
|
||||
NS_IMETHOD CompareVersion(const nsString& aRegName, PRInt32 aMajor, PRInt32 aMinor, PRInt32 aRelease, PRInt32 aBuild, PRInt32* aReturn)=0;
|
||||
NS_IMETHOD CompareVersion(const nsString& aRegName, const nsString& aVersion, PRInt32* aReturn)=0;
|
||||
NS_IMETHOD CompareVersion(const nsString& aRegName, nsIDOMInstallVersion* aVersion, PRInt32* aReturn)=0;
|
||||
};
|
||||
|
||||
|
||||
#define NS_DECL_IDOMINSTALLTRIGGERGLOBAL \
|
||||
NS_IMETHOD UpdateEnabled(PRBool* aReturn); \
|
||||
NS_IMETHOD StartSoftwareUpdate(const nsString& aURL, PRInt32 aFlags, PRInt32* aReturn); \
|
||||
NS_IMETHOD StartSoftwareUpdate(const nsString& aURL, PRInt32* aReturn); \
|
||||
NS_IMETHOD ConditionalSoftwareUpdate(const nsString& aURL, const nsString& aRegName, PRInt32 aDiffLevel, const nsString& aVersion, PRInt32 aMode, PRInt32* aReturn); \
|
||||
NS_IMETHOD ConditionalSoftwareUpdate(const nsString& aURL, const nsString& aRegName, PRInt32 aDiffLevel, nsIDOMInstallVersion* aVersion, PRInt32 aMode, PRInt32* aReturn); \
|
||||
NS_IMETHOD ConditionalSoftwareUpdate(const nsString& aURL, const nsString& aRegName, nsIDOMInstallVersion* aVersion, PRInt32 aMode, PRInt32* aReturn); \
|
||||
NS_IMETHOD ConditionalSoftwareUpdate(const nsString& aURL, const nsString& aRegName, const nsString& aVersion, PRInt32 aMode, PRInt32* aReturn); \
|
||||
NS_IMETHOD ConditionalSoftwareUpdate(const nsString& aURL, const nsString& aRegName, const nsString& aVersion, PRInt32* aReturn); \
|
||||
NS_IMETHOD ConditionalSoftwareUpdate(const nsString& aURL, const nsString& aRegName, nsIDOMInstallVersion* aVersion, PRInt32* aReturn); \
|
||||
NS_IMETHOD CompareVersion(const nsString& aRegName, PRInt32 aMajor, PRInt32 aMinor, PRInt32 aRelease, PRInt32 aBuild, PRInt32* aReturn); \
|
||||
NS_IMETHOD CompareVersion(const nsString& aRegName, const nsString& aVersion, PRInt32* aReturn); \
|
||||
NS_IMETHOD CompareVersion(const nsString& aRegName, nsIDOMInstallVersion* aVersion, PRInt32* aReturn); \
|
||||
|
||||
|
||||
|
||||
#define NS_FORWARD_IDOMINSTALLTRIGGERGLOBAL(_to) \
|
||||
NS_IMETHOD UpdateEnabled(PRBool* aReturn) { return _to##UpdateEnabled(aReturn); } \
|
||||
NS_IMETHOD StartSoftwareUpdate(const nsString& aURL, PRInt32 aFlags, PRInt32* aReturn) { return _to##StartSoftwareUpdate(aURL, aFlags, aReturn); } \
|
||||
NS_IMETHOD StartSoftwareUpdate(const nsString& aURL, PRInt32* aReturn) { return _to##StartSoftwareUpdate(aURL, aReturn); } \
|
||||
NS_IMETHOD ConditionalSoftwareUpdate(const nsString& aURL, const nsString& aRegName, PRInt32 aDiffLevel, const nsString& aVersion, PRInt32 aMode, PRInt32* aReturn) { return _to##ConditionalSoftwareUpdate(aURL, aRegName, aDiffLevel, aVersion, aMode, aReturn); } \
|
||||
NS_IMETHOD ConditionalSoftwareUpdate(const nsString& aURL, const nsString& aRegName, PRInt32 aDiffLevel, nsIDOMInstallVersion* aVersion, PRInt32 aMode, PRInt32* aReturn) { return _to##ConditionalSoftwareUpdate(aURL, aRegName, aDiffLevel, aVersion, aMode, aReturn); } \
|
||||
NS_IMETHOD ConditionalSoftwareUpdate(const nsString& aURL, nsIDOMInstallVersion* aRegName, const nsString& aVersion, PRInt32 aMode, PRInt32* aReturn) { return _to##ConditionalSoftwareUpdate(aURL, aDiffLevel, aVersion, aMode, aReturn); } \
|
||||
NS_IMETHOD ConditionalSoftwareUpdate(const nsString& aURL, const nsString& aRegName, const nsString& aVersion, PRInt32 aMode, PRInt32* aReturn) { return _to##ConditionalSoftwareUpdate(aURL, aDiffLevel, aVersion, aMode, aReturn); } \
|
||||
NS_IMETHOD ConditionalSoftwareUpdate(const nsString& aURL, const nsString& aRegName, const nsString& aVersion, PRInt32* aReturn) { return _to##ConditionalSoftwareUpdate(aURL, aDiffLevel, aVersion, aReturn); } \
|
||||
NS_IMETHOD ConditionalSoftwareUpdate(const nsString& aURL, const nsString& aRegName, nsIDOMInstallVersion* aVersion, PRInt32* aReturn) { return _to##ConditionalSoftwareUpdate(aURL, aDiffLevel, aVersion, aReturn); } \
|
||||
NS_IMETHOD CompareVersion(const nsString& aRegName, PRInt32 aMajor, PRInt32 aMinor, PRInt32 aRelease, PRInt32 aBuild, PRInt32* aReturn) { return _to##CompareVersion(aRegName, aMajor, aMinor, aRelease, aBuild, aReturn); } \
|
||||
NS_IMETHOD CompareVersion(const nsString& aRegName, const nsString& aVersion, PRInt32* aReturn) { return _to##CompareVersion(aRegName, aVersion, aReturn); } \
|
||||
NS_IMETHOD CompareVersion(const nsString& aRegName, nsIDOMInstallVersion* aVersion, PRInt32* aReturn) { return _to##CompareVersion(aRegName, aVersion, aReturn); } \
|
||||
|
||||
|
||||
extern nsresult NS_InitInstallTriggerGlobalClass(nsIScriptContext *aContext, void **aPrototype);
|
||||
|
||||
extern "C" NS_DOM nsresult NS_NewScriptInstallTriggerGlobal(nsIScriptContext *aContext, nsISupports *aSupports, nsISupports *aParent, void **aReturn);
|
||||
|
||||
#endif // nsIDOMInstallTriggerGlobal_h__
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user