Compare commits
103 Commits
test_perf_
...
SOAP_20010
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
102abfaf95 | ||
|
|
303b94b230 | ||
|
|
a214bbc93b | ||
|
|
4a35edca7c | ||
|
|
84c4f735c8 | ||
|
|
ede731b482 | ||
|
|
5189d96611 | ||
|
|
3c9c87d3cd | ||
|
|
abc647b7bf | ||
|
|
514deaf34b | ||
|
|
a0bbdbe2d9 | ||
|
|
0945394e50 | ||
|
|
5e6cfecab1 | ||
|
|
6e8995843f | ||
|
|
fb1f129a33 | ||
|
|
c59d8f9d70 | ||
|
|
d507f13f1e | ||
|
|
981450bd1e | ||
|
|
c8325f0bab | ||
|
|
cdff0f18b7 | ||
|
|
aa259d79a4 | ||
|
|
d5313c3c3c | ||
|
|
760ef56127 | ||
|
|
668c500732 | ||
|
|
9b3e0d9b4a | ||
|
|
d08dfe2340 | ||
|
|
cdb804758f | ||
|
|
532b55f3a2 | ||
|
|
2e5f028235 | ||
|
|
d6b1f0b24b | ||
|
|
0b71d52a13 | ||
|
|
c4e2131b79 | ||
|
|
d3497e2e42 | ||
|
|
e2087f1048 | ||
|
|
945019d1be | ||
|
|
c23915b75e | ||
|
|
05c64c1c84 | ||
|
|
f5eacca3bf | ||
|
|
063b93702c | ||
|
|
f859df79cf | ||
|
|
4298e43fe6 | ||
|
|
8290529258 | ||
|
|
d4c9b26f98 | ||
|
|
e3fbe1306f | ||
|
|
c38912432f | ||
|
|
5e99220d9a | ||
|
|
f970f5fa83 | ||
|
|
5997698812 | ||
|
|
3cbdb694bf | ||
|
|
87a6f32dd2 | ||
|
|
3767a96323 | ||
|
|
2833b5643a | ||
|
|
36873e3a8a | ||
|
|
8038aa47fc | ||
|
|
1b8fa049b7 | ||
|
|
9b232ccf63 | ||
|
|
2ed2a24a15 | ||
|
|
fa3afd301e | ||
|
|
b5f8f8b280 | ||
|
|
2f8fb4e18e | ||
|
|
28510b8765 | ||
|
|
d1874fd390 | ||
|
|
fbb15c34df | ||
|
|
c972ffe9ba | ||
|
|
d664af31f8 | ||
|
|
f52285f36f | ||
|
|
f04bae5686 | ||
|
|
b194997c23 | ||
|
|
4b48f91a20 | ||
|
|
7c8eb29757 | ||
|
|
6a4c8c43e4 | ||
|
|
02b3b1eea4 | ||
|
|
ec9c7644b1 | ||
|
|
e935d2168c | ||
|
|
c5af273d98 | ||
|
|
30313dad10 | ||
|
|
af73391209 | ||
|
|
ccdf7fa709 | ||
|
|
89b17c4b68 | ||
|
|
f8a8ff476b | ||
|
|
0f49a6c14d | ||
|
|
d915eac613 | ||
|
|
cea595d018 | ||
|
|
ef58546285 | ||
|
|
accd0fc6f2 | ||
|
|
83cb05e038 | ||
|
|
56d1f4013d | ||
|
|
4ebd0afc6a | ||
|
|
f494eac05c | ||
|
|
b71e0fb70d | ||
|
|
5d4865dae4 | ||
|
|
e5524451bc | ||
|
|
ff9050d3f4 | ||
|
|
4be8d0eeec | ||
|
|
d080ca9d5f | ||
|
|
26f06043ba | ||
|
|
ea12749483 | ||
|
|
0ea210ce81 | ||
|
|
6741f7a847 | ||
|
|
14f3c13cc2 | ||
|
|
d485fb8f40 | ||
|
|
fb1ca8255a | ||
|
|
b356164ebc |
50
mozilla/extensions/webservices/public/nsISOAPAttachments.idl
Normal file
50
mozilla/extensions/webservices/public/nsISOAPAttachments.idl
Normal file
@@ -0,0 +1,50 @@
|
||||
/* -*- 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();
|
||||
|
||||
};
|
||||
90
mozilla/extensions/webservices/public/nsISOAPCall.idl
Normal file
90
mozilla/extensions/webservices/public/nsISOAPCall.idl
Normal file
@@ -0,0 +1,90 @@
|
||||
/* -*- 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"
|
||||
%}
|
||||
61
mozilla/extensions/webservices/public/nsISOAPDecoder.idl
Normal file
61
mozilla/extensions/webservices/public/nsISOAPDecoder.idl
Normal file
@@ -0,0 +1,61 @@
|
||||
/* -*- 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);
|
||||
};
|
||||
69
mozilla/extensions/webservices/public/nsISOAPEncoder.idl
Normal file
69
mozilla/extensions/webservices/public/nsISOAPEncoder.idl
Normal file
@@ -0,0 +1,69 @@
|
||||
/* -*- 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);
|
||||
};
|
||||
184
mozilla/extensions/webservices/public/nsISOAPEncoding.idl
Normal file
184
mozilla/extensions/webservices/public/nsISOAPEncoding.idl
Normal file
@@ -0,0 +1,184 @@
|
||||
/* -*- 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/"
|
||||
%}
|
||||
69
mozilla/extensions/webservices/public/nsISOAPFault.idl
Normal file
69
mozilla/extensions/webservices/public/nsISOAPFault.idl
Normal file
@@ -0,0 +1,69 @@
|
||||
/* -*- 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"
|
||||
%}
|
||||
96
mozilla/extensions/webservices/public/nsISOAPHeaderBlock.idl
Normal file
96
mozilla/extensions/webservices/public/nsISOAPHeaderBlock.idl
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.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"
|
||||
%}
|
||||
196
mozilla/extensions/webservices/public/nsISOAPMessage.idl
Normal file
196
mozilla/extensions/webservices/public/nsISOAPMessage.idl
Normal file
@@ -0,0 +1,196 @@
|
||||
/* -*- 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;
|
||||
};
|
||||
93
mozilla/extensions/webservices/public/nsISOAPParameter.idl
Normal file
93
mozilla/extensions/webservices/public/nsISOAPParameter.idl
Normal file
@@ -0,0 +1,93 @@
|
||||
/* -*- 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"
|
||||
%}
|
||||
63
mozilla/extensions/webservices/public/nsISOAPResponse.idl
Normal file
63
mozilla/extensions/webservices/public/nsISOAPResponse.idl
Normal file
@@ -0,0 +1,63 @@
|
||||
/* -*- 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"
|
||||
%}
|
||||
@@ -0,0 +1,61 @@
|
||||
/* -*- 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);
|
||||
};
|
||||
65
mozilla/extensions/webservices/public/nsISOAPService.idl
Normal file
65
mozilla/extensions/webservices/public/nsISOAPService.idl
Normal file
@@ -0,0 +1,65 @@
|
||||
/* -*- 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"
|
||||
%}
|
||||
@@ -0,0 +1,93 @@
|
||||
/* -*- 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"
|
||||
%}
|
||||
102
mozilla/extensions/webservices/public/nsISOAPTransport.idl
Normal file
102
mozilla/extensions/webservices/public/nsISOAPTransport.idl
Normal file
@@ -0,0 +1,102 @@
|
||||
/* -*- 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="
|
||||
%}
|
||||
@@ -0,0 +1,50 @@
|
||||
/* -*- 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);
|
||||
};
|
||||
31
mozilla/extensions/webservices/soap/Makefile.in
Normal file
31
mozilla/extensions/webservices/soap/Makefile.in
Normal file
@@ -0,0 +1,31 @@
|
||||
#
|
||||
# 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
|
||||
52
mozilla/extensions/webservices/soap/src/Makefile.in
Normal file
52
mozilla/extensions/webservices/soap/src/Makefile.in
Normal file
@@ -0,0 +1,52 @@
|
||||
#
|
||||
# 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
|
||||
1418
mozilla/extensions/webservices/soap/src/nsDefaultSOAPEncoder.cpp
Normal file
1418
mozilla/extensions/webservices/soap/src/nsDefaultSOAPEncoder.cpp
Normal file
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,34 @@
|
||||
/* -*- 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
|
||||
196
mozilla/extensions/webservices/soap/src/nsHTTPSOAPTransport.cpp
Normal file
196
mozilla/extensions/webservices/soap/src/nsHTTPSOAPTransport.cpp
Normal file
@@ -0,0 +1,196 @@
|
||||
/* -*- 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;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,50 @@
|
||||
/* -*- 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
|
||||
187
mozilla/extensions/webservices/soap/src/nsSOAPCall.cpp
Normal file
187
mozilla/extensions/webservices/soap/src/nsSOAPCall.cpp
Normal file
@@ -0,0 +1,187 @@
|
||||
/* -*- 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;
|
||||
}
|
||||
58
mozilla/extensions/webservices/soap/src/nsSOAPCall.h
Normal file
58
mozilla/extensions/webservices/soap/src/nsSOAPCall.h
Normal file
@@ -0,0 +1,58 @@
|
||||
/* -*- 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
|
||||
405
mozilla/extensions/webservices/soap/src/nsSOAPEncoding.cpp
Normal file
405
mozilla/extensions/webservices/soap/src/nsSOAPEncoding.cpp
Normal file
@@ -0,0 +1,405 @@
|
||||
/* -*- 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;
|
||||
}
|
||||
77
mozilla/extensions/webservices/soap/src/nsSOAPEncoding.h
Normal file
77
mozilla/extensions/webservices/soap/src/nsSOAPEncoding.h
Normal file
@@ -0,0 +1,77 @@
|
||||
/* -*- 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
|
||||
154
mozilla/extensions/webservices/soap/src/nsSOAPFault.cpp
Normal file
154
mozilla/extensions/webservices/soap/src/nsSOAPFault.cpp
Normal file
@@ -0,0 +1,154 @@
|
||||
/* -*- 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;
|
||||
}
|
||||
51
mozilla/extensions/webservices/soap/src/nsSOAPFault.h
Normal file
51
mozilla/extensions/webservices/soap/src/nsSOAPFault.h
Normal file
@@ -0,0 +1,51 @@
|
||||
/* -*- 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
|
||||
297
mozilla/extensions/webservices/soap/src/nsSOAPHeaderBlock.cpp
Normal file
297
mozilla/extensions/webservices/soap/src/nsSOAPHeaderBlock.cpp
Normal file
@@ -0,0 +1,297 @@
|
||||
/* -*- 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;
|
||||
}
|
||||
70
mozilla/extensions/webservices/soap/src/nsSOAPHeaderBlock.h
Normal file
70
mozilla/extensions/webservices/soap/src/nsSOAPHeaderBlock.h
Normal file
@@ -0,0 +1,70 @@
|
||||
/* -*- 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
|
||||
475
mozilla/extensions/webservices/soap/src/nsSOAPMessage.cpp
Normal file
475
mozilla/extensions/webservices/soap/src/nsSOAPMessage.cpp
Normal file
@@ -0,0 +1,475 @@
|
||||
/* -*- 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;
|
||||
}
|
||||
58
mozilla/extensions/webservices/soap/src/nsSOAPMessage.h
Normal file
58
mozilla/extensions/webservices/soap/src/nsSOAPMessage.h
Normal file
@@ -0,0 +1,58 @@
|
||||
/* -*- 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
|
||||
271
mozilla/extensions/webservices/soap/src/nsSOAPParameter.cpp
Normal file
271
mozilla/extensions/webservices/soap/src/nsSOAPParameter.cpp
Normal file
@@ -0,0 +1,271 @@
|
||||
/* -*- 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;
|
||||
}
|
||||
69
mozilla/extensions/webservices/soap/src/nsSOAPParameter.h
Normal file
69
mozilla/extensions/webservices/soap/src/nsSOAPParameter.h
Normal file
@@ -0,0 +1,69 @@
|
||||
/* -*- 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
|
||||
122
mozilla/extensions/webservices/soap/src/nsSOAPResponse.cpp
Normal file
122
mozilla/extensions/webservices/soap/src/nsSOAPResponse.cpp
Normal file
@@ -0,0 +1,122 @@
|
||||
/* -*- 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;
|
||||
}
|
||||
56
mozilla/extensions/webservices/soap/src/nsSOAPResponse.h
Normal file
56
mozilla/extensions/webservices/soap/src/nsSOAPResponse.h
Normal file
@@ -0,0 +1,56 @@
|
||||
/* -*- 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
|
||||
426
mozilla/extensions/webservices/soap/src/nsSOAPUtils.cpp
Normal file
426
mozilla/extensions/webservices/soap/src/nsSOAPUtils.cpp
Normal file
@@ -0,0 +1,426 @@
|
||||
/* -*- 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;
|
||||
}
|
||||
109
mozilla/extensions/webservices/soap/src/nsSOAPUtils.h
Normal file
109
mozilla/extensions/webservices/soap/src/nsSOAPUtils.h
Normal file
@@ -0,0 +1,109 @@
|
||||
/* -*- 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
|
||||
31
mozilla/extensions/xmlextras/soap/Makefile.in
Normal file
31
mozilla/extensions/xmlextras/soap/Makefile.in
Normal file
@@ -0,0 +1,31 @@
|
||||
#
|
||||
# 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
|
||||
26
mozilla/extensions/xmlextras/soap/makefile.win
Normal file
26
mozilla/extensions/xmlextras/soap/makefile.win
Normal file
@@ -0,0 +1,26 @@
|
||||
#!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>
|
||||
19
mozilla/extensions/xmlextras/soap/public/MANIFEST_IDL
Normal file
19
mozilla/extensions/xmlextras/soap/public/MANIFEST_IDL
Normal file
@@ -0,0 +1,19 @@
|
||||
#
|
||||
# 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
|
||||
50
mozilla/extensions/xmlextras/soap/public/Makefile.in
Normal file
50
mozilla/extensions/xmlextras/soap/public/Makefile.in
Normal file
@@ -0,0 +1,50 @@
|
||||
#
|
||||
# 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
|
||||
46
mozilla/extensions/xmlextras/soap/public/makefile.win
Normal file
46
mozilla/extensions/xmlextras/soap/public/makefile.win
Normal file
@@ -0,0 +1,46 @@
|
||||
#!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>
|
||||
|
||||
@@ -0,0 +1,50 @@
|
||||
/* -*- 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();
|
||||
|
||||
};
|
||||
90
mozilla/extensions/xmlextras/soap/public/nsISOAPCall.idl
Normal file
90
mozilla/extensions/xmlextras/soap/public/nsISOAPCall.idl
Normal file
@@ -0,0 +1,90 @@
|
||||
/* -*- 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"
|
||||
%}
|
||||
61
mozilla/extensions/xmlextras/soap/public/nsISOAPDecoder.idl
Normal file
61
mozilla/extensions/xmlextras/soap/public/nsISOAPDecoder.idl
Normal file
@@ -0,0 +1,61 @@
|
||||
/* -*- 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);
|
||||
};
|
||||
69
mozilla/extensions/xmlextras/soap/public/nsISOAPEncoder.idl
Normal file
69
mozilla/extensions/xmlextras/soap/public/nsISOAPEncoder.idl
Normal file
@@ -0,0 +1,69 @@
|
||||
/* -*- 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);
|
||||
};
|
||||
184
mozilla/extensions/xmlextras/soap/public/nsISOAPEncoding.idl
Normal file
184
mozilla/extensions/xmlextras/soap/public/nsISOAPEncoding.idl
Normal file
@@ -0,0 +1,184 @@
|
||||
/* -*- 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/"
|
||||
%}
|
||||
69
mozilla/extensions/xmlextras/soap/public/nsISOAPFault.idl
Normal file
69
mozilla/extensions/xmlextras/soap/public/nsISOAPFault.idl
Normal file
@@ -0,0 +1,69 @@
|
||||
/* -*- 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"
|
||||
%}
|
||||
@@ -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.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"
|
||||
%}
|
||||
196
mozilla/extensions/xmlextras/soap/public/nsISOAPMessage.idl
Normal file
196
mozilla/extensions/xmlextras/soap/public/nsISOAPMessage.idl
Normal file
@@ -0,0 +1,196 @@
|
||||
/* -*- 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;
|
||||
};
|
||||
@@ -0,0 +1,93 @@
|
||||
/* -*- 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"
|
||||
%}
|
||||
63
mozilla/extensions/xmlextras/soap/public/nsISOAPResponse.idl
Normal file
63
mozilla/extensions/xmlextras/soap/public/nsISOAPResponse.idl
Normal file
@@ -0,0 +1,63 @@
|
||||
/* -*- 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"
|
||||
%}
|
||||
@@ -0,0 +1,61 @@
|
||||
/* -*- 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);
|
||||
};
|
||||
65
mozilla/extensions/xmlextras/soap/public/nsISOAPService.idl
Normal file
65
mozilla/extensions/xmlextras/soap/public/nsISOAPService.idl
Normal file
@@ -0,0 +1,65 @@
|
||||
/* -*- 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"
|
||||
%}
|
||||
@@ -0,0 +1,93 @@
|
||||
/* -*- 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"
|
||||
%}
|
||||
102
mozilla/extensions/xmlextras/soap/public/nsISOAPTransport.idl
Normal file
102
mozilla/extensions/xmlextras/soap/public/nsISOAPTransport.idl
Normal file
@@ -0,0 +1,102 @@
|
||||
/* -*- 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="
|
||||
%}
|
||||
@@ -0,0 +1,50 @@
|
||||
/* -*- 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);
|
||||
};
|
||||
52
mozilla/extensions/xmlextras/soap/src/Makefile
Normal file
52
mozilla/extensions/xmlextras/soap/src/Makefile
Normal file
@@ -0,0 +1,52 @@
|
||||
#
|
||||
# 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
|
||||
52
mozilla/extensions/xmlextras/soap/src/Makefile.in
Normal file
52
mozilla/extensions/xmlextras/soap/src/Makefile.in
Normal file
@@ -0,0 +1,52 @@
|
||||
#
|
||||
# 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
|
||||
64
mozilla/extensions/xmlextras/soap/src/makefile.win
Normal file
64
mozilla/extensions/xmlextras/soap/src/makefile.win
Normal file
@@ -0,0 +1,64 @@
|
||||
#!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
|
||||
1418
mozilla/extensions/xmlextras/soap/src/nsDefaultSOAPEncoder.cpp
Normal file
1418
mozilla/extensions/xmlextras/soap/src/nsDefaultSOAPEncoder.cpp
Normal file
File diff suppressed because it is too large
Load Diff
34
mozilla/extensions/xmlextras/soap/src/nsDefaultSOAPEncoder.h
Normal file
34
mozilla/extensions/xmlextras/soap/src/nsDefaultSOAPEncoder.h
Normal file
@@ -0,0 +1,34 @@
|
||||
/* -*- 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
|
||||
196
mozilla/extensions/xmlextras/soap/src/nsHTTPSOAPTransport.cpp
Normal file
196
mozilla/extensions/xmlextras/soap/src/nsHTTPSOAPTransport.cpp
Normal file
@@ -0,0 +1,196 @@
|
||||
/* -*- 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;
|
||||
}
|
||||
|
||||
50
mozilla/extensions/xmlextras/soap/src/nsHTTPSOAPTransport.h
Normal file
50
mozilla/extensions/xmlextras/soap/src/nsHTTPSOAPTransport.h
Normal file
@@ -0,0 +1,50 @@
|
||||
/* -*- 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
|
||||
187
mozilla/extensions/xmlextras/soap/src/nsSOAPCall.cpp
Normal file
187
mozilla/extensions/xmlextras/soap/src/nsSOAPCall.cpp
Normal file
@@ -0,0 +1,187 @@
|
||||
/* -*- 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;
|
||||
}
|
||||
58
mozilla/extensions/xmlextras/soap/src/nsSOAPCall.h
Normal file
58
mozilla/extensions/xmlextras/soap/src/nsSOAPCall.h
Normal file
@@ -0,0 +1,58 @@
|
||||
/* -*- 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
|
||||
405
mozilla/extensions/xmlextras/soap/src/nsSOAPEncoding.cpp
Normal file
405
mozilla/extensions/xmlextras/soap/src/nsSOAPEncoding.cpp
Normal file
@@ -0,0 +1,405 @@
|
||||
/* -*- 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;
|
||||
}
|
||||
77
mozilla/extensions/xmlextras/soap/src/nsSOAPEncoding.h
Normal file
77
mozilla/extensions/xmlextras/soap/src/nsSOAPEncoding.h
Normal file
@@ -0,0 +1,77 @@
|
||||
/* -*- 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
|
||||
154
mozilla/extensions/xmlextras/soap/src/nsSOAPFault.cpp
Normal file
154
mozilla/extensions/xmlextras/soap/src/nsSOAPFault.cpp
Normal file
@@ -0,0 +1,154 @@
|
||||
/* -*- 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;
|
||||
}
|
||||
51
mozilla/extensions/xmlextras/soap/src/nsSOAPFault.h
Normal file
51
mozilla/extensions/xmlextras/soap/src/nsSOAPFault.h
Normal file
@@ -0,0 +1,51 @@
|
||||
/* -*- 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
|
||||
297
mozilla/extensions/xmlextras/soap/src/nsSOAPHeaderBlock.cpp
Normal file
297
mozilla/extensions/xmlextras/soap/src/nsSOAPHeaderBlock.cpp
Normal file
@@ -0,0 +1,297 @@
|
||||
/* -*- 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;
|
||||
}
|
||||
70
mozilla/extensions/xmlextras/soap/src/nsSOAPHeaderBlock.h
Normal file
70
mozilla/extensions/xmlextras/soap/src/nsSOAPHeaderBlock.h
Normal file
@@ -0,0 +1,70 @@
|
||||
/* -*- 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
|
||||
475
mozilla/extensions/xmlextras/soap/src/nsSOAPMessage.cpp
Normal file
475
mozilla/extensions/xmlextras/soap/src/nsSOAPMessage.cpp
Normal file
@@ -0,0 +1,475 @@
|
||||
/* -*- 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;
|
||||
}
|
||||
58
mozilla/extensions/xmlextras/soap/src/nsSOAPMessage.h
Normal file
58
mozilla/extensions/xmlextras/soap/src/nsSOAPMessage.h
Normal file
@@ -0,0 +1,58 @@
|
||||
/* -*- 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
|
||||
271
mozilla/extensions/xmlextras/soap/src/nsSOAPParameter.cpp
Normal file
271
mozilla/extensions/xmlextras/soap/src/nsSOAPParameter.cpp
Normal file
@@ -0,0 +1,271 @@
|
||||
/* -*- 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;
|
||||
}
|
||||
69
mozilla/extensions/xmlextras/soap/src/nsSOAPParameter.h
Normal file
69
mozilla/extensions/xmlextras/soap/src/nsSOAPParameter.h
Normal file
@@ -0,0 +1,69 @@
|
||||
/* -*- 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
|
||||
122
mozilla/extensions/xmlextras/soap/src/nsSOAPResponse.cpp
Normal file
122
mozilla/extensions/xmlextras/soap/src/nsSOAPResponse.cpp
Normal file
@@ -0,0 +1,122 @@
|
||||
/* -*- 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;
|
||||
}
|
||||
56
mozilla/extensions/xmlextras/soap/src/nsSOAPResponse.h
Normal file
56
mozilla/extensions/xmlextras/soap/src/nsSOAPResponse.h
Normal file
@@ -0,0 +1,56 @@
|
||||
/* -*- 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
|
||||
237
mozilla/extensions/xmlextras/soap/src/nsSOAPStruct.cpp
Normal file
237
mozilla/extensions/xmlextras/soap/src/nsSOAPStruct.cpp
Normal file
@@ -0,0 +1,237 @@
|
||||
/* -*- 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;
|
||||
}
|
||||
62
mozilla/extensions/xmlextras/soap/src/nsSOAPStruct.h
Normal file
62
mozilla/extensions/xmlextras/soap/src/nsSOAPStruct.h
Normal file
@@ -0,0 +1,62 @@
|
||||
/* -*- 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
|
||||
426
mozilla/extensions/xmlextras/soap/src/nsSOAPUtils.cpp
Normal file
426
mozilla/extensions/xmlextras/soap/src/nsSOAPUtils.cpp
Normal file
@@ -0,0 +1,426 @@
|
||||
/* -*- 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;
|
||||
}
|
||||
109
mozilla/extensions/xmlextras/soap/src/nsSOAPUtils.h
Normal file
109
mozilla/extensions/xmlextras/soap/src/nsSOAPUtils.h
Normal file
@@ -0,0 +1,109 @@
|
||||
/* -*- 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,248 +0,0 @@
|
||||
#
|
||||
### hostname: bl-bldlnx03.office.mozilla.org
|
||||
### uname: Linux bl-bldlnx03.office.mozilla.org 2.6.18-1.2798.fc6 #1 SMP Mon Oct 16 14:54:20 EDT 2006 i686 i686 i386 GNU/Linux
|
||||
##
|
||||
#
|
||||
#- tinder-config.pl - Tinderbox configuration file.
|
||||
#- Uncomment the variables you need to set.
|
||||
#- The default values are the same as the commented variables.
|
||||
|
||||
# $ENV{XPCOM_CC_DO_NOTHING}
|
||||
#-----------------------------------------------------------------------------
|
||||
# Default: 0
|
||||
# Values: 0 | 1
|
||||
# Purpose: Turn graydon's cycle collector on/off
|
||||
#$ENV{XPCOM_CC_DO_NOTHING} = 0;
|
||||
|
||||
# $ENV{MOZ_PACKAGE_MSI}
|
||||
#-----------------------------------------------------------------------------
|
||||
# Default: 0
|
||||
# Values: 0 | 1
|
||||
# Purpose: Controls whether a MSI package is made.
|
||||
# Requires: Windows and a local MakeMSI installation.
|
||||
#$ENV{MOZ_PACKAGE_MSI} = 0;
|
||||
|
||||
# $ENV{MOZ_SYMBOLS_TRANSFER_TYPE}
|
||||
#-----------------------------------------------------------------------------
|
||||
# Default: scp
|
||||
# Values: scp | rsync
|
||||
# Purpose: Use scp or rsync to transfer symbols to the Talkback server.
|
||||
# Requires: The selected type requires the command be available both locally
|
||||
# and on the Talkback server.
|
||||
#$ENV{MOZ_SYMBOLS_TRANSFER_TYPE} = "scp";
|
||||
|
||||
#- PLEASE FILL THIS IN WITH YOUR PROPER EMAIL ADDRESS
|
||||
#$BuildAdministrator = "$ENV{USER}\@$ENV{HOST}";
|
||||
#$BuildAdministrator = ($ENV{USER} || "cltbld") . "\@" . ($ENV{HOST} || "dhcp");
|
||||
|
||||
#- You'll need to change these to suit your machine's needs
|
||||
#$DisplayServer = ':0.0';
|
||||
|
||||
#- Default values of command-line opts
|
||||
#-
|
||||
#$BuildDepend = 1; # Depend or Clobber
|
||||
#$BuildDebug = 0; # Debug or Opt (Darwin)
|
||||
#$ReportStatus = 1; # Send results to server, or not
|
||||
#$ReportFinalStatus = 1; # Finer control over $ReportStatus.
|
||||
#$UseTimeStamp = 1; # Use the CVS 'pull-by-timestamp' option, or not
|
||||
#$BuildOnce = 0; # Build once, don't send results to server
|
||||
$TestOnly = 1; # Only run tests, don't pull/build
|
||||
#$BuildEmbed = 0; # After building seamonkey, go build embed app.
|
||||
#$SkipMozilla = 0; # Use to debug post-mozilla.pl scripts.
|
||||
#$SkipCheckout = 0; # Use to debug build process without checking out new source.
|
||||
#$BuildLocales = 0; # Do l10n packaging?
|
||||
|
||||
# Tests
|
||||
$CleanProfile = 1;
|
||||
#$ResetHomeDirForTests = 1;
|
||||
#$ProductName = "Mozilla";
|
||||
$VendorName = 'mozilla';
|
||||
|
||||
#$RunMozillaTests = 1; # Allow turning off of all tests if needed.
|
||||
$RegxpcomTest = 1;
|
||||
$AliveTest = 1;
|
||||
#$JavaTest = 0;
|
||||
#$ViewerTest = 0;
|
||||
#$BloatTest = 0; # warren memory bloat test
|
||||
#$BloatTest2 = 0; # dbaron memory bloat test, require tracemalloc
|
||||
#$DomToTextConversionTest = 0;
|
||||
#$XpcomGlueTest = 0;
|
||||
$CodesizeTest = 0; # Z, require mozilla/tools/codesighs
|
||||
$EmbedCodesizeTest = 0; # mZ, require mozilla/tools/codesigns
|
||||
#$MailBloatTest = 0;
|
||||
#$EmbedTest = 0; # Assumes you wanted $BuildEmbed=1
|
||||
$LayoutPerformanceTest = 1; # Tp
|
||||
$LayoutPerformanceLocalTest = 1; # Tp
|
||||
$DHTMLPerformanceTest = 1; # Tdhtml
|
||||
#$QATest = 0;
|
||||
$XULWindowOpenTest = 1; # Txul
|
||||
$StartupPerformanceTest = 1; # Ts
|
||||
|
||||
$TestsPhoneHome = 1; # Should test report back to server?
|
||||
$TestOnlyTinderbox = 1;
|
||||
$DownloadBuildFile = 'firefox-3.0a7pre.en-US.linux-i686.tar.bz2';
|
||||
$DownloadBuildURL = 'http://stage.mozilla.org/pub/mozilla.org/firefox/tinderbox-builds/fx-linux-tbox-trunk';
|
||||
$DownloadBuildDir = 'firefox';
|
||||
|
||||
# If TestOnlyTinderbox is enabled, fetch the latest build info from tinderbox in a
|
||||
# parseable format
|
||||
$TinderboxServerURL = 'http://tinderbox.mozilla.org/showbuilds.cgi?tree=Firefox&quickparse=1';
|
||||
$MatchBuildname = 'Linux fx-linux-tbox Depend Nightly';
|
||||
$GraphNameOverride = "bl-bldlnx03_fx-linux-tbox-HEAD"; # Override name built from ::hostname() and $BuildTag
|
||||
|
||||
# $results_server
|
||||
#----------------------------------------------------------------------------
|
||||
# Server on which test results will be accessible. This was originally tegu,
|
||||
# then became axolotl. Once we moved services from axolotl, it was time
|
||||
# to give this service its own hostname to make future transitions easier.
|
||||
# - cmp@mozilla.org
|
||||
#$results_server = "build-graphs.mozilla.org";
|
||||
|
||||
$pageload_server = "spider.office.mozilla.org";
|
||||
|
||||
#
|
||||
# Timeouts, values are in seconds.
|
||||
#
|
||||
#$CVSCheckoutTimeout = 3600;
|
||||
#$CreateProfileTimeout = 45;
|
||||
#$RegxpcomTestTimeout = 120;
|
||||
|
||||
$AliveTestTimeout = 5;
|
||||
#$ViewerTestTimeout = 45;
|
||||
#$EmbedTestTimeout = 45;
|
||||
#$BloatTestTimeout = 120; # seconds
|
||||
#$MailBloatTestTimeout = 120; # seconds
|
||||
#$JavaTestTimeout = 45;
|
||||
#$DomTestTimeout = 45; # seconds
|
||||
#$XpcomGlueTestTimeout = 15;
|
||||
#$CodesizeTestTimeout = 900; # seconds
|
||||
#$CodesizeTestType = "auto"; # {"auto"|"base"}
|
||||
#$LayoutPerformanceTestTimeout = 1200; # entire test, seconds
|
||||
#$LayoutPerformanceLocalTestTimeout = 1200; # entire test, seconds
|
||||
#$DHTMLPerformanceTestTimeout = 1200; # entire test, seconds
|
||||
#$QATestTimeout = 1200; # entire test, seconds
|
||||
#$LayoutPerformanceTestPageTimeout = 30000; # each page, ms
|
||||
#$StartupPerformanceTestTimeout = 15; # seconds
|
||||
#$XULWindowOpenTestTimeout = 150; # seconds
|
||||
|
||||
|
||||
#$MozConfigFileName = 'mozconfig';
|
||||
|
||||
#$UseMozillaProfile = 1;
|
||||
#$MozProfileName = 'default';
|
||||
|
||||
#- Set these to what makes sense for your system
|
||||
#$Make = 'gmake'; # Must be GNU make
|
||||
#$MakeOverrides = '';
|
||||
#$mail = '/bin/mail';
|
||||
#$CVS = 'cvs -q';
|
||||
#$CVSCO = 'checkout -P';
|
||||
|
||||
# win32 usually doesn't have /bin/mail
|
||||
#$blat = 'c:/nstools/bin/blat';
|
||||
#$use_blat = 0;
|
||||
|
||||
# Set moz_cvsroot to something like:
|
||||
# :pserver:$ENV{USER}%netscape.com\@cvs.mozilla.org:/cvsroot
|
||||
# :pserver:anonymous\@cvs-mirror.mozilla.org:/cvsroot
|
||||
#
|
||||
# Note that win32 may not need \@, depends on ' or ".
|
||||
# :pserver:$ENV{USER}%netscape.com@cvs.mozilla.org:/cvsroot
|
||||
|
||||
#$moz_cvsroot = $ENV{CVSROOT};
|
||||
|
||||
#- Set these proper values for your tinderbox server
|
||||
#$Tinderbox_server = 'tinderbox-daemon@tinderbox.mozilla.org';
|
||||
|
||||
# Allow for non-client builds, e.g. camino.
|
||||
#$moz_client_mk = 'client.mk';
|
||||
|
||||
#- Set if you want to build in a separate object tree
|
||||
#$ObjDir = '';
|
||||
|
||||
# Extra build name, if needed.
|
||||
$BuildNameExtra = "fx-linux-tbox perf test";
|
||||
|
||||
# User comment, eg. ip address for dhcp builds.
|
||||
# ex: $UserComment = "ip = 208.12.36.108";
|
||||
#$UserComment = 0;
|
||||
|
||||
#-
|
||||
#- The rest should not need to be changed
|
||||
#-
|
||||
|
||||
#- Minimum wait period from start of build to start of next build in minutes.
|
||||
$BuildSleep = 1;
|
||||
|
||||
#- Until you get the script working. When it works,
|
||||
#- change to the tree you're actually building
|
||||
$BuildTree = 'MozillaExperimental';
|
||||
|
||||
$BuildTag = 'HEAD';
|
||||
#$BuildConfigDir = 'mozilla/config';
|
||||
#$Topsrcdir = 'mozilla';
|
||||
|
||||
$BinaryName = 'firefox-bin';
|
||||
|
||||
#
|
||||
# For embedding app, use:
|
||||
#$EmbedBinaryName = 'TestGtkEmbed';
|
||||
#$EmbedDistDir = 'dist/bin'
|
||||
|
||||
|
||||
#$ShellOverride = ''; # Only used if the default shell is too stupid
|
||||
#$ConfigureArgs = '';
|
||||
#$ConfigureEnvArgs = '';
|
||||
#$Compiler = 'gcc';
|
||||
#$NSPRArgs = '';
|
||||
#$ShellOverride = '';
|
||||
|
||||
# Release build options
|
||||
#$ReleaseBuild = 1;
|
||||
#$clean_objdir = 1; # remove objdir when starting release cycle?
|
||||
#$clean_srcdir = 1; # remove srcdir when starting release cycle?
|
||||
#$shiptalkback = 1;
|
||||
#$ReleaseToLatest = 1; # Push the release to latest-<milestone>?
|
||||
#$ReleaseToDated = 1; # Push the release to YYYY-MM-DD-HH-<milestone>?
|
||||
#$ReleaseGroup = ''; # group to set uploaded files to
|
||||
#$build_hour = "8";
|
||||
#$package_creation_path = "/xpinstall/packager";
|
||||
# needs setting for mac + talkback: $mac_bundle_path = "/browser/app";
|
||||
#$ssh_version = "2";
|
||||
#$ssh_user = "cltbld";
|
||||
#$ssh_server = "stage.mozilla.org";
|
||||
#$ftp_path = "/home/ftp/pub/mozilla/nightly/experimental";
|
||||
#$url_path = "http://ftp.mozilla.org/pub/mozilla.org/mozilla/nightly/experimental";
|
||||
#$tbox_ftp_path = $ftp_path;
|
||||
#$tbox_url_path = $url_path;
|
||||
#$milestone = "trunk";
|
||||
#$notify_list = "cmp\@mozilla.org";
|
||||
#$stub_installer = 1;
|
||||
#$sea_installer = 1;
|
||||
#$archive = 0;
|
||||
#$push_raw_xpis = 1;
|
||||
|
||||
# Reboot the OS at the end of build-and-test cycle. This is primarily
|
||||
# intended for Win9x, which can't last more than a few cycles before
|
||||
# locking up (and testing would be suspect even after a couple of cycles).
|
||||
# Right now, there is only code to force the reboot for Win9x, so even
|
||||
# setting this to 1, will not have an effect on other platforms. Setting
|
||||
# up win9x to automatically logon and begin running tinderbox is left
|
||||
# as an exercise to the reader.
|
||||
#$RebootSystem = 0;
|
||||
|
||||
# LogCompression specifies the type of compression used on the log file.
|
||||
# Valid options are 'gzip', and 'bzip2'. Please make sure the binaries
|
||||
# for 'gzip' or 'bzip2' are in the user's path before setting this
|
||||
# option.
|
||||
#$LogCompression = '';
|
||||
|
||||
# LogEncoding specifies the encoding format used for the logs. Valid
|
||||
# options are 'base64', and 'uuencode'. If $LogCompression is set above,
|
||||
# this needs to be set to 'base64' or 'uuencode' to ensure that the
|
||||
# binary data is transferred properly.
|
||||
#$LogEncoding = '';
|
||||
|
||||
# Prevent Extension Manager from spawning child processes during tests
|
||||
# - processes that tbox scripts cannot kill.
|
||||
#$ENV{NO_EM_RESTART} = '1';
|
||||
@@ -1,250 +0,0 @@
|
||||
#
|
||||
#### hostname: bl-bldxp01.office.mozilla.org
|
||||
#### uname: CYGWIN_NT-5.1 bl-bldxp01 1.5.19(0.150/4/2) 2006-01-20 13:28 i686 Cygwin
|
||||
###
|
||||
#
|
||||
#- tinder-config.pl - Tinderbox configuration file.
|
||||
#- Uncomment the variables you need to set.
|
||||
#- The default values are the same as the commented variables.
|
||||
|
||||
# $ENV{XPCOM_CC_DO_NOTHING}
|
||||
#-----------------------------------------------------------------------------
|
||||
# Default: 0
|
||||
# Values: 0 | 1
|
||||
# Purpose: Turn graydon's cycle collector on/off
|
||||
#$ENV{XPCOM_CC_DO_NOTHING} = 0;
|
||||
|
||||
# $ENV{MOZ_PACKAGE_MSI}
|
||||
#-----------------------------------------------------------------------------
|
||||
# Default: 0
|
||||
# Values: 0 | 1
|
||||
# Purpose: Controls whether a MSI package is made.
|
||||
# Requires: Windows and a local MakeMSI installation.
|
||||
#$ENV{MOZ_PACKAGE_MSI} = 0;
|
||||
|
||||
# $ENV{MOZ_SYMBOLS_TRANSFER_TYPE}
|
||||
#-----------------------------------------------------------------------------
|
||||
# Default: scp
|
||||
# Values: scp | rsync
|
||||
# Purpose: Use scp or rsync to transfer symbols to the Talkback server.
|
||||
# Requires: The selected type requires the command be available both locally
|
||||
# and on the Talkback server.
|
||||
#$ENV{MOZ_SYMBOLS_TRANSFER_TYPE} = "scp";
|
||||
|
||||
#- PLEASE FILL THIS IN WITH YOUR PROPER EMAIL ADDRESS
|
||||
#$BuildAdministrator = "$ENV{USER}\@$ENV{HOST}";
|
||||
#$BuildAdministrator = ($ENV{USER} || "cltbld") . "\@" . ($ENV{HOST} || "dhcp");
|
||||
|
||||
#- You'll need to change these to suit your machine's needs
|
||||
#$DisplayServer = ':0.0';
|
||||
|
||||
#- Default values of command-line opts
|
||||
#-
|
||||
#$BuildDepend = 1; # Depend or Clobber
|
||||
#$BuildDebug = 0; # Debug or Opt (Darwin)
|
||||
#$ReportStatus = 1; # Send results to server, or not
|
||||
#$ReportFinalStatus = 1; # Finer control over $ReportStatus.
|
||||
#$UseTimeStamp = 1; # Use the CVS 'pull-by-timestamp' option, or not
|
||||
#$BuildOnce = 0; # Build once, don't send results to server
|
||||
$TestOnly = 1; # Only run tests, don't pull/build
|
||||
#$BuildEmbed = 0; # After building seamonkey, go build embed app.
|
||||
#$SkipMozilla = 0; # Use to debug post-mozilla.pl scripts.
|
||||
#$SkipCheckout = 0; # Use to debug build process without checking out new source.
|
||||
#$BuildLocales = 0; # Do l10n packaging?
|
||||
|
||||
# Tests
|
||||
$CleanProfile = 1;
|
||||
#$ResetHomeDirForTests = 1;
|
||||
#$ProductName = "Mozilla";
|
||||
$VendorName = 'mozilla';
|
||||
|
||||
#$RunMozillaTests = 1; # Allow turning off of all tests if needed.
|
||||
$RegxpcomTest = 0;
|
||||
$AliveTest = 1;
|
||||
#$JavaTest = 0;
|
||||
#$ViewerTest = 0;
|
||||
#$BloatTest = 0; # warren memory bloat test
|
||||
#$BloatTest2 = 0; # dbaron memory bloat test, require tracemalloc
|
||||
#$DomToTextConversionTest = 0;
|
||||
#$XpcomGlueTest = 0;
|
||||
$CodesizeTest = 0; # Z, require mozilla/tools/codesighs
|
||||
$EmbedCodesizeTest = 0; # mZ, require mozilla/tools/codesigns
|
||||
#$MailBloatTest = 0;
|
||||
#$EmbedTest = 0; # Assumes you wanted $BuildEmbed=1
|
||||
$LayoutPerformanceTest = 1; # Tp
|
||||
$LayoutPerformanceLocalTest = 1; # Tp2
|
||||
$DHTMLPerformanceTest = 1; # Tdhtml
|
||||
#$QATest = 0;
|
||||
$XULWindowOpenTest = 1; # Txul
|
||||
$StartupPerformanceTest = 1; # Ts
|
||||
|
||||
$TestsPhoneHome = 1; # Should test report back to server?
|
||||
# If TestOnlyTinderbox is enabled, fetch the latest build info from tinderbox in a
|
||||
# parseable format
|
||||
$TinderboxServerURL = 'http://tinderbox.mozilla.org/showbuilds.cgi?tree=MozillaExperimental&quickparse=1';
|
||||
$MatchBuildname = 'WINNT 5.2 fxnewref-win32- Depend Fx-Newref';
|
||||
#$GraphNameOverride = 'Fx-Trunk-win32-test1'; # Override name built from ::hostname() and $BuildTag
|
||||
|
||||
# $results_server
|
||||
#----------------------------------------------------------------------------
|
||||
# Server on which test results will be accessible. This was originally tegu,
|
||||
# then became axolotl. Once we moved services from axolotl, it was time
|
||||
# to give this service its own hostname to make future transitions easier.
|
||||
# - cmp@mozilla.org
|
||||
#$results_server = "build-graphs.mozilla.org";
|
||||
|
||||
$pageload_server = "spider.office.mozilla.org";
|
||||
|
||||
#
|
||||
# Timeouts, values are in seconds.
|
||||
#
|
||||
#$CVSCheckoutTimeout = 3600;
|
||||
#$CreateProfileTimeout = 45;
|
||||
#$RegxpcomTestTimeout = 120;
|
||||
|
||||
$AliveTestTimeout = 45;
|
||||
#$ViewerTestTimeout = 45;
|
||||
#$EmbedTestTimeout = 45;
|
||||
#$BloatTestTimeout = 120; # seconds
|
||||
#$MailBloatTestTimeout = 120; # seconds
|
||||
#$JavaTestTimeout = 45;
|
||||
#$DomTestTimeout = 45; # seconds
|
||||
#$XpcomGlueTestTimeout = 15;
|
||||
#$CodesizeTestTimeout = 900; # seconds
|
||||
#$CodesizeTestType = "auto"; # {"auto"|"base"}
|
||||
#$LayoutPerformanceTestTimeout = 1200; # entire test, seconds
|
||||
#$LayoutPerformanceLocalTestTimeout = 1200; # entire test, seconds
|
||||
#$DHTMLPerformanceTestTimeout = 1200; # entire test, seconds
|
||||
#$QATestTimeout = 1200; # entire test, seconds
|
||||
#$LayoutPerformanceTestPageTimeout = 30000; # each page, ms
|
||||
#$StartupPerformanceTestTimeout = 15; # seconds
|
||||
#$XULWindowOpenTestTimeout = 150; # seconds
|
||||
|
||||
|
||||
#$MozConfigFileName = 'mozconfig';
|
||||
|
||||
#$UseMozillaProfile = 1;
|
||||
#$MozProfileName = 'default';
|
||||
|
||||
#- Set these to what makes sense for your system
|
||||
#$Make = 'gmake'; # Must be GNU make
|
||||
#$MakeOverrides = '';
|
||||
#$mail = '/bin/mail';
|
||||
#$CVS = 'cvs -q';
|
||||
#$CVSCO = 'checkout -P';
|
||||
|
||||
# win32 usually doesn't have /bin/mail
|
||||
#$blat = 'c:/nstools/bin/blat';
|
||||
#$use_blat = 0;
|
||||
|
||||
# Set moz_cvsroot to something like:
|
||||
# :pserver:$ENV{USER}%netscape.com\@cvs.mozilla.org:/cvsroot
|
||||
# :pserver:anonymous\@cvs-mirror.mozilla.org:/cvsroot
|
||||
#
|
||||
# Note that win32 may not need \@, depends on ' or ".
|
||||
# :pserver:$ENV{USER}%netscape.com@cvs.mozilla.org:/cvsroot
|
||||
|
||||
#$moz_cvsroot = $ENV{CVSROOT};
|
||||
|
||||
#- Set these proper values for your tinderbox server
|
||||
#$Tinderbox_server = 'tinderbox-daemon@tinderbox.mozilla.org';
|
||||
|
||||
# Allow for non-client builds, e.g. camino.
|
||||
#$moz_client_mk = 'client.mk';
|
||||
|
||||
#- Set if you want to build in a separate object tree
|
||||
#$ObjDir = '';
|
||||
|
||||
# Extra build name, if needed.
|
||||
$BuildNameExtra = 'fxnewref-win32-tbox perf test';
|
||||
|
||||
# User comment, eg. ip address for dhcp builds.
|
||||
# ex: $UserComment = "ip = 208.12.36.108";
|
||||
#$UserComment = 0;
|
||||
|
||||
#-
|
||||
#- The rest should not need to be changed
|
||||
#-
|
||||
|
||||
#- Minimum wait period from start of build to start of next build in minutes.
|
||||
#$BuildSleep = 10;
|
||||
|
||||
#- Until you get the script working. When it works,
|
||||
#- change to the tree you're actually building
|
||||
$BuildTree = 'Firefox';
|
||||
|
||||
$BuildTag = 'HEAD';
|
||||
#$BuildConfigDir = 'mozilla/config';
|
||||
#$Topsrcdir = 'mozilla';
|
||||
|
||||
$BinaryName = 'firefox.exe';
|
||||
|
||||
#
|
||||
# For embedding app, use:
|
||||
#$EmbedBinaryName = 'TestGtkEmbed';
|
||||
#$EmbedDistDir = 'dist/bin'
|
||||
|
||||
|
||||
#$ShellOverride = ''; # Only used if the default shell is too stupid
|
||||
#$ConfigureArgs = '';
|
||||
#$ConfigureEnvArgs = '';
|
||||
#$Compiler = 'gcc';
|
||||
#$NSPRArgs = '';
|
||||
#$ShellOverride = '';
|
||||
|
||||
# Release build options
|
||||
#$ReleaseBuild = 1;
|
||||
#$clean_objdir = 1; # remove objdir when starting release cycle?
|
||||
#$clean_srcdir = 1; # remove srcdir when starting release cycle?
|
||||
#$shiptalkback = 1;
|
||||
#$ReleaseToLatest = 1; # Push the release to latest-<milestone>?
|
||||
#$ReleaseToDated = 1; # Push the release to YYYY-MM-DD-HH-<milestone>?
|
||||
#$ReleaseGroup = ''; # group to set uploaded files to
|
||||
#$build_hour = "8";
|
||||
#$package_creation_path = "/xpinstall/packager";
|
||||
# needs setting for mac + talkback: $mac_bundle_path = "/browser/app";
|
||||
#$ssh_version = "2";
|
||||
#$ssh_user = "cltbld";
|
||||
#$ssh_server = "stage.mozilla.org";
|
||||
#$ftp_path = "/home/ftp/pub/mozilla/nightly/experimental";
|
||||
#$url_path = "http://ftp.mozilla.org/pub/mozilla.org/mozilla/nightly/experimental";
|
||||
#$tbox_ftp_path = $ftp_path;
|
||||
#$tbox_url_path = $url_path;
|
||||
#$milestone = "trunk";
|
||||
#$notify_list = "cmp\@mozilla.org";
|
||||
#$stub_installer = 1;
|
||||
#$sea_installer = 1;
|
||||
#$archive = 0;
|
||||
#$push_raw_xpis = 1;
|
||||
|
||||
# Reboot the OS at the end of build-and-test cycle. This is primarily
|
||||
# intended for Win9x, which can't last more than a few cycles before
|
||||
# locking up (and testing would be suspect even after a couple of cycles).
|
||||
# Right now, there is only code to force the reboot for Win9x, so even
|
||||
# setting this to 1, will not have an effect on other platforms. Setting
|
||||
# up win9x to automatically logon and begin running tinderbox is left
|
||||
# as an exercise to the reader.
|
||||
#$RebootSystem = 0;
|
||||
|
||||
# LogCompression specifies the type of compression used on the log file.
|
||||
# Valid options are 'gzip', and 'bzip2'. Please make sure the binaries
|
||||
# for 'gzip' or 'bzip2' are in the user's path before setting this
|
||||
# option.
|
||||
#$LogCompression = '';
|
||||
|
||||
# LogEncoding specifies the encoding format used for the logs. Valid
|
||||
# options are 'base64', and 'uuencode'. If $LogCompression is set above,
|
||||
# this needs to be set to 'base64' or 'uuencode' to ensure that the
|
||||
# binary data is transferred properly.
|
||||
#$LogEncoding = '';
|
||||
|
||||
# Prevent Extension Manager from spawning child processes during tests
|
||||
# - processes that tbox scripts cannot kill.
|
||||
#$ENV{NO_EM_RESTART} = '1';
|
||||
# If tinderbox is running in a test-only mode, it needs to be able to download
|
||||
# the latest build and unpack it rather than building it.
|
||||
$TestOnlyTinderbox = 1;
|
||||
$DownloadBuildFile = 'firefox-3.0a8pre.en-US.win32.zip';
|
||||
$DownloadBuildURL = 'http://stage.mozilla.org/pub/mozilla.org/firefox/nightly/experimental/win32-newref/hourly-builds/latest-trunk';
|
||||
$DownloadBuildDir = 'firefox';
|
||||
|
||||
Reference in New Issue
Block a user