зеркало из https://github.com/mozilla/gecko-dev.git
Last issues for SOAP review by Heikki and others.
SOAP is not part of default build.
This commit is contained in:
Родитель
250eaf03b9
Коммит
5473c69a0f
|
@ -61,7 +61,7 @@ interface nsISOAPMessage : nsISupports {
|
|||
|
||||
const unsigned short VERSION_1_1 = 0;
|
||||
const unsigned short VERSION_1_2 = 1;
|
||||
const unsigned short VERSION_UNKNOWN = 32767;
|
||||
const unsigned short VERSION_UNKNOWN = 0xFFFF;
|
||||
|
||||
/**
|
||||
* The document which captures the message, if any. A simple
|
||||
|
|
|
@ -228,85 +228,6 @@ nsDefaultSOAPEncoder_1_2::nsDefaultSOAPEncoder_1_2() : nsSOAPEncoding(nsSOAPUtil
|
|||
}
|
||||
|
||||
// Here is the implementation of the encoders.
|
||||
static
|
||||
nsresult
|
||||
EncodeSimpleValue(nsISOAPEncoding * aEncoding,
|
||||
const nsAString & aValue,
|
||||
const nsAString & aNamespaceURI,
|
||||
const nsAString & aName,
|
||||
nsISchemaType * aSchemaType,
|
||||
nsIDOMElement * aDestination, nsIDOMElement ** _retval)
|
||||
{
|
||||
nsAutoString ns;
|
||||
nsresult rc = aEncoding->GetExternalSchemaURI(aNamespaceURI, ns);
|
||||
if (NS_FAILED(rc))
|
||||
return rc;
|
||||
nsCOMPtr < nsIDOMDocument > document;
|
||||
rc = aDestination->GetOwnerDocument(getter_AddRefs(document));
|
||||
if (NS_FAILED(rc))
|
||||
return rc;
|
||||
nsCOMPtr < nsIDOMElement > element;
|
||||
rc = document->CreateElementNS(ns, aName, getter_AddRefs(element));
|
||||
if (NS_FAILED(rc))
|
||||
return rc;
|
||||
nsCOMPtr < nsIDOMNode > ignore;
|
||||
rc = aDestination->AppendChild(element, getter_AddRefs(ignore));
|
||||
if (NS_FAILED(rc))
|
||||
return rc;
|
||||
if (aSchemaType) {
|
||||
nsAutoString name;
|
||||
rc = aSchemaType->GetName(name);
|
||||
if (NS_FAILED(rc))
|
||||
return rc;
|
||||
rc = aSchemaType->GetTargetNamespace(ns);
|
||||
if (NS_FAILED(rc))
|
||||
return rc;
|
||||
nsAutoString type;
|
||||
rc = nsSOAPUtils::MakeNamespacePrefix(aEncoding, element,
|
||||
ns, type);
|
||||
if (NS_FAILED(rc))
|
||||
return rc;
|
||||
type.Append(nsSOAPUtils::kQualifiedSeparator);
|
||||
type.Append(name);
|
||||
rc = aEncoding->GetExternalSchemaURI(nsSOAPUtils::kXSIURI, ns);
|
||||
if (NS_FAILED(rc))
|
||||
return rc;
|
||||
rc = (element)->
|
||||
SetAttributeNS(ns, nsSOAPUtils::kXSITypeAttribute, type);
|
||||
if (NS_FAILED(rc))
|
||||
return rc;
|
||||
}
|
||||
if (!aValue.IsEmpty()) {
|
||||
nsCOMPtr < nsIDOMText > text;
|
||||
rc = document->CreateTextNode(aValue, getter_AddRefs(text));
|
||||
if (NS_FAILED(rc))
|
||||
return rc;
|
||||
rc = (element)->AppendChild(text, getter_AddRefs(ignore));
|
||||
if (NS_FAILED(rc))
|
||||
return rc;
|
||||
}
|
||||
*_retval = element;
|
||||
NS_IF_ADDREF(element);
|
||||
return rc;
|
||||
}
|
||||
|
||||
// Testing for a simple value
|
||||
static nsresult HasSimpleValue(nsISchemaType * aSchemaType, PRBool * aResult) {
|
||||
PRUint16 typevalue;
|
||||
nsresult rc = aSchemaType->GetSchemaType(&typevalue);
|
||||
if (NS_FAILED(rc))
|
||||
return rc;
|
||||
if (typevalue == nsISchemaComplexType::SCHEMA_TYPE_COMPLEX) {
|
||||
nsCOMPtr<nsISchemaComplexType> ct = do_QueryInterface(aSchemaType);
|
||||
rc = ct->GetContentModel(&typevalue);
|
||||
if (NS_FAILED(rc))
|
||||
return rc;
|
||||
*aResult = typevalue == nsISchemaComplexType::CONTENT_MODEL_SIMPLE;
|
||||
} else {
|
||||
*aResult = PR_TRUE;
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
// Getting the immediate supertype of any type
|
||||
static nsresult GetSupertype(nsISOAPEncoding * aEncoding, nsISchemaType* aType, nsISchemaType** _retval)
|
||||
|
@ -523,6 +444,7 @@ static nsresult GetSupertype(nsISOAPEncoding * aEncoding, nsISchemaType* aType,
|
|||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!base) {
|
||||
|
@ -550,6 +472,122 @@ static nsresult GetSupertype(nsISOAPEncoding * aEncoding, nsISchemaType* aType,
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
static nsresult
|
||||
EncodeSimpleValue(nsISOAPEncoding * aEncoding,
|
||||
const nsAString & aValue,
|
||||
const nsAString & aNamespaceURI,
|
||||
const nsAString & aName,
|
||||
nsISchemaType * aSchemaType,
|
||||
nsIDOMElement * aDestination, nsIDOMElement ** _retval)
|
||||
{
|
||||
nsresult rc;
|
||||
nsAutoString typeName;
|
||||
nsAutoString typeNS;
|
||||
if (aSchemaType) {
|
||||
rc = aSchemaType->GetName(typeName);
|
||||
if (NS_FAILED(rc))
|
||||
return rc;
|
||||
rc = aSchemaType->GetTargetNamespace(typeNS);
|
||||
if (NS_FAILED(rc))
|
||||
return rc;
|
||||
}
|
||||
nsAutoString name; // First choose the appropriate name and namespace for the element.
|
||||
nsAutoString ns;
|
||||
if (aName.IsEmpty()) { // We automatically choose appropriate element names where none exist.
|
||||
ns = nsSOAPUtils::kSOAPEncURI;
|
||||
nsAutoString currentURI = ns;
|
||||
nsCOMPtr<nsISchemaType>currentType = aSchemaType;
|
||||
while (!(typeNS.Equals(nsSOAPUtils::kXSURI)
|
||||
|| typeNS.Equals(nsSOAPUtils::kSOAPEncURI))) {
|
||||
nsCOMPtr<nsISchemaType> supertype;
|
||||
rc = GetSupertype(aEncoding, currentType, getter_AddRefs(supertype));
|
||||
if (NS_FAILED(rc))
|
||||
return rc;
|
||||
if (!currentType) {
|
||||
currentURI = nsSOAPUtils::kXSURI;
|
||||
break;
|
||||
}
|
||||
currentType = supertype;
|
||||
rc = currentType->GetTargetNamespace(typeNS);
|
||||
if (NS_FAILED(rc))
|
||||
return rc;
|
||||
}
|
||||
if (currentType) {
|
||||
rc = aSchemaType->GetName(name);
|
||||
if (NS_FAILED(rc))
|
||||
return rc;
|
||||
}
|
||||
else {
|
||||
name = kAnyTypeSchemaType;
|
||||
}
|
||||
rc = aEncoding->GetExternalSchemaURI(nsSOAPUtils::kSOAPEncURI, ns);
|
||||
}
|
||||
else {
|
||||
name = aName;
|
||||
rc = aEncoding->GetExternalSchemaURI(aNamespaceURI, ns);
|
||||
}
|
||||
if (NS_FAILED(rc))
|
||||
return rc;
|
||||
nsCOMPtr < nsIDOMDocument > document;
|
||||
rc = aDestination->GetOwnerDocument(getter_AddRefs(document));
|
||||
if (NS_FAILED(rc))
|
||||
return rc;
|
||||
nsCOMPtr < nsIDOMElement > element;
|
||||
rc = document->CreateElementNS(ns, name, getter_AddRefs(element));
|
||||
if (NS_FAILED(rc))
|
||||
return rc;
|
||||
nsCOMPtr < nsIDOMNode > ignore;
|
||||
rc = aDestination->AppendChild(element, getter_AddRefs(ignore));
|
||||
if (NS_FAILED(rc))
|
||||
return rc;
|
||||
if (!typeName.IsEmpty()) {
|
||||
nsAutoString type;
|
||||
rc = nsSOAPUtils::MakeNamespacePrefix(aEncoding, element,
|
||||
typeNS, type);
|
||||
if (NS_FAILED(rc))
|
||||
return rc;
|
||||
type.Append(nsSOAPUtils::kQualifiedSeparator);
|
||||
type.Append(typeName);
|
||||
rc = aEncoding->GetExternalSchemaURI(nsSOAPUtils::kXSIURI, ns);
|
||||
if (NS_FAILED(rc))
|
||||
return rc;
|
||||
rc = (element)->
|
||||
SetAttributeNS(ns, nsSOAPUtils::kXSITypeAttribute, type);
|
||||
if (NS_FAILED(rc))
|
||||
return rc;
|
||||
}
|
||||
if (!aValue.IsEmpty()) {
|
||||
nsCOMPtr < nsIDOMText > text;
|
||||
rc = document->CreateTextNode(aValue, getter_AddRefs(text));
|
||||
if (NS_FAILED(rc))
|
||||
return rc;
|
||||
rc = (element)->AppendChild(text, getter_AddRefs(ignore));
|
||||
if (NS_FAILED(rc))
|
||||
return rc;
|
||||
}
|
||||
*_retval = element;
|
||||
NS_IF_ADDREF(*_retval);
|
||||
return rc;
|
||||
}
|
||||
|
||||
// Testing for a simple value
|
||||
static nsresult HasSimpleValue(nsISchemaType * aSchemaType, PRBool * aResult) {
|
||||
PRUint16 typevalue;
|
||||
nsresult rc = aSchemaType->GetSchemaType(&typevalue);
|
||||
if (NS_FAILED(rc))
|
||||
return rc;
|
||||
if (typevalue == nsISchemaComplexType::SCHEMA_TYPE_COMPLEX) {
|
||||
nsCOMPtr<nsISchemaComplexType> ct = do_QueryInterface(aSchemaType);
|
||||
rc = ct->GetContentModel(&typevalue);
|
||||
if (NS_FAILED(rc))
|
||||
return rc;
|
||||
*aResult = typevalue == nsISchemaComplexType::CONTENT_MODEL_SIMPLE;
|
||||
} else {
|
||||
*aResult = PR_TRUE;
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
// Default
|
||||
|
||||
NS_IMETHODIMP
|
||||
|
@ -941,17 +979,9 @@ NS_IMETHODIMP
|
|||
return rc;
|
||||
}
|
||||
}
|
||||
if (aName.IsEmpty()) {
|
||||
rc = EncodeSimpleValue(aEncoding, kEmpty,
|
||||
nsSOAPUtils::kSOAPEncURI,
|
||||
kStructSOAPType, aSchemaType, aDestination,
|
||||
aReturnValue);
|
||||
}
|
||||
else {
|
||||
rc = EncodeSimpleValue(aEncoding, kEmpty,
|
||||
rc = EncodeSimpleValue(aEncoding, kEmpty,
|
||||
aNamespaceURI, aName, aSchemaType, aDestination,
|
||||
aReturnValue);
|
||||
}
|
||||
if (NS_FAILED(rc))
|
||||
return rc;
|
||||
return EncodeStructParticle(aEncoding, pbptr, modelGroup, aAttachments, *aReturnValue);
|
||||
|
@ -982,12 +1012,6 @@ NS_IMETHODIMP
|
|||
rc = aSource->GetAsAString(value);
|
||||
if (NS_FAILED(rc))
|
||||
return rc;
|
||||
if (aName.IsEmpty()) {
|
||||
return EncodeSimpleValue(aEncoding, value,
|
||||
nsSOAPUtils::kSOAPEncURI,
|
||||
kAnySimpleTypeSchemaType,
|
||||
aSchemaType, aDestination, aReturnValue);
|
||||
}
|
||||
return EncodeSimpleValue(aEncoding, value,
|
||||
aNamespaceURI, aName, aSchemaType, aDestination,
|
||||
aReturnValue);
|
||||
|
@ -1067,8 +1091,8 @@ static nsresult GetArrayType(nsIVariant* aSource, PRUint32 aDimensionCount, PRUi
|
|||
PRUint64 tot = 1; // Collect in 64 bits, just to make sure combo fits
|
||||
for (i = 0; i < aDimensionCount; i++) {
|
||||
tot = tot * aDimensionSizes[i];
|
||||
if (tot > 4294967295U) {
|
||||
return SOAP_EXCEPTION(NS_ERROR_ILLEGAL_VALUE,"SOAP_ARRAY_TOO_BIG","When encoding an object as an array, the items exceeded 4294967295");
|
||||
if (tot > 0xffffffffU) {
|
||||
return SOAP_EXCEPTION(NS_ERROR_ILLEGAL_VALUE,"SOAP_ARRAY_TOO_BIG","When encoding an object as an array, the total count of items exceeded maximum.");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1345,15 +1369,9 @@ NS_IMETHODIMP
|
|||
if (NS_FAILED(rc))
|
||||
return rc;
|
||||
}
|
||||
if (aName.IsEmpty()) { // Now create the element to hold the array
|
||||
rc = EncodeSimpleValue(aEncoding, kEmpty,
|
||||
nsSOAPUtils::kSOAPEncURI,
|
||||
kArraySOAPType, aSchemaType, aDestination, aReturnValue);
|
||||
} else {
|
||||
rc = EncodeSimpleValue(aEncoding, kEmpty,
|
||||
aNamespaceURI,
|
||||
aName, aSchemaType, aDestination, aReturnValue);
|
||||
}
|
||||
rc = EncodeSimpleValue(aEncoding, kEmpty,
|
||||
aNamespaceURI,
|
||||
aName, aSchemaType, aDestination, aReturnValue);
|
||||
if (NS_FAILED(rc))
|
||||
return rc;
|
||||
|
||||
|
@ -1411,12 +1429,6 @@ NS_IMETHODIMP
|
|||
rc = aSource->GetAsAString(value);
|
||||
if (NS_FAILED(rc))
|
||||
return rc;
|
||||
if (aName.IsEmpty()) {
|
||||
return EncodeSimpleValue(aEncoding, value,
|
||||
nsSOAPUtils::kSOAPEncURI,
|
||||
kStringSchemaType,
|
||||
aSchemaType, aDestination, aReturnValue);
|
||||
}
|
||||
return EncodeSimpleValue(aEncoding, value,
|
||||
aNamespaceURI, aName, aSchemaType, aDestination,
|
||||
aReturnValue);
|
||||
|
@ -1445,13 +1457,6 @@ NS_IMETHODIMP
|
|||
rc = aSource->GetAsBool(&b);
|
||||
if (NS_FAILED(rc))
|
||||
return rc;
|
||||
if (aName.IsEmpty()) {
|
||||
return EncodeSimpleValue(aEncoding, b ? nsSOAPUtils::kTrueA : nsSOAPUtils::
|
||||
kFalseA,
|
||||
nsSOAPUtils::kSOAPEncURI,
|
||||
kBooleanSchemaType, aSchemaType, aDestination,
|
||||
aReturnValue);
|
||||
}
|
||||
return EncodeSimpleValue(aEncoding, b ? nsSOAPUtils::kTrueA : nsSOAPUtils::kFalseA,
|
||||
aNamespaceURI, aName, aSchemaType, aDestination,
|
||||
aReturnValue);
|
||||
|
@ -1486,12 +1491,6 @@ NS_IMETHODIMP
|
|||
nsAutoString value;
|
||||
CopyASCIItoUCS2(nsDependentCString(ptr), value);
|
||||
PR_smprintf_free(ptr);
|
||||
if (aName.IsEmpty()) {
|
||||
return EncodeSimpleValue(aEncoding, value,
|
||||
nsSOAPUtils::kSOAPEncURI,
|
||||
kDoubleSchemaType,
|
||||
aSchemaType, aDestination, aReturnValue);
|
||||
}
|
||||
return EncodeSimpleValue(aEncoding, value,
|
||||
aNamespaceURI, aName, aSchemaType, aDestination,
|
||||
aReturnValue);
|
||||
|
@ -1526,11 +1525,6 @@ NS_IMETHODIMP
|
|||
nsAutoString value;
|
||||
CopyASCIItoUCS2(nsDependentCString(ptr), value);
|
||||
PR_smprintf_free(ptr);
|
||||
if (aName.IsEmpty()) {
|
||||
return EncodeSimpleValue(aEncoding, value,
|
||||
nsSOAPUtils::kSOAPEncURI,
|
||||
kFloatSchemaType, aSchemaType, aDestination, aReturnValue);
|
||||
}
|
||||
return EncodeSimpleValue(aEncoding, value,
|
||||
aNamespaceURI, aName, aSchemaType, aDestination,
|
||||
aReturnValue);
|
||||
|
@ -1565,11 +1559,6 @@ NS_IMETHODIMP
|
|||
nsAutoString value;
|
||||
CopyASCIItoUCS2(nsDependentCString(ptr), value);
|
||||
PR_smprintf_free(ptr);
|
||||
if (aName.IsEmpty()) {
|
||||
return EncodeSimpleValue(aEncoding, value,
|
||||
nsSOAPUtils::kSOAPEncURI,
|
||||
kLongSchemaType, aSchemaType, aDestination, aReturnValue);
|
||||
}
|
||||
return EncodeSimpleValue(aEncoding, value,
|
||||
aNamespaceURI, aName, aSchemaType, aDestination,
|
||||
aReturnValue);
|
||||
|
@ -1604,11 +1593,6 @@ NS_IMETHODIMP
|
|||
nsAutoString value;
|
||||
CopyASCIItoUCS2(nsDependentCString(ptr), value);
|
||||
PR_smprintf_free(ptr);
|
||||
if (aName.IsEmpty()) {
|
||||
return EncodeSimpleValue(aEncoding, value,
|
||||
nsSOAPUtils::kSOAPEncURI,
|
||||
kIntSchemaType, aSchemaType, aDestination, aReturnValue);
|
||||
}
|
||||
return EncodeSimpleValue(aEncoding, value,
|
||||
aNamespaceURI, aName, aSchemaType, aDestination,
|
||||
aReturnValue);
|
||||
|
@ -1643,11 +1627,6 @@ NS_IMETHODIMP
|
|||
nsAutoString value;
|
||||
CopyASCIItoUCS2(nsDependentCString(ptr), value);
|
||||
PR_smprintf_free(ptr);
|
||||
if (aName.IsEmpty()) {
|
||||
return EncodeSimpleValue(aEncoding, value,
|
||||
nsSOAPUtils::kSOAPEncURI,
|
||||
kShortSchemaType, aSchemaType, aDestination, aReturnValue);
|
||||
}
|
||||
return EncodeSimpleValue(aEncoding, value,
|
||||
aNamespaceURI, aName, aSchemaType, aDestination,
|
||||
aReturnValue);
|
||||
|
@ -1682,11 +1661,6 @@ NS_IMETHODIMP
|
|||
nsAutoString value;
|
||||
CopyASCIItoUCS2(nsDependentCString(ptr), value);
|
||||
PR_smprintf_free(ptr);
|
||||
if (aName.IsEmpty()) {
|
||||
return EncodeSimpleValue(aEncoding, value,
|
||||
nsSOAPUtils::kSOAPEncURI,
|
||||
kByteSchemaType, aSchemaType, aDestination, aReturnValue);
|
||||
}
|
||||
return EncodeSimpleValue(aEncoding, value,
|
||||
aNamespaceURI, aName, aSchemaType, aDestination,
|
||||
aReturnValue);
|
||||
|
@ -1721,11 +1695,6 @@ NS_IMETHODIMP
|
|||
nsAutoString value;
|
||||
CopyASCIItoUCS2(nsDependentCString(ptr), value);
|
||||
PR_smprintf_free(ptr);
|
||||
if (aName.IsEmpty()) {
|
||||
return EncodeSimpleValue(aEncoding, value,
|
||||
nsSOAPUtils::kSOAPEncURI,
|
||||
kLongSchemaType, aSchemaType, aDestination, aReturnValue);
|
||||
}
|
||||
return EncodeSimpleValue(aEncoding, value,
|
||||
aNamespaceURI, aName, aSchemaType, aDestination,
|
||||
aReturnValue);
|
||||
|
@ -1760,11 +1729,6 @@ NS_IMETHODIMP
|
|||
nsAutoString value;
|
||||
CopyASCIItoUCS2(nsDependentCString(ptr), value);
|
||||
PR_smprintf_free(ptr);
|
||||
if (aName.IsEmpty()) {
|
||||
return EncodeSimpleValue(aEncoding, value,
|
||||
nsSOAPUtils::kSOAPEncURI,
|
||||
kIntSchemaType, aSchemaType, aDestination, aReturnValue);
|
||||
}
|
||||
return EncodeSimpleValue(aEncoding, value,
|
||||
aNamespaceURI, aName, aSchemaType, aDestination,
|
||||
aReturnValue);
|
||||
|
@ -1799,11 +1763,6 @@ NS_IMETHODIMP
|
|||
nsAutoString value;
|
||||
CopyASCIItoUCS2(nsDependentCString(ptr), value);
|
||||
PR_smprintf_free(ptr);
|
||||
if (aName.IsEmpty()) {
|
||||
return EncodeSimpleValue(aEncoding, value,
|
||||
nsSOAPUtils::kSOAPEncURI,
|
||||
kShortSchemaType, aSchemaType, aDestination, aReturnValue);
|
||||
}
|
||||
return EncodeSimpleValue(aEncoding, value,
|
||||
aNamespaceURI, aName, aSchemaType, aDestination,
|
||||
aReturnValue);
|
||||
|
@ -1838,11 +1797,6 @@ NS_IMETHODIMP
|
|||
nsAutoString value;
|
||||
CopyASCIItoUCS2(nsDependentCString(ptr), value);
|
||||
PR_smprintf_free(ptr);
|
||||
if (aName.IsEmpty()) {
|
||||
return EncodeSimpleValue(aEncoding, value,
|
||||
nsSOAPUtils::kSOAPEncURI,
|
||||
kByteSchemaType, aSchemaType, aDestination, aReturnValue);
|
||||
}
|
||||
return EncodeSimpleValue(aEncoding, value,
|
||||
aNamespaceURI, aName, aSchemaType, aDestination,
|
||||
aReturnValue);
|
||||
|
@ -2403,12 +2357,12 @@ static PRUint32 DecodeArrayDimensions(const nsAString& src, PRInt32* aDimensionS
|
|||
&& *(--i2) <= ' ') // In XML, all valid characters <= space are the only whitespace
|
||||
;
|
||||
if (*i2 != ']') { // In this case, not an array dimension
|
||||
int len = Distance(i1, i2) - 1; // This is the size to truncate to at the end.
|
||||
PRInt32 len = Distance(i1, i2) - 1; // This is the size to truncate to at the end.
|
||||
src.Left(dst, len); // Truncate the string.
|
||||
return 0; // Eliminated white space.
|
||||
}
|
||||
|
||||
int dimensionCount = 1; // Counting the dimensions
|
||||
PRInt32 dimensionCount = 1; // Counting the dimensions
|
||||
for (;;) { // First look for the matching bracket from reverse and commas.
|
||||
if (i1 == i2) { // No matching bracket.
|
||||
return 0;
|
||||
|
@ -2421,7 +2375,7 @@ static PRUint32 DecodeArrayDimensions(const nsAString& src, PRInt32* aDimensionS
|
|||
dimensionCount++;
|
||||
}
|
||||
}
|
||||
int len;
|
||||
PRInt32 len;
|
||||
{
|
||||
nsReadingIterator < PRUnichar > i3 = i2++; // Cover any extra white space
|
||||
while (i1 != i3) { // Loop past white space
|
||||
|
@ -2629,8 +2583,8 @@ NS_IMETHODIMP
|
|||
break;
|
||||
}
|
||||
tot = tot * next;
|
||||
if (tot > 2147483647) {
|
||||
return SOAP_EXCEPTION(NS_ERROR_ILLEGAL_VALUE,"SOAP_ARRAY_TOO_BIG","When encoding an object as an array, the items exceeded 2147483647");
|
||||
if (tot > 0x7fffffff) {
|
||||
return SOAP_EXCEPTION(NS_ERROR_ILLEGAL_VALUE,"SOAP_ARRAY_TOO_BIG","When decoding an object as an array, the total count of items exceeded maximum.");
|
||||
}
|
||||
}
|
||||
size = (PRInt32)tot;
|
||||
|
@ -2794,8 +2748,8 @@ NS_IMETHODIMP
|
|||
dimensionSizes[i] = next = pp[i];
|
||||
}
|
||||
tot = tot * next;
|
||||
if (tot > 2147483647) {
|
||||
return SOAP_EXCEPTION(NS_ERROR_ILLEGAL_VALUE,"SOAP_ARRAY_TOO_BIG","More than 2147483647 items found to go in array.");
|
||||
if (tot > 0x7fffffff) {
|
||||
return SOAP_EXCEPTION(NS_ERROR_ILLEGAL_VALUE,"SOAP_ARRAY_TOO_BIG","When decoding an object as an array, the total count of items exceeded maximum.");
|
||||
}
|
||||
}
|
||||
size = (PRInt32)tot; // At last, we know the dimensions of the array.
|
||||
|
@ -2977,8 +2931,8 @@ NS_IMETHODIMP
|
|||
if (NS_FAILED(rc))
|
||||
return rc;
|
||||
double f;
|
||||
unsigned int n;
|
||||
int r = PR_sscanf(NS_ConvertUCS2toUTF8(value).get(), " %lf %n", &f, &n);
|
||||
PRUint32 n;
|
||||
PRInt32 r = PR_sscanf(NS_ConvertUCS2toUTF8(value).get(), " %lf %n", &f, &n);
|
||||
if (r == 0 || n < value.Length())
|
||||
return SOAP_EXCEPTION(NS_ERROR_ILLEGAL_VALUE,"SOAP_ILLEGAL_DOUBLE","Illegal value discovered for double");
|
||||
|
||||
|
@ -3008,8 +2962,8 @@ NS_IMETHODIMP
|
|||
if (NS_FAILED(rc))
|
||||
return rc;
|
||||
float f;
|
||||
unsigned int n;
|
||||
int r = PR_sscanf(NS_ConvertUCS2toUTF8(value).get(), " %f %n", &f, &n);
|
||||
PRUint32 n;
|
||||
PRInt32 r = PR_sscanf(NS_ConvertUCS2toUTF8(value).get(), " %f %n", &f, &n);
|
||||
if (r == 0 || n < value.Length())
|
||||
return SOAP_EXCEPTION(NS_ERROR_ILLEGAL_VALUE,"SOAP_ILLEGAL_FLOAT","Illegal value discovered for float");
|
||||
|
||||
|
@ -3039,8 +2993,8 @@ NS_IMETHODIMP
|
|||
if (NS_FAILED(rc))
|
||||
return rc;
|
||||
PRInt64 f;
|
||||
unsigned int n;
|
||||
int r = PR_sscanf(NS_ConvertUCS2toUTF8(value).get(), " %lld %n", &f, &n);
|
||||
PRUint32 n;
|
||||
PRInt32 r = PR_sscanf(NS_ConvertUCS2toUTF8(value).get(), " %lld %n", &f, &n);
|
||||
if (r == 0 || n < value.Length())
|
||||
return SOAP_EXCEPTION(NS_ERROR_ILLEGAL_VALUE,"SOAP_ILLEGAL_LONG","Illegal value discovered for long");
|
||||
|
||||
|
@ -3070,8 +3024,8 @@ NS_IMETHODIMP
|
|||
if (NS_FAILED(rc))
|
||||
return rc;
|
||||
PRInt32 f;
|
||||
unsigned int n;
|
||||
int r = PR_sscanf(NS_ConvertUCS2toUTF8(value).get(), " %ld %n", &f, &n);
|
||||
PRUint32 n;
|
||||
PRInt32 r = PR_sscanf(NS_ConvertUCS2toUTF8(value).get(), " %ld %n", &f, &n);
|
||||
if (r == 0 || n < value.Length())
|
||||
return SOAP_EXCEPTION(NS_ERROR_ILLEGAL_VALUE,"SOAP_ILLEGAL_INT","Illegal value discovered for int");
|
||||
|
||||
|
@ -3101,8 +3055,8 @@ NS_IMETHODIMP
|
|||
if (NS_FAILED(rc))
|
||||
return rc;
|
||||
PRInt16 f;
|
||||
unsigned int n;
|
||||
int r = PR_sscanf(NS_ConvertUCS2toUTF8(value).get(), " %hd %n", &f, &n);
|
||||
PRUint32 n;
|
||||
PRInt32 r = PR_sscanf(NS_ConvertUCS2toUTF8(value).get(), " %hd %n", &f, &n);
|
||||
if (r == 0 || n < value.Length())
|
||||
return SOAP_EXCEPTION(NS_ERROR_ILLEGAL_VALUE,"SOAP_ILLEGAL_SHORT","Illegal value discovered for short");
|
||||
|
||||
|
@ -3132,8 +3086,8 @@ NS_IMETHODIMP
|
|||
if (NS_FAILED(rc))
|
||||
return rc;
|
||||
PRInt16 f;
|
||||
unsigned int n;
|
||||
int r = PR_sscanf(NS_ConvertUCS2toUTF8(value).get(), " %hd %n", &f, &n);
|
||||
PRUint32 n;
|
||||
PRInt32 r = PR_sscanf(NS_ConvertUCS2toUTF8(value).get(), " %hd %n", &f, &n);
|
||||
if (r == 0 || n < value.Length() || f < -128 || f > 127)
|
||||
return SOAP_EXCEPTION(NS_ERROR_ILLEGAL_VALUE,"SOAP_ILLEGAL_BYTE","Illegal value discovered for byte");
|
||||
|
||||
|
@ -3163,8 +3117,8 @@ NS_IMETHODIMP
|
|||
if (NS_FAILED(rc))
|
||||
return rc;
|
||||
PRUint64 f;
|
||||
unsigned int n;
|
||||
int r = PR_sscanf(NS_ConvertUCS2toUTF8(value).get(), " %llu %n", &f, &n);
|
||||
PRUint32 n;
|
||||
PRInt32 r = PR_sscanf(NS_ConvertUCS2toUTF8(value).get(), " %llu %n", &f, &n);
|
||||
if (r == 0 || n < value.Length())
|
||||
return SOAP_EXCEPTION(NS_ERROR_ILLEGAL_VALUE,"SOAP_ILLEGAL_ULONG","Illegal value discovered for unsigned long");
|
||||
|
||||
|
@ -3194,8 +3148,8 @@ NS_IMETHODIMP
|
|||
if (NS_FAILED(rc))
|
||||
return rc;
|
||||
PRUint32 f;
|
||||
unsigned int n;
|
||||
int r = PR_sscanf(NS_ConvertUCS2toUTF8(value).get(), " %lu %n", &f, &n);
|
||||
PRUint32 n;
|
||||
PRInt32 r = PR_sscanf(NS_ConvertUCS2toUTF8(value).get(), " %lu %n", &f, &n);
|
||||
if (r == 0 || n < value.Length())
|
||||
return SOAP_EXCEPTION(NS_ERROR_ILLEGAL_VALUE,"SOAP_ILLEGAL_UINT","Illegal value discovered for unsigned int");
|
||||
|
||||
|
@ -3225,8 +3179,8 @@ NS_IMETHODIMP
|
|||
if (NS_FAILED(rc))
|
||||
return rc;
|
||||
PRUint16 f;
|
||||
unsigned int n;
|
||||
int r = PR_sscanf(NS_ConvertUCS2toUTF8(value).get(), " %hu %n", &f, &n);
|
||||
PRUint32 n;
|
||||
PRInt32 r = PR_sscanf(NS_ConvertUCS2toUTF8(value).get(), " %hu %n", &f, &n);
|
||||
if (r == 0 || n < value.Length())
|
||||
return SOAP_EXCEPTION(NS_ERROR_ILLEGAL_VALUE,"SOAP_ILLEGAL_USHORT","Illegal value discovered for unsigned short");
|
||||
|
||||
|
@ -3256,8 +3210,8 @@ NS_IMETHODIMP
|
|||
if (NS_FAILED(rc))
|
||||
return rc;
|
||||
PRUint16 f;
|
||||
unsigned int n;
|
||||
int r = PR_sscanf(NS_ConvertUCS2toUTF8(value).get(), " %hu %n", &f, &n);
|
||||
PRUint32 n;
|
||||
PRInt32 r = PR_sscanf(NS_ConvertUCS2toUTF8(value).get(), " %hu %n", &f, &n);
|
||||
if (r == 0 || n < value.Length() || f > 255)
|
||||
return SOAP_EXCEPTION(NS_ERROR_ILLEGAL_VALUE,"SOAP_ILLEGAL_UBYTE","Illegal value discovered for unsigned byte");
|
||||
|
||||
|
|
|
@ -131,14 +131,14 @@ static nsresult GetTransportURI(nsISOAPCall * aCall, nsAString & aURI)
|
|||
if (NS_FAILED(rc))
|
||||
return rc;
|
||||
if (!principal) {
|
||||
return NS_ERROR_FAILURE; // There must be a principal to send a source-verified message.
|
||||
return SOAP_EXCEPTION(NS_ERROR_FAILURE,"SOAP_INVOKE_VERIFY_PRINCIPAL", "Source-verified message cannot be sent without principal.");
|
||||
}
|
||||
nsCOMPtr<nsICodebasePrincipal> codebase = do_QueryInterface(principal,&rc);
|
||||
if (NS_FAILED(rc))
|
||||
return rc;
|
||||
|
||||
if (!codebase) {
|
||||
return NS_ERROR_FAILURE; // There must be a principal to send a source-verified message.
|
||||
return SOAP_EXCEPTION(NS_ERROR_FAILURE,"SOAP_INVOKE_VERIFY_CODEBASE", "Source-verified message cannot be sent without codebase.");
|
||||
}
|
||||
|
||||
char* str;
|
||||
|
@ -158,7 +158,7 @@ static nsresult GetTransportURI(nsISOAPCall * aCall, nsAString & aURI)
|
|||
if (NS_FAILED(rc))
|
||||
return rc;
|
||||
if (!element)
|
||||
return NS_ERROR_FAILURE;
|
||||
return SOAP_EXCEPTION(NS_ERROR_FAILURE,"SOAP_INVOKE_VERIFY_HEADER", "Source-verified message cannot be sent without a header.");
|
||||
// Node ignored on remove / append calls
|
||||
nsCOMPtr<nsIDOMNode> ignore;
|
||||
// Remove any existing elements that may conflict with this verifySource identification
|
||||
|
@ -265,14 +265,14 @@ NS_IMETHODIMP nsHTTPSOAPTransport::SyncCall(nsISOAPCall * aCall, nsISOAPResponse
|
|||
if (NS_FAILED(rv))
|
||||
return rv;
|
||||
if (!messageDocument)
|
||||
return NS_ERROR_NOT_INITIALIZED;
|
||||
return SOAP_EXCEPTION(NS_ERROR_NOT_INITIALIZED,"SOAP_MESSAGE_DOCUMENT", "No message document is present.");
|
||||
|
||||
nsAutoString uri;
|
||||
rv = GetTransportURI(aCall, uri);
|
||||
if (NS_FAILED(rv))
|
||||
return rv;
|
||||
if (AStringIsNull(uri))
|
||||
return NS_ERROR_NOT_INITIALIZED;
|
||||
return SOAP_EXCEPTION(NS_ERROR_NOT_INITIALIZED,"SOAP_TRANSPORT_URI", "No transport URI was specified.");
|
||||
|
||||
DEBUG_DUMP_DOCUMENT("Synchronous Request", messageDocument)
|
||||
|
||||
|
@ -457,7 +457,7 @@ NS_IMETHODIMP
|
|||
if (NS_FAILED(rv))
|
||||
return rv;
|
||||
if (!messageDocument)
|
||||
return NS_ERROR_NOT_INITIALIZED;
|
||||
return SOAP_EXCEPTION(NS_ERROR_NOT_INITIALIZED,"SOAP_MESSAGE_DOCUMENT", "No message document is present.");
|
||||
|
||||
request = do_CreateInstance(NS_XMLHTTPREQUEST_CONTRACTID, &rv);
|
||||
if (NS_FAILED(rv))
|
||||
|
@ -473,7 +473,7 @@ NS_IMETHODIMP
|
|||
if (NS_FAILED(rv))
|
||||
return rv;
|
||||
if (AStringIsNull(uri))
|
||||
return NS_ERROR_NOT_INITIALIZED;
|
||||
return SOAP_EXCEPTION(NS_ERROR_NOT_INITIALIZED,"SOAP_TRANSPORT_URI", "No transport URI was specified.");
|
||||
|
||||
DEBUG_DUMP_DOCUMENT("Asynchronous Request", messageDocument)
|
||||
rv = request->OpenRequest("POST", NS_ConvertUCS2toUTF8(uri).get(),
|
||||
|
|
|
@ -43,6 +43,7 @@
|
|||
#include "nsIServiceManager.h"
|
||||
#include "nsISOAPAttachments.h"
|
||||
#include "nsISOAPMessage.h"
|
||||
#include "nsSOAPException.h"
|
||||
|
||||
nsSOAPBlock::nsSOAPBlock()
|
||||
{
|
||||
|
@ -63,7 +64,7 @@ NS_IMETHODIMP nsSOAPBlock::Init(nsISOAPAttachments * aAttachments,
|
|||
mVersion = aVersion;
|
||||
return NS_OK;
|
||||
}
|
||||
return NS_ERROR_ILLEGAL_VALUE;
|
||||
return SOAP_EXCEPTION(NS_ERROR_ILLEGAL_VALUE,"SOAP_BAD_VERSION", "Bad version used to initialize block.");
|
||||
}
|
||||
|
||||
/* attribute AString namespaceURI; */
|
||||
|
@ -177,7 +178,7 @@ NS_IMETHODIMP nsSOAPBlock::GetValue(nsIVariant * *aValue)
|
|||
mEncoding->Decode(mElement, mSchemaType, mAttachments,
|
||||
getter_AddRefs(mValue));
|
||||
} else {
|
||||
mStatus = NS_ERROR_NOT_INITIALIZED;
|
||||
mStatus = SOAP_EXCEPTION(NS_ERROR_NOT_INITIALIZED,"SOAP_NO_ENCODING","No encoding found to decode block.");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -202,19 +203,24 @@ NS_IMETHODIMP
|
|||
|
||||
// Get the arguments.
|
||||
|
||||
nsCOMPtr < nsIVariant > value;
|
||||
|
||||
nsAutoString name;
|
||||
nsAutoString namespaceURI;
|
||||
nsCOMPtr < nsISupports > schemaType;
|
||||
nsCOMPtr < nsISupports > encoding;
|
||||
nsIVariant* s1 = nsnull;
|
||||
nsISupports* s2 = nsnull;
|
||||
nsISupports* s3 = nsnull;
|
||||
|
||||
if (!JS_ConvertArguments(cx, argc, argv, "/%iv %is %is %ip %ip",
|
||||
getter_AddRefs(value),
|
||||
&s1,
|
||||
NS_STATIC_CAST(nsAString *, &name),
|
||||
NS_STATIC_CAST(nsAString *, &namespaceURI),
|
||||
getter_AddRefs(schemaType),
|
||||
getter_AddRefs(encoding)))
|
||||
return NS_ERROR_ILLEGAL_VALUE;
|
||||
&s2,
|
||||
&s3))
|
||||
return SOAP_EXCEPTION(NS_ERROR_ILLEGAL_VALUE,"SOAP_BLOCK_INIT", "Could not interpret block initialization arguments.");
|
||||
|
||||
nsCOMPtr < nsIVariant > value = dont_AddRef(s1);
|
||||
nsCOMPtr < nsISupports > schemaType = dont_AddRef(s2);
|
||||
nsCOMPtr < nsISupports > encoding = dont_AddRef(s3);
|
||||
|
||||
nsresult rc = SetValue(value);
|
||||
if (NS_FAILED(rc))
|
||||
|
|
|
@ -44,6 +44,7 @@
|
|||
#include "nsIComponentManager.h"
|
||||
#include "nsIURI.h"
|
||||
#include "nsNetUtil.h"
|
||||
#include "nsSOAPException.h"
|
||||
|
||||
/////////////////////////////////////////////
|
||||
//
|
||||
|
@ -130,7 +131,7 @@ NS_IMETHODIMP nsSOAPCall::Invoke(nsISOAPResponse ** _retval)
|
|||
nsCOMPtr < nsISOAPTransport > transport;
|
||||
|
||||
if (mTransportURI.Length() == 0) {
|
||||
return NS_ERROR_NOT_INITIALIZED;
|
||||
return SOAP_EXCEPTION(NS_ERROR_NOT_INITIALIZED,"SOAP_TRANSPORT_URI", "No transport URI was specified.");
|
||||
}
|
||||
|
||||
rv = GetTransport(getter_AddRefs(transport));
|
||||
|
@ -172,7 +173,7 @@ NS_IMETHODIMP
|
|||
nsCOMPtr < nsISOAPTransport > transport;
|
||||
|
||||
if (mTransportURI.Length() == 0) {
|
||||
return NS_ERROR_NOT_INITIALIZED;
|
||||
return SOAP_EXCEPTION(NS_ERROR_NOT_INITIALIZED,"SOAP_TRANSPORT_URI", "No transport URI was specified.");
|
||||
}
|
||||
|
||||
rv = GetTransport(getter_AddRefs(transport));
|
||||
|
|
|
@ -43,6 +43,7 @@
|
|||
#include "nsISOAPDecoder.h"
|
||||
#include "nsSOAPEncoding.h"
|
||||
#include "nsSOAPUtils.h"
|
||||
#include "nsSOAPException.h"
|
||||
#include "nsIServiceManager.h"
|
||||
#include "nsIComponentManager.h"
|
||||
#include "nsIDOMNodeList.h"
|
||||
|
@ -57,7 +58,11 @@ NS_IMPL_ISUPPORTS1(nsSOAPEncodingRegistry, nsISOAPEncoding) nsSOAPEncodingRegist
|
|||
NS_INIT_ISUPPORTS();
|
||||
|
||||
nsAutoString style;
|
||||
aEncoding->GetStyleURI(style);
|
||||
nsresult rc = aEncoding->GetStyleURI(style);
|
||||
if (NS_FAILED(rc)) {
|
||||
mEncodings = nsnull;
|
||||
}
|
||||
// If there are any failures, encodings becomes null, and calls fail.
|
||||
nsStringKey styleKey(style);
|
||||
mEncodings->Put(&styleKey, aEncoding);
|
||||
/* member initializers and constructor code */
|
||||
|
@ -76,6 +81,8 @@ GetAssociatedEncoding(const nsAString & aStyleURI, PRBool aCreateIf,
|
|||
{
|
||||
NS_SOAP_ENSURE_ARG_STRING(aStyleURI);
|
||||
NS_ENSURE_ARG_POINTER(aEncoding);
|
||||
if (!mEncodings)
|
||||
return NS_ERROR_FAILURE;
|
||||
nsStringKey styleKey(aStyleURI);
|
||||
*aEncoding = (nsISOAPEncoding *) mEncodings->Get(&styleKey);
|
||||
if (!*aEncoding) {
|
||||
|
@ -87,8 +94,14 @@ GetAssociatedEncoding(const nsAString & aStyleURI, PRBool aCreateIf,
|
|||
if (defaultEncoding || aCreateIf) {
|
||||
nsCOMPtr < nsISOAPEncoding > encoding = new nsSOAPEncoding(aStyleURI,this,defaultEncoding);
|
||||
*aEncoding = encoding;
|
||||
NS_IF_ADDREF(*aEncoding);
|
||||
mEncodings->Put(&styleKey, encoding);
|
||||
if (encoding) {
|
||||
NS_ADDREF(*aEncoding);
|
||||
mEncodings->Put(&styleKey, encoding);
|
||||
}
|
||||
else
|
||||
{
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
}
|
||||
}
|
||||
return NS_OK;
|
||||
|
@ -279,6 +292,8 @@ nsresult
|
|||
aSchemaCollection)
|
||||
{
|
||||
NS_ENSURE_ARG(aSchemaCollection);
|
||||
if (!mRegistry)
|
||||
return NS_ERROR_FAILURE;
|
||||
return mRegistry->SetSchemaCollection(aSchemaCollection);
|
||||
}
|
||||
|
||||
|
@ -287,6 +302,8 @@ nsresult
|
|||
aSchemaCollection)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aSchemaCollection);
|
||||
if (!mRegistry)
|
||||
return NS_ERROR_FAILURE;
|
||||
return mRegistry->GetSchemaCollection(aSchemaCollection);
|
||||
}
|
||||
|
||||
|
@ -306,6 +323,8 @@ NS_IMETHODIMP
|
|||
{
|
||||
NS_SOAP_ENSURE_ARG_STRING(aStyleURI);
|
||||
NS_ENSURE_ARG_POINTER(_retval);
|
||||
if (!mRegistry)
|
||||
return NS_ERROR_FAILURE;
|
||||
return mRegistry->GetAssociatedEncoding(aStyleURI, aCreateIf, _retval);
|
||||
}
|
||||
|
||||
|
@ -394,7 +413,7 @@ NS_IMETHODIMP
|
|||
_retval);
|
||||
}
|
||||
*_retval = nsnull;
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
return SOAP_EXCEPTION(NS_ERROR_NOT_IMPLEMENTED,"SOAP_DEFAULT_ENCODER", "Encoding style does not have a default encoder.");
|
||||
}
|
||||
|
||||
/* nsIVariant decode (in nsIDOMElement aSource, in nsISchemaType aSchemaType, in nsISOAPAttachments aAttachments); */
|
||||
|
@ -415,7 +434,7 @@ NS_IMETHODIMP
|
|||
_retval);
|
||||
}
|
||||
*_retval = nsnull;
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
return SOAP_EXCEPTION(NS_ERROR_NOT_IMPLEMENTED,"SOAP_DEFAULT_ENCODER", "Encoding style does not have a default decoder.");
|
||||
}
|
||||
|
||||
/* attribute nsISOAPEncoder defaultEncoder; */
|
||||
|
@ -449,7 +468,6 @@ NS_IMETHODIMP
|
|||
*aDefaultDecoder = mDefaultDecoder;
|
||||
NS_IF_ADDREF(*aDefaultDecoder);
|
||||
return NS_OK;
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
|
@ -465,7 +483,7 @@ NS_IMETHODIMP nsSOAPEncoding::MapSchemaURI(const nsAString & aExternalURI, const
|
|||
NS_ENSURE_ARG_POINTER(&aExternalURI);
|
||||
NS_ENSURE_ARG_POINTER(&aInternalURI);
|
||||
if (aExternalURI.IsEmpty() || aInternalURI.IsEmpty()) // Permit no empty URIs.
|
||||
return NS_ERROR_ILLEGAL_VALUE;
|
||||
return SOAP_EXCEPTION(NS_ERROR_ILLEGAL_VALUE,"SOAP_SCHEMA_URI_MAPPING", "No schema URI mapping possible of empty strings.");
|
||||
nsStringKey externalKey(aExternalURI);
|
||||
if (mMappedExternal->Exists(&externalKey)) {
|
||||
*_retval = PR_FALSE; // Do not permit duplicate external
|
||||
|
|
|
@ -40,6 +40,7 @@
|
|||
#include "nsSOAPUtils.h"
|
||||
#include "nsIDOMNodeList.h"
|
||||
#include "nsISOAPMessage.h"
|
||||
#include "nsSOAPException.h"
|
||||
|
||||
static NS_NAMED_LITERAL_STRING(kEmpty, "");
|
||||
|
||||
|
@ -74,10 +75,10 @@ NS_IMETHODIMP nsSOAPFault::SetElement(nsIDOMElement * aElement)
|
|||
kSOAPEnvURI[nsISOAPMessage::VERSION_1_1])) {
|
||||
mVersion = nsISOAPMessage::VERSION_1_1;
|
||||
} else {
|
||||
return NS_ERROR_ILLEGAL_VALUE;
|
||||
return SOAP_EXCEPTION(NS_ERROR_ILLEGAL_VALUE,"SOAP_BADFAULT", "Cannot recognize SOAP version from namespace URI of fault");
|
||||
}
|
||||
} else {
|
||||
return NS_ERROR_ILLEGAL_VALUE;
|
||||
return SOAP_EXCEPTION(NS_ERROR_ILLEGAL_VALUE,"SOAP_BADFAULT", "Cannot recognize element tag of fault.");
|
||||
}
|
||||
}
|
||||
mFaultElement = aElement;
|
||||
|
@ -106,7 +107,9 @@ NS_IMETHODIMP nsSOAPFault::GetFaultCode(nsAString & aFaultCode)
|
|||
getter_AddRefs(faultcode));
|
||||
if (faultcode) {
|
||||
nsAutoString combined;
|
||||
nsSOAPUtils::GetElementTextContent(faultcode, combined);
|
||||
nsresult rc = nsSOAPUtils::GetElementTextContent(faultcode, combined);
|
||||
if (NS_FAILED(rc))
|
||||
return rc;
|
||||
return nsSOAPUtils::GetLocalName(combined, aFaultCode);
|
||||
}
|
||||
return NS_OK;
|
||||
|
@ -126,7 +129,9 @@ NS_IMETHODIMP nsSOAPFault::GetFaultNamespaceURI(nsAString & aNamespaceURI)
|
|||
getter_AddRefs(faultcode));
|
||||
if (faultcode) {
|
||||
nsAutoString combined;
|
||||
nsSOAPUtils::GetElementTextContent(faultcode, combined);
|
||||
nsresult rc = nsSOAPUtils::GetElementTextContent(faultcode, combined);
|
||||
if (NS_FAILED(rc))
|
||||
return rc;
|
||||
return nsSOAPUtils::GetNamespaceURI(nsnull, faultcode, combined, aNamespaceURI);
|
||||
}
|
||||
return NS_OK;
|
||||
|
@ -146,7 +151,9 @@ NS_IMETHODIMP nsSOAPFault::GetFaultString(nsAString & aFaultString)
|
|||
nsSOAPUtils::kFaultStringTagName,
|
||||
getter_AddRefs(element));
|
||||
if (element) {
|
||||
nsSOAPUtils::GetElementTextContent(element, aFaultString);
|
||||
nsresult rc = nsSOAPUtils::GetElementTextContent(element, aFaultString);
|
||||
if (NS_FAILED(rc))
|
||||
return rc;
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
@ -165,7 +172,9 @@ NS_IMETHODIMP nsSOAPFault::GetFaultActor(nsAString & aFaultActor)
|
|||
nsSOAPUtils::kFaultActorTagName,
|
||||
getter_AddRefs(element));
|
||||
if (element) {
|
||||
nsSOAPUtils::GetElementTextContent(element, aFaultActor);
|
||||
nsresult rc = nsSOAPUtils::GetElementTextContent(element, aFaultActor);
|
||||
if (NS_FAILED(rc))
|
||||
return rc;
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
|
|
@ -43,6 +43,7 @@
|
|||
#include "nsIServiceManager.h"
|
||||
#include "nsISOAPAttachments.h"
|
||||
#include "nsISOAPMessage.h"
|
||||
#include "nsSOAPException.h"
|
||||
|
||||
nsSOAPHeaderBlock::nsSOAPHeaderBlock()
|
||||
{
|
||||
|
@ -67,7 +68,7 @@ NS_IMETHODIMP nsSOAPHeaderBlock::GetActorURI(nsAString & aActorURI)
|
|||
NS_ENSURE_ARG_POINTER(&aActorURI);
|
||||
if (mElement) {
|
||||
if (mVersion == nsISOAPMessage::VERSION_UNKNOWN)
|
||||
return NS_ERROR_NOT_AVAILABLE;
|
||||
return SOAP_EXCEPTION(NS_ERROR_NOT_AVAILABLE,"SOAP_HEADER_INIT", "Header has not been properly initialized.");
|
||||
return mElement->GetAttributeNS(*nsSOAPUtils::kSOAPEnvURI[mVersion],
|
||||
nsSOAPUtils::kActorAttribute,
|
||||
aActorURI);
|
||||
|
@ -93,7 +94,7 @@ NS_IMETHODIMP nsSOAPHeaderBlock::GetMustUnderstand(PRBool *
|
|||
NS_ENSURE_ARG_POINTER(&aMustUnderstand);
|
||||
if (mElement) {
|
||||
if (mVersion == nsISOAPMessage::VERSION_UNKNOWN)
|
||||
return NS_ERROR_NOT_AVAILABLE;
|
||||
return SOAP_EXCEPTION(NS_ERROR_NOT_AVAILABLE,"SOAP_HEADER_INIT", "Header has not been properly initialized.");
|
||||
nsAutoString m;
|
||||
nsresult
|
||||
rc =
|
||||
|
@ -111,7 +112,7 @@ NS_IMETHODIMP nsSOAPHeaderBlock::GetMustUnderstand(PRBool *
|
|||
|| m.Equals(nsSOAPUtils::kFalseA))
|
||||
*aMustUnderstand = PR_FALSE;
|
||||
else
|
||||
return NS_ERROR_ILLEGAL_VALUE;
|
||||
return SOAP_EXCEPTION(NS_ERROR_ILLEGAL_VALUE,"SOAP_HEADER_MUSTUNDERSTAND", "Must understand value in header has an illegal value.");
|
||||
return NS_OK;
|
||||
} else {
|
||||
*aMustUnderstand = mMustUnderstand;
|
||||
|
|
|
@ -44,6 +44,7 @@
|
|||
#include "nsSOAPParameter.h"
|
||||
#include "nsSOAPHeaderBlock.h"
|
||||
#include "nsSOAPEncoding.h"
|
||||
#include "nsSOAPException.h"
|
||||
#include "nsIDOMDocument.h"
|
||||
#include "nsIDOMAttr.h"
|
||||
#include "nsIDOMParser.h"
|
||||
|
@ -299,7 +300,7 @@ NS_IMETHODIMP
|
|||
NS_ENSURE_ARG_POINTER(&aTargetObjectURI);
|
||||
if (aVersion != nsISOAPMessage::VERSION_1_1
|
||||
&& aVersion != nsISOAPMessage::VERSION_1_2)
|
||||
return NS_ERROR_ILLEGAL_VALUE;
|
||||
return SOAP_EXCEPTION(NS_ERROR_ILLEGAL_VALUE,"SOAP_BAD_VALUE","Cannot encode message blocks without a valid SOAP version specified.");
|
||||
|
||||
// Construct the message skeleton
|
||||
|
||||
|
@ -373,7 +374,7 @@ NS_IMETHODIMP
|
|||
for (i = 0; i < aHeaderBlockCount; i++) {
|
||||
header = aHeaderBlocks[i];
|
||||
if (!header)
|
||||
return NS_ERROR_FAILURE;
|
||||
return SOAP_EXCEPTION(NS_ERROR_ILLEGAL_VALUE,"SOAP_NULL_HEADER","Cannot encode null in header array.");
|
||||
rv = header->GetElement(getter_AddRefs(element));
|
||||
if (element) {
|
||||
nsCOMPtr < nsIDOMNode > node1;
|
||||
|
@ -478,7 +479,7 @@ NS_IMETHODIMP
|
|||
for (i = 0; i < aParameterCount; i++) {
|
||||
param = aParameters[i];
|
||||
if (!param)
|
||||
return NS_ERROR_FAILURE;
|
||||
return SOAP_EXCEPTION(NS_ERROR_ILLEGAL_VALUE,"SOAP_NULL_PARAMETER","Cannot encode null in parameter array.");
|
||||
rv = param->GetElement(getter_AddRefs(element));
|
||||
if (element) {
|
||||
nsCOMPtr < nsIDOMNode > node1;
|
||||
|
@ -684,7 +685,7 @@ NS_IMETHODIMP
|
|||
if (!aDocumentStyle) {
|
||||
element = next;
|
||||
if (!element)
|
||||
return NS_ERROR_ILLEGAL_VALUE;
|
||||
return SOAP_EXCEPTION(NS_ERROR_ILLEGAL_VALUE,"SOAP_MISSING_METHOD","Cannot decode rpc-style message due to missing method element.");
|
||||
nsSOAPUtils::GetFirstChildElement(element, getter_AddRefs(next));
|
||||
}
|
||||
nsCOMPtr < nsISOAPEncoding > encoding;
|
||||
|
|
|
@ -251,7 +251,7 @@ NS_IMPL_ISUPPORTS1_CI(nsSOAPPropertyBagMutator, nsISOAPPropertyBagMutator)
|
|||
NS_IMETHODIMP nsSOAPPropertyBagMutator::GetPropertyBag(nsIPropertyBag ** aPropertyBag) {
|
||||
NS_ENSURE_ARG_POINTER(aPropertyBag);
|
||||
*aPropertyBag = mBag;
|
||||
NS_ADDREF(*aPropertyBag);
|
||||
NS_IF_ADDREF(*aPropertyBag);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
@ -261,5 +261,8 @@ NS_IMETHODIMP
|
|||
{
|
||||
NS_ENSURE_ARG_POINTER(&aName);
|
||||
NS_ENSURE_ARG_POINTER(aValue);
|
||||
if (!mSOAPBag) { // In case of initialization failure...
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
return mSOAPBag->SetProperty(aName, aValue);
|
||||
}
|
||||
|
|
|
@ -42,6 +42,7 @@
|
|||
#include "nsIDOMNamedNodeMap.h"
|
||||
#include "nsIDOMAttr.h"
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsSOAPException.h"
|
||||
|
||||
NS_NAMED_LITERAL_STRING(realSOAPEnvURI1,
|
||||
"http://schemas.xmlsoap.org/soap/envelope/");
|
||||
|
@ -270,7 +271,7 @@ nsresult
|
|||
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.
|
||||
return SOAP_EXCEPTION(NS_ERROR_ILLEGAL_VALUE,"SOAP_UNEXPECTED_ELEMENT", "Unable to retrieve simple content because a child element was present.");
|
||||
}
|
||||
nsCOMPtr < nsIDOMNode > temp = child;
|
||||
GetNextSibling(temp, getter_AddRefs(child));
|
||||
|
@ -378,7 +379,7 @@ nsresult
|
|||
current = temp;
|
||||
}
|
||||
if (!current)
|
||||
return NS_ERROR_FAILURE;
|
||||
return SOAP_EXCEPTION(NS_ERROR_FAILURE,"SOAP_NAMESPACE", "Unable to resolve prefix in attribute value to namespace URI");
|
||||
}
|
||||
if (aEncoding) {
|
||||
return aEncoding->GetInternalSchemaURI(result,aURI);
|
||||
|
|
|
@ -61,7 +61,7 @@ interface nsISOAPMessage : nsISupports {
|
|||
|
||||
const unsigned short VERSION_1_1 = 0;
|
||||
const unsigned short VERSION_1_2 = 1;
|
||||
const unsigned short VERSION_UNKNOWN = 32767;
|
||||
const unsigned short VERSION_UNKNOWN = 0xFFFF;
|
||||
|
||||
/**
|
||||
* The document which captures the message, if any. A simple
|
||||
|
|
|
@ -228,85 +228,6 @@ nsDefaultSOAPEncoder_1_2::nsDefaultSOAPEncoder_1_2() : nsSOAPEncoding(nsSOAPUtil
|
|||
}
|
||||
|
||||
// Here is the implementation of the encoders.
|
||||
static
|
||||
nsresult
|
||||
EncodeSimpleValue(nsISOAPEncoding * aEncoding,
|
||||
const nsAString & aValue,
|
||||
const nsAString & aNamespaceURI,
|
||||
const nsAString & aName,
|
||||
nsISchemaType * aSchemaType,
|
||||
nsIDOMElement * aDestination, nsIDOMElement ** _retval)
|
||||
{
|
||||
nsAutoString ns;
|
||||
nsresult rc = aEncoding->GetExternalSchemaURI(aNamespaceURI, ns);
|
||||
if (NS_FAILED(rc))
|
||||
return rc;
|
||||
nsCOMPtr < nsIDOMDocument > document;
|
||||
rc = aDestination->GetOwnerDocument(getter_AddRefs(document));
|
||||
if (NS_FAILED(rc))
|
||||
return rc;
|
||||
nsCOMPtr < nsIDOMElement > element;
|
||||
rc = document->CreateElementNS(ns, aName, getter_AddRefs(element));
|
||||
if (NS_FAILED(rc))
|
||||
return rc;
|
||||
nsCOMPtr < nsIDOMNode > ignore;
|
||||
rc = aDestination->AppendChild(element, getter_AddRefs(ignore));
|
||||
if (NS_FAILED(rc))
|
||||
return rc;
|
||||
if (aSchemaType) {
|
||||
nsAutoString name;
|
||||
rc = aSchemaType->GetName(name);
|
||||
if (NS_FAILED(rc))
|
||||
return rc;
|
||||
rc = aSchemaType->GetTargetNamespace(ns);
|
||||
if (NS_FAILED(rc))
|
||||
return rc;
|
||||
nsAutoString type;
|
||||
rc = nsSOAPUtils::MakeNamespacePrefix(aEncoding, element,
|
||||
ns, type);
|
||||
if (NS_FAILED(rc))
|
||||
return rc;
|
||||
type.Append(nsSOAPUtils::kQualifiedSeparator);
|
||||
type.Append(name);
|
||||
rc = aEncoding->GetExternalSchemaURI(nsSOAPUtils::kXSIURI, ns);
|
||||
if (NS_FAILED(rc))
|
||||
return rc;
|
||||
rc = (element)->
|
||||
SetAttributeNS(ns, nsSOAPUtils::kXSITypeAttribute, type);
|
||||
if (NS_FAILED(rc))
|
||||
return rc;
|
||||
}
|
||||
if (!aValue.IsEmpty()) {
|
||||
nsCOMPtr < nsIDOMText > text;
|
||||
rc = document->CreateTextNode(aValue, getter_AddRefs(text));
|
||||
if (NS_FAILED(rc))
|
||||
return rc;
|
||||
rc = (element)->AppendChild(text, getter_AddRefs(ignore));
|
||||
if (NS_FAILED(rc))
|
||||
return rc;
|
||||
}
|
||||
*_retval = element;
|
||||
NS_IF_ADDREF(element);
|
||||
return rc;
|
||||
}
|
||||
|
||||
// Testing for a simple value
|
||||
static nsresult HasSimpleValue(nsISchemaType * aSchemaType, PRBool * aResult) {
|
||||
PRUint16 typevalue;
|
||||
nsresult rc = aSchemaType->GetSchemaType(&typevalue);
|
||||
if (NS_FAILED(rc))
|
||||
return rc;
|
||||
if (typevalue == nsISchemaComplexType::SCHEMA_TYPE_COMPLEX) {
|
||||
nsCOMPtr<nsISchemaComplexType> ct = do_QueryInterface(aSchemaType);
|
||||
rc = ct->GetContentModel(&typevalue);
|
||||
if (NS_FAILED(rc))
|
||||
return rc;
|
||||
*aResult = typevalue == nsISchemaComplexType::CONTENT_MODEL_SIMPLE;
|
||||
} else {
|
||||
*aResult = PR_TRUE;
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
// Getting the immediate supertype of any type
|
||||
static nsresult GetSupertype(nsISOAPEncoding * aEncoding, nsISchemaType* aType, nsISchemaType** _retval)
|
||||
|
@ -523,6 +444,7 @@ static nsresult GetSupertype(nsISOAPEncoding * aEncoding, nsISchemaType* aType,
|
|||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!base) {
|
||||
|
@ -550,6 +472,122 @@ static nsresult GetSupertype(nsISOAPEncoding * aEncoding, nsISchemaType* aType,
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
static nsresult
|
||||
EncodeSimpleValue(nsISOAPEncoding * aEncoding,
|
||||
const nsAString & aValue,
|
||||
const nsAString & aNamespaceURI,
|
||||
const nsAString & aName,
|
||||
nsISchemaType * aSchemaType,
|
||||
nsIDOMElement * aDestination, nsIDOMElement ** _retval)
|
||||
{
|
||||
nsresult rc;
|
||||
nsAutoString typeName;
|
||||
nsAutoString typeNS;
|
||||
if (aSchemaType) {
|
||||
rc = aSchemaType->GetName(typeName);
|
||||
if (NS_FAILED(rc))
|
||||
return rc;
|
||||
rc = aSchemaType->GetTargetNamespace(typeNS);
|
||||
if (NS_FAILED(rc))
|
||||
return rc;
|
||||
}
|
||||
nsAutoString name; // First choose the appropriate name and namespace for the element.
|
||||
nsAutoString ns;
|
||||
if (aName.IsEmpty()) { // We automatically choose appropriate element names where none exist.
|
||||
ns = nsSOAPUtils::kSOAPEncURI;
|
||||
nsAutoString currentURI = ns;
|
||||
nsCOMPtr<nsISchemaType>currentType = aSchemaType;
|
||||
while (!(typeNS.Equals(nsSOAPUtils::kXSURI)
|
||||
|| typeNS.Equals(nsSOAPUtils::kSOAPEncURI))) {
|
||||
nsCOMPtr<nsISchemaType> supertype;
|
||||
rc = GetSupertype(aEncoding, currentType, getter_AddRefs(supertype));
|
||||
if (NS_FAILED(rc))
|
||||
return rc;
|
||||
if (!currentType) {
|
||||
currentURI = nsSOAPUtils::kXSURI;
|
||||
break;
|
||||
}
|
||||
currentType = supertype;
|
||||
rc = currentType->GetTargetNamespace(typeNS);
|
||||
if (NS_FAILED(rc))
|
||||
return rc;
|
||||
}
|
||||
if (currentType) {
|
||||
rc = aSchemaType->GetName(name);
|
||||
if (NS_FAILED(rc))
|
||||
return rc;
|
||||
}
|
||||
else {
|
||||
name = kAnyTypeSchemaType;
|
||||
}
|
||||
rc = aEncoding->GetExternalSchemaURI(nsSOAPUtils::kSOAPEncURI, ns);
|
||||
}
|
||||
else {
|
||||
name = aName;
|
||||
rc = aEncoding->GetExternalSchemaURI(aNamespaceURI, ns);
|
||||
}
|
||||
if (NS_FAILED(rc))
|
||||
return rc;
|
||||
nsCOMPtr < nsIDOMDocument > document;
|
||||
rc = aDestination->GetOwnerDocument(getter_AddRefs(document));
|
||||
if (NS_FAILED(rc))
|
||||
return rc;
|
||||
nsCOMPtr < nsIDOMElement > element;
|
||||
rc = document->CreateElementNS(ns, name, getter_AddRefs(element));
|
||||
if (NS_FAILED(rc))
|
||||
return rc;
|
||||
nsCOMPtr < nsIDOMNode > ignore;
|
||||
rc = aDestination->AppendChild(element, getter_AddRefs(ignore));
|
||||
if (NS_FAILED(rc))
|
||||
return rc;
|
||||
if (!typeName.IsEmpty()) {
|
||||
nsAutoString type;
|
||||
rc = nsSOAPUtils::MakeNamespacePrefix(aEncoding, element,
|
||||
typeNS, type);
|
||||
if (NS_FAILED(rc))
|
||||
return rc;
|
||||
type.Append(nsSOAPUtils::kQualifiedSeparator);
|
||||
type.Append(typeName);
|
||||
rc = aEncoding->GetExternalSchemaURI(nsSOAPUtils::kXSIURI, ns);
|
||||
if (NS_FAILED(rc))
|
||||
return rc;
|
||||
rc = (element)->
|
||||
SetAttributeNS(ns, nsSOAPUtils::kXSITypeAttribute, type);
|
||||
if (NS_FAILED(rc))
|
||||
return rc;
|
||||
}
|
||||
if (!aValue.IsEmpty()) {
|
||||
nsCOMPtr < nsIDOMText > text;
|
||||
rc = document->CreateTextNode(aValue, getter_AddRefs(text));
|
||||
if (NS_FAILED(rc))
|
||||
return rc;
|
||||
rc = (element)->AppendChild(text, getter_AddRefs(ignore));
|
||||
if (NS_FAILED(rc))
|
||||
return rc;
|
||||
}
|
||||
*_retval = element;
|
||||
NS_IF_ADDREF(*_retval);
|
||||
return rc;
|
||||
}
|
||||
|
||||
// Testing for a simple value
|
||||
static nsresult HasSimpleValue(nsISchemaType * aSchemaType, PRBool * aResult) {
|
||||
PRUint16 typevalue;
|
||||
nsresult rc = aSchemaType->GetSchemaType(&typevalue);
|
||||
if (NS_FAILED(rc))
|
||||
return rc;
|
||||
if (typevalue == nsISchemaComplexType::SCHEMA_TYPE_COMPLEX) {
|
||||
nsCOMPtr<nsISchemaComplexType> ct = do_QueryInterface(aSchemaType);
|
||||
rc = ct->GetContentModel(&typevalue);
|
||||
if (NS_FAILED(rc))
|
||||
return rc;
|
||||
*aResult = typevalue == nsISchemaComplexType::CONTENT_MODEL_SIMPLE;
|
||||
} else {
|
||||
*aResult = PR_TRUE;
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
// Default
|
||||
|
||||
NS_IMETHODIMP
|
||||
|
@ -941,17 +979,9 @@ NS_IMETHODIMP
|
|||
return rc;
|
||||
}
|
||||
}
|
||||
if (aName.IsEmpty()) {
|
||||
rc = EncodeSimpleValue(aEncoding, kEmpty,
|
||||
nsSOAPUtils::kSOAPEncURI,
|
||||
kStructSOAPType, aSchemaType, aDestination,
|
||||
aReturnValue);
|
||||
}
|
||||
else {
|
||||
rc = EncodeSimpleValue(aEncoding, kEmpty,
|
||||
rc = EncodeSimpleValue(aEncoding, kEmpty,
|
||||
aNamespaceURI, aName, aSchemaType, aDestination,
|
||||
aReturnValue);
|
||||
}
|
||||
if (NS_FAILED(rc))
|
||||
return rc;
|
||||
return EncodeStructParticle(aEncoding, pbptr, modelGroup, aAttachments, *aReturnValue);
|
||||
|
@ -982,12 +1012,6 @@ NS_IMETHODIMP
|
|||
rc = aSource->GetAsAString(value);
|
||||
if (NS_FAILED(rc))
|
||||
return rc;
|
||||
if (aName.IsEmpty()) {
|
||||
return EncodeSimpleValue(aEncoding, value,
|
||||
nsSOAPUtils::kSOAPEncURI,
|
||||
kAnySimpleTypeSchemaType,
|
||||
aSchemaType, aDestination, aReturnValue);
|
||||
}
|
||||
return EncodeSimpleValue(aEncoding, value,
|
||||
aNamespaceURI, aName, aSchemaType, aDestination,
|
||||
aReturnValue);
|
||||
|
@ -1067,8 +1091,8 @@ static nsresult GetArrayType(nsIVariant* aSource, PRUint32 aDimensionCount, PRUi
|
|||
PRUint64 tot = 1; // Collect in 64 bits, just to make sure combo fits
|
||||
for (i = 0; i < aDimensionCount; i++) {
|
||||
tot = tot * aDimensionSizes[i];
|
||||
if (tot > 4294967295U) {
|
||||
return SOAP_EXCEPTION(NS_ERROR_ILLEGAL_VALUE,"SOAP_ARRAY_TOO_BIG","When encoding an object as an array, the items exceeded 4294967295");
|
||||
if (tot > 0xffffffffU) {
|
||||
return SOAP_EXCEPTION(NS_ERROR_ILLEGAL_VALUE,"SOAP_ARRAY_TOO_BIG","When encoding an object as an array, the total count of items exceeded maximum.");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1345,15 +1369,9 @@ NS_IMETHODIMP
|
|||
if (NS_FAILED(rc))
|
||||
return rc;
|
||||
}
|
||||
if (aName.IsEmpty()) { // Now create the element to hold the array
|
||||
rc = EncodeSimpleValue(aEncoding, kEmpty,
|
||||
nsSOAPUtils::kSOAPEncURI,
|
||||
kArraySOAPType, aSchemaType, aDestination, aReturnValue);
|
||||
} else {
|
||||
rc = EncodeSimpleValue(aEncoding, kEmpty,
|
||||
aNamespaceURI,
|
||||
aName, aSchemaType, aDestination, aReturnValue);
|
||||
}
|
||||
rc = EncodeSimpleValue(aEncoding, kEmpty,
|
||||
aNamespaceURI,
|
||||
aName, aSchemaType, aDestination, aReturnValue);
|
||||
if (NS_FAILED(rc))
|
||||
return rc;
|
||||
|
||||
|
@ -1411,12 +1429,6 @@ NS_IMETHODIMP
|
|||
rc = aSource->GetAsAString(value);
|
||||
if (NS_FAILED(rc))
|
||||
return rc;
|
||||
if (aName.IsEmpty()) {
|
||||
return EncodeSimpleValue(aEncoding, value,
|
||||
nsSOAPUtils::kSOAPEncURI,
|
||||
kStringSchemaType,
|
||||
aSchemaType, aDestination, aReturnValue);
|
||||
}
|
||||
return EncodeSimpleValue(aEncoding, value,
|
||||
aNamespaceURI, aName, aSchemaType, aDestination,
|
||||
aReturnValue);
|
||||
|
@ -1445,13 +1457,6 @@ NS_IMETHODIMP
|
|||
rc = aSource->GetAsBool(&b);
|
||||
if (NS_FAILED(rc))
|
||||
return rc;
|
||||
if (aName.IsEmpty()) {
|
||||
return EncodeSimpleValue(aEncoding, b ? nsSOAPUtils::kTrueA : nsSOAPUtils::
|
||||
kFalseA,
|
||||
nsSOAPUtils::kSOAPEncURI,
|
||||
kBooleanSchemaType, aSchemaType, aDestination,
|
||||
aReturnValue);
|
||||
}
|
||||
return EncodeSimpleValue(aEncoding, b ? nsSOAPUtils::kTrueA : nsSOAPUtils::kFalseA,
|
||||
aNamespaceURI, aName, aSchemaType, aDestination,
|
||||
aReturnValue);
|
||||
|
@ -1486,12 +1491,6 @@ NS_IMETHODIMP
|
|||
nsAutoString value;
|
||||
CopyASCIItoUCS2(nsDependentCString(ptr), value);
|
||||
PR_smprintf_free(ptr);
|
||||
if (aName.IsEmpty()) {
|
||||
return EncodeSimpleValue(aEncoding, value,
|
||||
nsSOAPUtils::kSOAPEncURI,
|
||||
kDoubleSchemaType,
|
||||
aSchemaType, aDestination, aReturnValue);
|
||||
}
|
||||
return EncodeSimpleValue(aEncoding, value,
|
||||
aNamespaceURI, aName, aSchemaType, aDestination,
|
||||
aReturnValue);
|
||||
|
@ -1526,11 +1525,6 @@ NS_IMETHODIMP
|
|||
nsAutoString value;
|
||||
CopyASCIItoUCS2(nsDependentCString(ptr), value);
|
||||
PR_smprintf_free(ptr);
|
||||
if (aName.IsEmpty()) {
|
||||
return EncodeSimpleValue(aEncoding, value,
|
||||
nsSOAPUtils::kSOAPEncURI,
|
||||
kFloatSchemaType, aSchemaType, aDestination, aReturnValue);
|
||||
}
|
||||
return EncodeSimpleValue(aEncoding, value,
|
||||
aNamespaceURI, aName, aSchemaType, aDestination,
|
||||
aReturnValue);
|
||||
|
@ -1565,11 +1559,6 @@ NS_IMETHODIMP
|
|||
nsAutoString value;
|
||||
CopyASCIItoUCS2(nsDependentCString(ptr), value);
|
||||
PR_smprintf_free(ptr);
|
||||
if (aName.IsEmpty()) {
|
||||
return EncodeSimpleValue(aEncoding, value,
|
||||
nsSOAPUtils::kSOAPEncURI,
|
||||
kLongSchemaType, aSchemaType, aDestination, aReturnValue);
|
||||
}
|
||||
return EncodeSimpleValue(aEncoding, value,
|
||||
aNamespaceURI, aName, aSchemaType, aDestination,
|
||||
aReturnValue);
|
||||
|
@ -1604,11 +1593,6 @@ NS_IMETHODIMP
|
|||
nsAutoString value;
|
||||
CopyASCIItoUCS2(nsDependentCString(ptr), value);
|
||||
PR_smprintf_free(ptr);
|
||||
if (aName.IsEmpty()) {
|
||||
return EncodeSimpleValue(aEncoding, value,
|
||||
nsSOAPUtils::kSOAPEncURI,
|
||||
kIntSchemaType, aSchemaType, aDestination, aReturnValue);
|
||||
}
|
||||
return EncodeSimpleValue(aEncoding, value,
|
||||
aNamespaceURI, aName, aSchemaType, aDestination,
|
||||
aReturnValue);
|
||||
|
@ -1643,11 +1627,6 @@ NS_IMETHODIMP
|
|||
nsAutoString value;
|
||||
CopyASCIItoUCS2(nsDependentCString(ptr), value);
|
||||
PR_smprintf_free(ptr);
|
||||
if (aName.IsEmpty()) {
|
||||
return EncodeSimpleValue(aEncoding, value,
|
||||
nsSOAPUtils::kSOAPEncURI,
|
||||
kShortSchemaType, aSchemaType, aDestination, aReturnValue);
|
||||
}
|
||||
return EncodeSimpleValue(aEncoding, value,
|
||||
aNamespaceURI, aName, aSchemaType, aDestination,
|
||||
aReturnValue);
|
||||
|
@ -1682,11 +1661,6 @@ NS_IMETHODIMP
|
|||
nsAutoString value;
|
||||
CopyASCIItoUCS2(nsDependentCString(ptr), value);
|
||||
PR_smprintf_free(ptr);
|
||||
if (aName.IsEmpty()) {
|
||||
return EncodeSimpleValue(aEncoding, value,
|
||||
nsSOAPUtils::kSOAPEncURI,
|
||||
kByteSchemaType, aSchemaType, aDestination, aReturnValue);
|
||||
}
|
||||
return EncodeSimpleValue(aEncoding, value,
|
||||
aNamespaceURI, aName, aSchemaType, aDestination,
|
||||
aReturnValue);
|
||||
|
@ -1721,11 +1695,6 @@ NS_IMETHODIMP
|
|||
nsAutoString value;
|
||||
CopyASCIItoUCS2(nsDependentCString(ptr), value);
|
||||
PR_smprintf_free(ptr);
|
||||
if (aName.IsEmpty()) {
|
||||
return EncodeSimpleValue(aEncoding, value,
|
||||
nsSOAPUtils::kSOAPEncURI,
|
||||
kLongSchemaType, aSchemaType, aDestination, aReturnValue);
|
||||
}
|
||||
return EncodeSimpleValue(aEncoding, value,
|
||||
aNamespaceURI, aName, aSchemaType, aDestination,
|
||||
aReturnValue);
|
||||
|
@ -1760,11 +1729,6 @@ NS_IMETHODIMP
|
|||
nsAutoString value;
|
||||
CopyASCIItoUCS2(nsDependentCString(ptr), value);
|
||||
PR_smprintf_free(ptr);
|
||||
if (aName.IsEmpty()) {
|
||||
return EncodeSimpleValue(aEncoding, value,
|
||||
nsSOAPUtils::kSOAPEncURI,
|
||||
kIntSchemaType, aSchemaType, aDestination, aReturnValue);
|
||||
}
|
||||
return EncodeSimpleValue(aEncoding, value,
|
||||
aNamespaceURI, aName, aSchemaType, aDestination,
|
||||
aReturnValue);
|
||||
|
@ -1799,11 +1763,6 @@ NS_IMETHODIMP
|
|||
nsAutoString value;
|
||||
CopyASCIItoUCS2(nsDependentCString(ptr), value);
|
||||
PR_smprintf_free(ptr);
|
||||
if (aName.IsEmpty()) {
|
||||
return EncodeSimpleValue(aEncoding, value,
|
||||
nsSOAPUtils::kSOAPEncURI,
|
||||
kShortSchemaType, aSchemaType, aDestination, aReturnValue);
|
||||
}
|
||||
return EncodeSimpleValue(aEncoding, value,
|
||||
aNamespaceURI, aName, aSchemaType, aDestination,
|
||||
aReturnValue);
|
||||
|
@ -1838,11 +1797,6 @@ NS_IMETHODIMP
|
|||
nsAutoString value;
|
||||
CopyASCIItoUCS2(nsDependentCString(ptr), value);
|
||||
PR_smprintf_free(ptr);
|
||||
if (aName.IsEmpty()) {
|
||||
return EncodeSimpleValue(aEncoding, value,
|
||||
nsSOAPUtils::kSOAPEncURI,
|
||||
kByteSchemaType, aSchemaType, aDestination, aReturnValue);
|
||||
}
|
||||
return EncodeSimpleValue(aEncoding, value,
|
||||
aNamespaceURI, aName, aSchemaType, aDestination,
|
||||
aReturnValue);
|
||||
|
@ -2403,12 +2357,12 @@ static PRUint32 DecodeArrayDimensions(const nsAString& src, PRInt32* aDimensionS
|
|||
&& *(--i2) <= ' ') // In XML, all valid characters <= space are the only whitespace
|
||||
;
|
||||
if (*i2 != ']') { // In this case, not an array dimension
|
||||
int len = Distance(i1, i2) - 1; // This is the size to truncate to at the end.
|
||||
PRInt32 len = Distance(i1, i2) - 1; // This is the size to truncate to at the end.
|
||||
src.Left(dst, len); // Truncate the string.
|
||||
return 0; // Eliminated white space.
|
||||
}
|
||||
|
||||
int dimensionCount = 1; // Counting the dimensions
|
||||
PRInt32 dimensionCount = 1; // Counting the dimensions
|
||||
for (;;) { // First look for the matching bracket from reverse and commas.
|
||||
if (i1 == i2) { // No matching bracket.
|
||||
return 0;
|
||||
|
@ -2421,7 +2375,7 @@ static PRUint32 DecodeArrayDimensions(const nsAString& src, PRInt32* aDimensionS
|
|||
dimensionCount++;
|
||||
}
|
||||
}
|
||||
int len;
|
||||
PRInt32 len;
|
||||
{
|
||||
nsReadingIterator < PRUnichar > i3 = i2++; // Cover any extra white space
|
||||
while (i1 != i3) { // Loop past white space
|
||||
|
@ -2629,8 +2583,8 @@ NS_IMETHODIMP
|
|||
break;
|
||||
}
|
||||
tot = tot * next;
|
||||
if (tot > 2147483647) {
|
||||
return SOAP_EXCEPTION(NS_ERROR_ILLEGAL_VALUE,"SOAP_ARRAY_TOO_BIG","When encoding an object as an array, the items exceeded 2147483647");
|
||||
if (tot > 0x7fffffff) {
|
||||
return SOAP_EXCEPTION(NS_ERROR_ILLEGAL_VALUE,"SOAP_ARRAY_TOO_BIG","When decoding an object as an array, the total count of items exceeded maximum.");
|
||||
}
|
||||
}
|
||||
size = (PRInt32)tot;
|
||||
|
@ -2794,8 +2748,8 @@ NS_IMETHODIMP
|
|||
dimensionSizes[i] = next = pp[i];
|
||||
}
|
||||
tot = tot * next;
|
||||
if (tot > 2147483647) {
|
||||
return SOAP_EXCEPTION(NS_ERROR_ILLEGAL_VALUE,"SOAP_ARRAY_TOO_BIG","More than 2147483647 items found to go in array.");
|
||||
if (tot > 0x7fffffff) {
|
||||
return SOAP_EXCEPTION(NS_ERROR_ILLEGAL_VALUE,"SOAP_ARRAY_TOO_BIG","When decoding an object as an array, the total count of items exceeded maximum.");
|
||||
}
|
||||
}
|
||||
size = (PRInt32)tot; // At last, we know the dimensions of the array.
|
||||
|
@ -2977,8 +2931,8 @@ NS_IMETHODIMP
|
|||
if (NS_FAILED(rc))
|
||||
return rc;
|
||||
double f;
|
||||
unsigned int n;
|
||||
int r = PR_sscanf(NS_ConvertUCS2toUTF8(value).get(), " %lf %n", &f, &n);
|
||||
PRUint32 n;
|
||||
PRInt32 r = PR_sscanf(NS_ConvertUCS2toUTF8(value).get(), " %lf %n", &f, &n);
|
||||
if (r == 0 || n < value.Length())
|
||||
return SOAP_EXCEPTION(NS_ERROR_ILLEGAL_VALUE,"SOAP_ILLEGAL_DOUBLE","Illegal value discovered for double");
|
||||
|
||||
|
@ -3008,8 +2962,8 @@ NS_IMETHODIMP
|
|||
if (NS_FAILED(rc))
|
||||
return rc;
|
||||
float f;
|
||||
unsigned int n;
|
||||
int r = PR_sscanf(NS_ConvertUCS2toUTF8(value).get(), " %f %n", &f, &n);
|
||||
PRUint32 n;
|
||||
PRInt32 r = PR_sscanf(NS_ConvertUCS2toUTF8(value).get(), " %f %n", &f, &n);
|
||||
if (r == 0 || n < value.Length())
|
||||
return SOAP_EXCEPTION(NS_ERROR_ILLEGAL_VALUE,"SOAP_ILLEGAL_FLOAT","Illegal value discovered for float");
|
||||
|
||||
|
@ -3039,8 +2993,8 @@ NS_IMETHODIMP
|
|||
if (NS_FAILED(rc))
|
||||
return rc;
|
||||
PRInt64 f;
|
||||
unsigned int n;
|
||||
int r = PR_sscanf(NS_ConvertUCS2toUTF8(value).get(), " %lld %n", &f, &n);
|
||||
PRUint32 n;
|
||||
PRInt32 r = PR_sscanf(NS_ConvertUCS2toUTF8(value).get(), " %lld %n", &f, &n);
|
||||
if (r == 0 || n < value.Length())
|
||||
return SOAP_EXCEPTION(NS_ERROR_ILLEGAL_VALUE,"SOAP_ILLEGAL_LONG","Illegal value discovered for long");
|
||||
|
||||
|
@ -3070,8 +3024,8 @@ NS_IMETHODIMP
|
|||
if (NS_FAILED(rc))
|
||||
return rc;
|
||||
PRInt32 f;
|
||||
unsigned int n;
|
||||
int r = PR_sscanf(NS_ConvertUCS2toUTF8(value).get(), " %ld %n", &f, &n);
|
||||
PRUint32 n;
|
||||
PRInt32 r = PR_sscanf(NS_ConvertUCS2toUTF8(value).get(), " %ld %n", &f, &n);
|
||||
if (r == 0 || n < value.Length())
|
||||
return SOAP_EXCEPTION(NS_ERROR_ILLEGAL_VALUE,"SOAP_ILLEGAL_INT","Illegal value discovered for int");
|
||||
|
||||
|
@ -3101,8 +3055,8 @@ NS_IMETHODIMP
|
|||
if (NS_FAILED(rc))
|
||||
return rc;
|
||||
PRInt16 f;
|
||||
unsigned int n;
|
||||
int r = PR_sscanf(NS_ConvertUCS2toUTF8(value).get(), " %hd %n", &f, &n);
|
||||
PRUint32 n;
|
||||
PRInt32 r = PR_sscanf(NS_ConvertUCS2toUTF8(value).get(), " %hd %n", &f, &n);
|
||||
if (r == 0 || n < value.Length())
|
||||
return SOAP_EXCEPTION(NS_ERROR_ILLEGAL_VALUE,"SOAP_ILLEGAL_SHORT","Illegal value discovered for short");
|
||||
|
||||
|
@ -3132,8 +3086,8 @@ NS_IMETHODIMP
|
|||
if (NS_FAILED(rc))
|
||||
return rc;
|
||||
PRInt16 f;
|
||||
unsigned int n;
|
||||
int r = PR_sscanf(NS_ConvertUCS2toUTF8(value).get(), " %hd %n", &f, &n);
|
||||
PRUint32 n;
|
||||
PRInt32 r = PR_sscanf(NS_ConvertUCS2toUTF8(value).get(), " %hd %n", &f, &n);
|
||||
if (r == 0 || n < value.Length() || f < -128 || f > 127)
|
||||
return SOAP_EXCEPTION(NS_ERROR_ILLEGAL_VALUE,"SOAP_ILLEGAL_BYTE","Illegal value discovered for byte");
|
||||
|
||||
|
@ -3163,8 +3117,8 @@ NS_IMETHODIMP
|
|||
if (NS_FAILED(rc))
|
||||
return rc;
|
||||
PRUint64 f;
|
||||
unsigned int n;
|
||||
int r = PR_sscanf(NS_ConvertUCS2toUTF8(value).get(), " %llu %n", &f, &n);
|
||||
PRUint32 n;
|
||||
PRInt32 r = PR_sscanf(NS_ConvertUCS2toUTF8(value).get(), " %llu %n", &f, &n);
|
||||
if (r == 0 || n < value.Length())
|
||||
return SOAP_EXCEPTION(NS_ERROR_ILLEGAL_VALUE,"SOAP_ILLEGAL_ULONG","Illegal value discovered for unsigned long");
|
||||
|
||||
|
@ -3194,8 +3148,8 @@ NS_IMETHODIMP
|
|||
if (NS_FAILED(rc))
|
||||
return rc;
|
||||
PRUint32 f;
|
||||
unsigned int n;
|
||||
int r = PR_sscanf(NS_ConvertUCS2toUTF8(value).get(), " %lu %n", &f, &n);
|
||||
PRUint32 n;
|
||||
PRInt32 r = PR_sscanf(NS_ConvertUCS2toUTF8(value).get(), " %lu %n", &f, &n);
|
||||
if (r == 0 || n < value.Length())
|
||||
return SOAP_EXCEPTION(NS_ERROR_ILLEGAL_VALUE,"SOAP_ILLEGAL_UINT","Illegal value discovered for unsigned int");
|
||||
|
||||
|
@ -3225,8 +3179,8 @@ NS_IMETHODIMP
|
|||
if (NS_FAILED(rc))
|
||||
return rc;
|
||||
PRUint16 f;
|
||||
unsigned int n;
|
||||
int r = PR_sscanf(NS_ConvertUCS2toUTF8(value).get(), " %hu %n", &f, &n);
|
||||
PRUint32 n;
|
||||
PRInt32 r = PR_sscanf(NS_ConvertUCS2toUTF8(value).get(), " %hu %n", &f, &n);
|
||||
if (r == 0 || n < value.Length())
|
||||
return SOAP_EXCEPTION(NS_ERROR_ILLEGAL_VALUE,"SOAP_ILLEGAL_USHORT","Illegal value discovered for unsigned short");
|
||||
|
||||
|
@ -3256,8 +3210,8 @@ NS_IMETHODIMP
|
|||
if (NS_FAILED(rc))
|
||||
return rc;
|
||||
PRUint16 f;
|
||||
unsigned int n;
|
||||
int r = PR_sscanf(NS_ConvertUCS2toUTF8(value).get(), " %hu %n", &f, &n);
|
||||
PRUint32 n;
|
||||
PRInt32 r = PR_sscanf(NS_ConvertUCS2toUTF8(value).get(), " %hu %n", &f, &n);
|
||||
if (r == 0 || n < value.Length() || f > 255)
|
||||
return SOAP_EXCEPTION(NS_ERROR_ILLEGAL_VALUE,"SOAP_ILLEGAL_UBYTE","Illegal value discovered for unsigned byte");
|
||||
|
||||
|
|
|
@ -131,14 +131,14 @@ static nsresult GetTransportURI(nsISOAPCall * aCall, nsAString & aURI)
|
|||
if (NS_FAILED(rc))
|
||||
return rc;
|
||||
if (!principal) {
|
||||
return NS_ERROR_FAILURE; // There must be a principal to send a source-verified message.
|
||||
return SOAP_EXCEPTION(NS_ERROR_FAILURE,"SOAP_INVOKE_VERIFY_PRINCIPAL", "Source-verified message cannot be sent without principal.");
|
||||
}
|
||||
nsCOMPtr<nsICodebasePrincipal> codebase = do_QueryInterface(principal,&rc);
|
||||
if (NS_FAILED(rc))
|
||||
return rc;
|
||||
|
||||
if (!codebase) {
|
||||
return NS_ERROR_FAILURE; // There must be a principal to send a source-verified message.
|
||||
return SOAP_EXCEPTION(NS_ERROR_FAILURE,"SOAP_INVOKE_VERIFY_CODEBASE", "Source-verified message cannot be sent without codebase.");
|
||||
}
|
||||
|
||||
char* str;
|
||||
|
@ -158,7 +158,7 @@ static nsresult GetTransportURI(nsISOAPCall * aCall, nsAString & aURI)
|
|||
if (NS_FAILED(rc))
|
||||
return rc;
|
||||
if (!element)
|
||||
return NS_ERROR_FAILURE;
|
||||
return SOAP_EXCEPTION(NS_ERROR_FAILURE,"SOAP_INVOKE_VERIFY_HEADER", "Source-verified message cannot be sent without a header.");
|
||||
// Node ignored on remove / append calls
|
||||
nsCOMPtr<nsIDOMNode> ignore;
|
||||
// Remove any existing elements that may conflict with this verifySource identification
|
||||
|
@ -265,14 +265,14 @@ NS_IMETHODIMP nsHTTPSOAPTransport::SyncCall(nsISOAPCall * aCall, nsISOAPResponse
|
|||
if (NS_FAILED(rv))
|
||||
return rv;
|
||||
if (!messageDocument)
|
||||
return NS_ERROR_NOT_INITIALIZED;
|
||||
return SOAP_EXCEPTION(NS_ERROR_NOT_INITIALIZED,"SOAP_MESSAGE_DOCUMENT", "No message document is present.");
|
||||
|
||||
nsAutoString uri;
|
||||
rv = GetTransportURI(aCall, uri);
|
||||
if (NS_FAILED(rv))
|
||||
return rv;
|
||||
if (AStringIsNull(uri))
|
||||
return NS_ERROR_NOT_INITIALIZED;
|
||||
return SOAP_EXCEPTION(NS_ERROR_NOT_INITIALIZED,"SOAP_TRANSPORT_URI", "No transport URI was specified.");
|
||||
|
||||
DEBUG_DUMP_DOCUMENT("Synchronous Request", messageDocument)
|
||||
|
||||
|
@ -457,7 +457,7 @@ NS_IMETHODIMP
|
|||
if (NS_FAILED(rv))
|
||||
return rv;
|
||||
if (!messageDocument)
|
||||
return NS_ERROR_NOT_INITIALIZED;
|
||||
return SOAP_EXCEPTION(NS_ERROR_NOT_INITIALIZED,"SOAP_MESSAGE_DOCUMENT", "No message document is present.");
|
||||
|
||||
request = do_CreateInstance(NS_XMLHTTPREQUEST_CONTRACTID, &rv);
|
||||
if (NS_FAILED(rv))
|
||||
|
@ -473,7 +473,7 @@ NS_IMETHODIMP
|
|||
if (NS_FAILED(rv))
|
||||
return rv;
|
||||
if (AStringIsNull(uri))
|
||||
return NS_ERROR_NOT_INITIALIZED;
|
||||
return SOAP_EXCEPTION(NS_ERROR_NOT_INITIALIZED,"SOAP_TRANSPORT_URI", "No transport URI was specified.");
|
||||
|
||||
DEBUG_DUMP_DOCUMENT("Asynchronous Request", messageDocument)
|
||||
rv = request->OpenRequest("POST", NS_ConvertUCS2toUTF8(uri).get(),
|
||||
|
|
|
@ -43,6 +43,7 @@
|
|||
#include "nsIServiceManager.h"
|
||||
#include "nsISOAPAttachments.h"
|
||||
#include "nsISOAPMessage.h"
|
||||
#include "nsSOAPException.h"
|
||||
|
||||
nsSOAPBlock::nsSOAPBlock()
|
||||
{
|
||||
|
@ -63,7 +64,7 @@ NS_IMETHODIMP nsSOAPBlock::Init(nsISOAPAttachments * aAttachments,
|
|||
mVersion = aVersion;
|
||||
return NS_OK;
|
||||
}
|
||||
return NS_ERROR_ILLEGAL_VALUE;
|
||||
return SOAP_EXCEPTION(NS_ERROR_ILLEGAL_VALUE,"SOAP_BAD_VERSION", "Bad version used to initialize block.");
|
||||
}
|
||||
|
||||
/* attribute AString namespaceURI; */
|
||||
|
@ -177,7 +178,7 @@ NS_IMETHODIMP nsSOAPBlock::GetValue(nsIVariant * *aValue)
|
|||
mEncoding->Decode(mElement, mSchemaType, mAttachments,
|
||||
getter_AddRefs(mValue));
|
||||
} else {
|
||||
mStatus = NS_ERROR_NOT_INITIALIZED;
|
||||
mStatus = SOAP_EXCEPTION(NS_ERROR_NOT_INITIALIZED,"SOAP_NO_ENCODING","No encoding found to decode block.");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -202,19 +203,24 @@ NS_IMETHODIMP
|
|||
|
||||
// Get the arguments.
|
||||
|
||||
nsCOMPtr < nsIVariant > value;
|
||||
|
||||
nsAutoString name;
|
||||
nsAutoString namespaceURI;
|
||||
nsCOMPtr < nsISupports > schemaType;
|
||||
nsCOMPtr < nsISupports > encoding;
|
||||
nsIVariant* s1 = nsnull;
|
||||
nsISupports* s2 = nsnull;
|
||||
nsISupports* s3 = nsnull;
|
||||
|
||||
if (!JS_ConvertArguments(cx, argc, argv, "/%iv %is %is %ip %ip",
|
||||
getter_AddRefs(value),
|
||||
&s1,
|
||||
NS_STATIC_CAST(nsAString *, &name),
|
||||
NS_STATIC_CAST(nsAString *, &namespaceURI),
|
||||
getter_AddRefs(schemaType),
|
||||
getter_AddRefs(encoding)))
|
||||
return NS_ERROR_ILLEGAL_VALUE;
|
||||
&s2,
|
||||
&s3))
|
||||
return SOAP_EXCEPTION(NS_ERROR_ILLEGAL_VALUE,"SOAP_BLOCK_INIT", "Could not interpret block initialization arguments.");
|
||||
|
||||
nsCOMPtr < nsIVariant > value = dont_AddRef(s1);
|
||||
nsCOMPtr < nsISupports > schemaType = dont_AddRef(s2);
|
||||
nsCOMPtr < nsISupports > encoding = dont_AddRef(s3);
|
||||
|
||||
nsresult rc = SetValue(value);
|
||||
if (NS_FAILED(rc))
|
||||
|
|
|
@ -44,6 +44,7 @@
|
|||
#include "nsIComponentManager.h"
|
||||
#include "nsIURI.h"
|
||||
#include "nsNetUtil.h"
|
||||
#include "nsSOAPException.h"
|
||||
|
||||
/////////////////////////////////////////////
|
||||
//
|
||||
|
@ -130,7 +131,7 @@ NS_IMETHODIMP nsSOAPCall::Invoke(nsISOAPResponse ** _retval)
|
|||
nsCOMPtr < nsISOAPTransport > transport;
|
||||
|
||||
if (mTransportURI.Length() == 0) {
|
||||
return NS_ERROR_NOT_INITIALIZED;
|
||||
return SOAP_EXCEPTION(NS_ERROR_NOT_INITIALIZED,"SOAP_TRANSPORT_URI", "No transport URI was specified.");
|
||||
}
|
||||
|
||||
rv = GetTransport(getter_AddRefs(transport));
|
||||
|
@ -172,7 +173,7 @@ NS_IMETHODIMP
|
|||
nsCOMPtr < nsISOAPTransport > transport;
|
||||
|
||||
if (mTransportURI.Length() == 0) {
|
||||
return NS_ERROR_NOT_INITIALIZED;
|
||||
return SOAP_EXCEPTION(NS_ERROR_NOT_INITIALIZED,"SOAP_TRANSPORT_URI", "No transport URI was specified.");
|
||||
}
|
||||
|
||||
rv = GetTransport(getter_AddRefs(transport));
|
||||
|
|
|
@ -43,6 +43,7 @@
|
|||
#include "nsISOAPDecoder.h"
|
||||
#include "nsSOAPEncoding.h"
|
||||
#include "nsSOAPUtils.h"
|
||||
#include "nsSOAPException.h"
|
||||
#include "nsIServiceManager.h"
|
||||
#include "nsIComponentManager.h"
|
||||
#include "nsIDOMNodeList.h"
|
||||
|
@ -57,7 +58,11 @@ NS_IMPL_ISUPPORTS1(nsSOAPEncodingRegistry, nsISOAPEncoding) nsSOAPEncodingRegist
|
|||
NS_INIT_ISUPPORTS();
|
||||
|
||||
nsAutoString style;
|
||||
aEncoding->GetStyleURI(style);
|
||||
nsresult rc = aEncoding->GetStyleURI(style);
|
||||
if (NS_FAILED(rc)) {
|
||||
mEncodings = nsnull;
|
||||
}
|
||||
// If there are any failures, encodings becomes null, and calls fail.
|
||||
nsStringKey styleKey(style);
|
||||
mEncodings->Put(&styleKey, aEncoding);
|
||||
/* member initializers and constructor code */
|
||||
|
@ -76,6 +81,8 @@ GetAssociatedEncoding(const nsAString & aStyleURI, PRBool aCreateIf,
|
|||
{
|
||||
NS_SOAP_ENSURE_ARG_STRING(aStyleURI);
|
||||
NS_ENSURE_ARG_POINTER(aEncoding);
|
||||
if (!mEncodings)
|
||||
return NS_ERROR_FAILURE;
|
||||
nsStringKey styleKey(aStyleURI);
|
||||
*aEncoding = (nsISOAPEncoding *) mEncodings->Get(&styleKey);
|
||||
if (!*aEncoding) {
|
||||
|
@ -87,8 +94,14 @@ GetAssociatedEncoding(const nsAString & aStyleURI, PRBool aCreateIf,
|
|||
if (defaultEncoding || aCreateIf) {
|
||||
nsCOMPtr < nsISOAPEncoding > encoding = new nsSOAPEncoding(aStyleURI,this,defaultEncoding);
|
||||
*aEncoding = encoding;
|
||||
NS_IF_ADDREF(*aEncoding);
|
||||
mEncodings->Put(&styleKey, encoding);
|
||||
if (encoding) {
|
||||
NS_ADDREF(*aEncoding);
|
||||
mEncodings->Put(&styleKey, encoding);
|
||||
}
|
||||
else
|
||||
{
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
}
|
||||
}
|
||||
return NS_OK;
|
||||
|
@ -279,6 +292,8 @@ nsresult
|
|||
aSchemaCollection)
|
||||
{
|
||||
NS_ENSURE_ARG(aSchemaCollection);
|
||||
if (!mRegistry)
|
||||
return NS_ERROR_FAILURE;
|
||||
return mRegistry->SetSchemaCollection(aSchemaCollection);
|
||||
}
|
||||
|
||||
|
@ -287,6 +302,8 @@ nsresult
|
|||
aSchemaCollection)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aSchemaCollection);
|
||||
if (!mRegistry)
|
||||
return NS_ERROR_FAILURE;
|
||||
return mRegistry->GetSchemaCollection(aSchemaCollection);
|
||||
}
|
||||
|
||||
|
@ -306,6 +323,8 @@ NS_IMETHODIMP
|
|||
{
|
||||
NS_SOAP_ENSURE_ARG_STRING(aStyleURI);
|
||||
NS_ENSURE_ARG_POINTER(_retval);
|
||||
if (!mRegistry)
|
||||
return NS_ERROR_FAILURE;
|
||||
return mRegistry->GetAssociatedEncoding(aStyleURI, aCreateIf, _retval);
|
||||
}
|
||||
|
||||
|
@ -394,7 +413,7 @@ NS_IMETHODIMP
|
|||
_retval);
|
||||
}
|
||||
*_retval = nsnull;
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
return SOAP_EXCEPTION(NS_ERROR_NOT_IMPLEMENTED,"SOAP_DEFAULT_ENCODER", "Encoding style does not have a default encoder.");
|
||||
}
|
||||
|
||||
/* nsIVariant decode (in nsIDOMElement aSource, in nsISchemaType aSchemaType, in nsISOAPAttachments aAttachments); */
|
||||
|
@ -415,7 +434,7 @@ NS_IMETHODIMP
|
|||
_retval);
|
||||
}
|
||||
*_retval = nsnull;
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
return SOAP_EXCEPTION(NS_ERROR_NOT_IMPLEMENTED,"SOAP_DEFAULT_ENCODER", "Encoding style does not have a default decoder.");
|
||||
}
|
||||
|
||||
/* attribute nsISOAPEncoder defaultEncoder; */
|
||||
|
@ -449,7 +468,6 @@ NS_IMETHODIMP
|
|||
*aDefaultDecoder = mDefaultDecoder;
|
||||
NS_IF_ADDREF(*aDefaultDecoder);
|
||||
return NS_OK;
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
|
@ -465,7 +483,7 @@ NS_IMETHODIMP nsSOAPEncoding::MapSchemaURI(const nsAString & aExternalURI, const
|
|||
NS_ENSURE_ARG_POINTER(&aExternalURI);
|
||||
NS_ENSURE_ARG_POINTER(&aInternalURI);
|
||||
if (aExternalURI.IsEmpty() || aInternalURI.IsEmpty()) // Permit no empty URIs.
|
||||
return NS_ERROR_ILLEGAL_VALUE;
|
||||
return SOAP_EXCEPTION(NS_ERROR_ILLEGAL_VALUE,"SOAP_SCHEMA_URI_MAPPING", "No schema URI mapping possible of empty strings.");
|
||||
nsStringKey externalKey(aExternalURI);
|
||||
if (mMappedExternal->Exists(&externalKey)) {
|
||||
*_retval = PR_FALSE; // Do not permit duplicate external
|
||||
|
|
|
@ -40,6 +40,7 @@
|
|||
#include "nsSOAPUtils.h"
|
||||
#include "nsIDOMNodeList.h"
|
||||
#include "nsISOAPMessage.h"
|
||||
#include "nsSOAPException.h"
|
||||
|
||||
static NS_NAMED_LITERAL_STRING(kEmpty, "");
|
||||
|
||||
|
@ -74,10 +75,10 @@ NS_IMETHODIMP nsSOAPFault::SetElement(nsIDOMElement * aElement)
|
|||
kSOAPEnvURI[nsISOAPMessage::VERSION_1_1])) {
|
||||
mVersion = nsISOAPMessage::VERSION_1_1;
|
||||
} else {
|
||||
return NS_ERROR_ILLEGAL_VALUE;
|
||||
return SOAP_EXCEPTION(NS_ERROR_ILLEGAL_VALUE,"SOAP_BADFAULT", "Cannot recognize SOAP version from namespace URI of fault");
|
||||
}
|
||||
} else {
|
||||
return NS_ERROR_ILLEGAL_VALUE;
|
||||
return SOAP_EXCEPTION(NS_ERROR_ILLEGAL_VALUE,"SOAP_BADFAULT", "Cannot recognize element tag of fault.");
|
||||
}
|
||||
}
|
||||
mFaultElement = aElement;
|
||||
|
@ -106,7 +107,9 @@ NS_IMETHODIMP nsSOAPFault::GetFaultCode(nsAString & aFaultCode)
|
|||
getter_AddRefs(faultcode));
|
||||
if (faultcode) {
|
||||
nsAutoString combined;
|
||||
nsSOAPUtils::GetElementTextContent(faultcode, combined);
|
||||
nsresult rc = nsSOAPUtils::GetElementTextContent(faultcode, combined);
|
||||
if (NS_FAILED(rc))
|
||||
return rc;
|
||||
return nsSOAPUtils::GetLocalName(combined, aFaultCode);
|
||||
}
|
||||
return NS_OK;
|
||||
|
@ -126,7 +129,9 @@ NS_IMETHODIMP nsSOAPFault::GetFaultNamespaceURI(nsAString & aNamespaceURI)
|
|||
getter_AddRefs(faultcode));
|
||||
if (faultcode) {
|
||||
nsAutoString combined;
|
||||
nsSOAPUtils::GetElementTextContent(faultcode, combined);
|
||||
nsresult rc = nsSOAPUtils::GetElementTextContent(faultcode, combined);
|
||||
if (NS_FAILED(rc))
|
||||
return rc;
|
||||
return nsSOAPUtils::GetNamespaceURI(nsnull, faultcode, combined, aNamespaceURI);
|
||||
}
|
||||
return NS_OK;
|
||||
|
@ -146,7 +151,9 @@ NS_IMETHODIMP nsSOAPFault::GetFaultString(nsAString & aFaultString)
|
|||
nsSOAPUtils::kFaultStringTagName,
|
||||
getter_AddRefs(element));
|
||||
if (element) {
|
||||
nsSOAPUtils::GetElementTextContent(element, aFaultString);
|
||||
nsresult rc = nsSOAPUtils::GetElementTextContent(element, aFaultString);
|
||||
if (NS_FAILED(rc))
|
||||
return rc;
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
@ -165,7 +172,9 @@ NS_IMETHODIMP nsSOAPFault::GetFaultActor(nsAString & aFaultActor)
|
|||
nsSOAPUtils::kFaultActorTagName,
|
||||
getter_AddRefs(element));
|
||||
if (element) {
|
||||
nsSOAPUtils::GetElementTextContent(element, aFaultActor);
|
||||
nsresult rc = nsSOAPUtils::GetElementTextContent(element, aFaultActor);
|
||||
if (NS_FAILED(rc))
|
||||
return rc;
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
|
|
@ -43,6 +43,7 @@
|
|||
#include "nsIServiceManager.h"
|
||||
#include "nsISOAPAttachments.h"
|
||||
#include "nsISOAPMessage.h"
|
||||
#include "nsSOAPException.h"
|
||||
|
||||
nsSOAPHeaderBlock::nsSOAPHeaderBlock()
|
||||
{
|
||||
|
@ -67,7 +68,7 @@ NS_IMETHODIMP nsSOAPHeaderBlock::GetActorURI(nsAString & aActorURI)
|
|||
NS_ENSURE_ARG_POINTER(&aActorURI);
|
||||
if (mElement) {
|
||||
if (mVersion == nsISOAPMessage::VERSION_UNKNOWN)
|
||||
return NS_ERROR_NOT_AVAILABLE;
|
||||
return SOAP_EXCEPTION(NS_ERROR_NOT_AVAILABLE,"SOAP_HEADER_INIT", "Header has not been properly initialized.");
|
||||
return mElement->GetAttributeNS(*nsSOAPUtils::kSOAPEnvURI[mVersion],
|
||||
nsSOAPUtils::kActorAttribute,
|
||||
aActorURI);
|
||||
|
@ -93,7 +94,7 @@ NS_IMETHODIMP nsSOAPHeaderBlock::GetMustUnderstand(PRBool *
|
|||
NS_ENSURE_ARG_POINTER(&aMustUnderstand);
|
||||
if (mElement) {
|
||||
if (mVersion == nsISOAPMessage::VERSION_UNKNOWN)
|
||||
return NS_ERROR_NOT_AVAILABLE;
|
||||
return SOAP_EXCEPTION(NS_ERROR_NOT_AVAILABLE,"SOAP_HEADER_INIT", "Header has not been properly initialized.");
|
||||
nsAutoString m;
|
||||
nsresult
|
||||
rc =
|
||||
|
@ -111,7 +112,7 @@ NS_IMETHODIMP nsSOAPHeaderBlock::GetMustUnderstand(PRBool *
|
|||
|| m.Equals(nsSOAPUtils::kFalseA))
|
||||
*aMustUnderstand = PR_FALSE;
|
||||
else
|
||||
return NS_ERROR_ILLEGAL_VALUE;
|
||||
return SOAP_EXCEPTION(NS_ERROR_ILLEGAL_VALUE,"SOAP_HEADER_MUSTUNDERSTAND", "Must understand value in header has an illegal value.");
|
||||
return NS_OK;
|
||||
} else {
|
||||
*aMustUnderstand = mMustUnderstand;
|
||||
|
|
|
@ -44,6 +44,7 @@
|
|||
#include "nsSOAPParameter.h"
|
||||
#include "nsSOAPHeaderBlock.h"
|
||||
#include "nsSOAPEncoding.h"
|
||||
#include "nsSOAPException.h"
|
||||
#include "nsIDOMDocument.h"
|
||||
#include "nsIDOMAttr.h"
|
||||
#include "nsIDOMParser.h"
|
||||
|
@ -299,7 +300,7 @@ NS_IMETHODIMP
|
|||
NS_ENSURE_ARG_POINTER(&aTargetObjectURI);
|
||||
if (aVersion != nsISOAPMessage::VERSION_1_1
|
||||
&& aVersion != nsISOAPMessage::VERSION_1_2)
|
||||
return NS_ERROR_ILLEGAL_VALUE;
|
||||
return SOAP_EXCEPTION(NS_ERROR_ILLEGAL_VALUE,"SOAP_BAD_VALUE","Cannot encode message blocks without a valid SOAP version specified.");
|
||||
|
||||
// Construct the message skeleton
|
||||
|
||||
|
@ -373,7 +374,7 @@ NS_IMETHODIMP
|
|||
for (i = 0; i < aHeaderBlockCount; i++) {
|
||||
header = aHeaderBlocks[i];
|
||||
if (!header)
|
||||
return NS_ERROR_FAILURE;
|
||||
return SOAP_EXCEPTION(NS_ERROR_ILLEGAL_VALUE,"SOAP_NULL_HEADER","Cannot encode null in header array.");
|
||||
rv = header->GetElement(getter_AddRefs(element));
|
||||
if (element) {
|
||||
nsCOMPtr < nsIDOMNode > node1;
|
||||
|
@ -478,7 +479,7 @@ NS_IMETHODIMP
|
|||
for (i = 0; i < aParameterCount; i++) {
|
||||
param = aParameters[i];
|
||||
if (!param)
|
||||
return NS_ERROR_FAILURE;
|
||||
return SOAP_EXCEPTION(NS_ERROR_ILLEGAL_VALUE,"SOAP_NULL_PARAMETER","Cannot encode null in parameter array.");
|
||||
rv = param->GetElement(getter_AddRefs(element));
|
||||
if (element) {
|
||||
nsCOMPtr < nsIDOMNode > node1;
|
||||
|
@ -684,7 +685,7 @@ NS_IMETHODIMP
|
|||
if (!aDocumentStyle) {
|
||||
element = next;
|
||||
if (!element)
|
||||
return NS_ERROR_ILLEGAL_VALUE;
|
||||
return SOAP_EXCEPTION(NS_ERROR_ILLEGAL_VALUE,"SOAP_MISSING_METHOD","Cannot decode rpc-style message due to missing method element.");
|
||||
nsSOAPUtils::GetFirstChildElement(element, getter_AddRefs(next));
|
||||
}
|
||||
nsCOMPtr < nsISOAPEncoding > encoding;
|
||||
|
|
|
@ -251,7 +251,7 @@ NS_IMPL_ISUPPORTS1_CI(nsSOAPPropertyBagMutator, nsISOAPPropertyBagMutator)
|
|||
NS_IMETHODIMP nsSOAPPropertyBagMutator::GetPropertyBag(nsIPropertyBag ** aPropertyBag) {
|
||||
NS_ENSURE_ARG_POINTER(aPropertyBag);
|
||||
*aPropertyBag = mBag;
|
||||
NS_ADDREF(*aPropertyBag);
|
||||
NS_IF_ADDREF(*aPropertyBag);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
@ -261,5 +261,8 @@ NS_IMETHODIMP
|
|||
{
|
||||
NS_ENSURE_ARG_POINTER(&aName);
|
||||
NS_ENSURE_ARG_POINTER(aValue);
|
||||
if (!mSOAPBag) { // In case of initialization failure...
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
return mSOAPBag->SetProperty(aName, aValue);
|
||||
}
|
||||
|
|
|
@ -42,6 +42,7 @@
|
|||
#include "nsIDOMNamedNodeMap.h"
|
||||
#include "nsIDOMAttr.h"
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsSOAPException.h"
|
||||
|
||||
NS_NAMED_LITERAL_STRING(realSOAPEnvURI1,
|
||||
"http://schemas.xmlsoap.org/soap/envelope/");
|
||||
|
@ -270,7 +271,7 @@ nsresult
|
|||
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.
|
||||
return SOAP_EXCEPTION(NS_ERROR_ILLEGAL_VALUE,"SOAP_UNEXPECTED_ELEMENT", "Unable to retrieve simple content because a child element was present.");
|
||||
}
|
||||
nsCOMPtr < nsIDOMNode > temp = child;
|
||||
GetNextSibling(temp, getter_AddRefs(child));
|
||||
|
@ -378,7 +379,7 @@ nsresult
|
|||
current = temp;
|
||||
}
|
||||
if (!current)
|
||||
return NS_ERROR_FAILURE;
|
||||
return SOAP_EXCEPTION(NS_ERROR_FAILURE,"SOAP_NAMESPACE", "Unable to resolve prefix in attribute value to namespace URI");
|
||||
}
|
||||
if (aEncoding) {
|
||||
return aEncoding->GetInternalSchemaURI(result,aURI);
|
||||
|
|
Загрузка…
Ссылка в новой задаче