Skip to content
Snippets Groups Projects
Commit 48824e5c authored by rayw%netscape.com's avatar rayw%netscape.com
Browse files

Fixed errors in mustUnderstand attribute of header block.

Not part of default build.
parent 95363285
No related branches found
No related tags found
No related merge requests found
Showing
with 36 additions and 20 deletions
......@@ -70,13 +70,16 @@ interface nsISOAPBlock : nsISupports {
/**
* The encoding that was / will be applied to the
* block.
* block. If this is blank and element is non-null,
* it becomes impossible to decode the block when
* the value is requested.
*/
attribute nsISOAPEncoding encoding;
/**
* The schema type used to encode or decode the
* block.
* block. If this is null, then the default
* encoder or decoder may
*/
attribute nsISchemaType schemaType;
......
......@@ -149,8 +149,9 @@ NS_IMETHODIMP nsSOAPBlock::GetValue(nsIVariant* * aValue)
}
*aValue = mValue;
NS_IF_ADDREF(*aValue);
return NS_OK;
return mElement ? mStatus : NS_OK;
}
NS_IMETHODIMP nsSOAPBlock::SetValue(nsIVariant* aValue)
{
nsresult rc = SetElement(nsnull);
......
......@@ -47,10 +47,4 @@ public:
protected:
nsCOMPtr<nsIDOMElement> mFaultElement;
};
#define NS_SOAPFAULT_CID \
{ /* cb8cd1ae-1dd1-11b2-9954-e393ae604c08 */ \
0xcb8cd1ae, 0x1dd2, 0x11b2, \
{0x99, 0x54, 0xe3, 0x93, 0xae, 0x60, 0x4c, 0x08} }
#define NS_SOAPFAULT_CONTRACTID "@mozilla.org/xmlextras/soap/fault;1"
#endif
......@@ -75,7 +75,7 @@ NS_IMETHODIMP nsSOAPHeaderBlock::GetMustUnderstand(PRBool * aMustUnderstand)
NS_ENSURE_ARG_POINTER(&aMustUnderstand);
if (mElement) {
nsAutoString m;
nsresult rc = mElement->GetAttributeNS(nsSOAPUtils::kSOAPEnvURI,nsSOAPUtils::kActorAttribute,m);
nsresult rc = mElement->GetAttributeNS(nsSOAPUtils::kSOAPEnvURI,nsSOAPUtils::kMustUnderstandAttribute,m);
if (NS_FAILED(rc)) return rc;
if (m.Length() == 0) *aMustUnderstand = PR_FALSE;
else if (m.Equals(nsSOAPUtils::kTrueA) || m.Equals(nsSOAPUtils::kTrueA)) *aMustUnderstand = PR_TRUE;
......
......@@ -221,6 +221,7 @@ NS_IMETHODIMP nsSOAPMessage::Encode(const nsAString & aMethodName, const nsAStri
nsAutoString name;
nsAutoString namespaceURI;
nsAutoString actorURI;
PRBool mustUnderstand;
for (PRUint32 i = 0; i < aHeaderBlockCount; i++) {
header = aHeaderBlocks[i];
if (!header) return NS_ERROR_FAILURE;
......@@ -241,6 +242,8 @@ NS_IMETHODIMP nsSOAPMessage::Encode(const nsAString & aMethodName, const nsAStri
if (NS_FAILED(rv)) return rv;
rv = header->GetActorURI(actorURI);
if (NS_FAILED(rv)) return rv;
rv = header->GetMustUnderstand(&mustUnderstand);
if (NS_FAILED(rv)) return rv;
rv = header->GetEncoding(getter_AddRefs(encoding));
if (NS_FAILED(rv)) return rv;
if (!encoding) {
......@@ -256,7 +259,12 @@ NS_IMETHODIMP nsSOAPMessage::Encode(const nsAString & aMethodName, const nsAStri
if (NS_FAILED(rv)) return rv;
if (!actorURI.IsEmpty()) {
element->SetAttributeNS(nsSOAPUtils::kSOAPEnvPrefix, nsSOAPUtils::kActorAttribute, actorURI);
if (NS_FAILED(rv)) return rv;
}
if (mustUnderstand) {
element->SetAttributeNS(nsSOAPUtils::kSOAPEnvPrefix, nsSOAPUtils::kMustUnderstandAttribute, nsSOAPUtils::kTrue);
if (NS_FAILED(rv)) return rv;
}
if (mEncoding != encoding) {
nsAutoString enc;
encoding->GetStyleURI(enc);
......
......@@ -38,6 +38,7 @@ NS_NAMED_LITERAL_STRING(nsSOAPUtils::kXSPrefix,"xs");
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::kMustUnderstandAttribute,"mustUnderstand");
NS_NAMED_LITERAL_STRING(nsSOAPUtils::kEnvelopeTagName,"Envelope");
NS_NAMED_LITERAL_STRING(nsSOAPUtils::kHeaderTagName,"Header");
NS_NAMED_LITERAL_STRING(nsSOAPUtils::kBodyTagName,"Body");
......
......@@ -75,6 +75,7 @@ public:
static nsDependentString kXSDPrefix;
static nsDependentString kEncodingStyleAttribute;
static nsDependentString kActorAttribute;
static nsDependentString kMustUnderstandAttribute;
static nsDependentString kEnvelopeTagName;
static nsDependentString kHeaderTagName;
static nsDependentString kBodyTagName;
......
......@@ -70,13 +70,16 @@ interface nsISOAPBlock : nsISupports {
/**
* The encoding that was / will be applied to the
* block.
* block. If this is blank and element is non-null,
* it becomes impossible to decode the block when
* the value is requested.
*/
attribute nsISOAPEncoding encoding;
/**
* The schema type used to encode or decode the
* block.
* block. If this is null, then the default
* encoder or decoder may
*/
attribute nsISchemaType schemaType;
......
......@@ -149,8 +149,9 @@ NS_IMETHODIMP nsSOAPBlock::GetValue(nsIVariant* * aValue)
}
*aValue = mValue;
NS_IF_ADDREF(*aValue);
return NS_OK;
return mElement ? mStatus : NS_OK;
}
NS_IMETHODIMP nsSOAPBlock::SetValue(nsIVariant* aValue)
{
nsresult rc = SetElement(nsnull);
......
......@@ -47,10 +47,4 @@ public:
protected:
nsCOMPtr<nsIDOMElement> mFaultElement;
};
#define NS_SOAPFAULT_CID \
{ /* cb8cd1ae-1dd1-11b2-9954-e393ae604c08 */ \
0xcb8cd1ae, 0x1dd2, 0x11b2, \
{0x99, 0x54, 0xe3, 0x93, 0xae, 0x60, 0x4c, 0x08} }
#define NS_SOAPFAULT_CONTRACTID "@mozilla.org/xmlextras/soap/fault;1"
#endif
......@@ -75,7 +75,7 @@ NS_IMETHODIMP nsSOAPHeaderBlock::GetMustUnderstand(PRBool * aMustUnderstand)
NS_ENSURE_ARG_POINTER(&aMustUnderstand);
if (mElement) {
nsAutoString m;
nsresult rc = mElement->GetAttributeNS(nsSOAPUtils::kSOAPEnvURI,nsSOAPUtils::kActorAttribute,m);
nsresult rc = mElement->GetAttributeNS(nsSOAPUtils::kSOAPEnvURI,nsSOAPUtils::kMustUnderstandAttribute,m);
if (NS_FAILED(rc)) return rc;
if (m.Length() == 0) *aMustUnderstand = PR_FALSE;
else if (m.Equals(nsSOAPUtils::kTrueA) || m.Equals(nsSOAPUtils::kTrueA)) *aMustUnderstand = PR_TRUE;
......
......@@ -221,6 +221,7 @@ NS_IMETHODIMP nsSOAPMessage::Encode(const nsAString & aMethodName, const nsAStri
nsAutoString name;
nsAutoString namespaceURI;
nsAutoString actorURI;
PRBool mustUnderstand;
for (PRUint32 i = 0; i < aHeaderBlockCount; i++) {
header = aHeaderBlocks[i];
if (!header) return NS_ERROR_FAILURE;
......@@ -241,6 +242,8 @@ NS_IMETHODIMP nsSOAPMessage::Encode(const nsAString & aMethodName, const nsAStri
if (NS_FAILED(rv)) return rv;
rv = header->GetActorURI(actorURI);
if (NS_FAILED(rv)) return rv;
rv = header->GetMustUnderstand(&mustUnderstand);
if (NS_FAILED(rv)) return rv;
rv = header->GetEncoding(getter_AddRefs(encoding));
if (NS_FAILED(rv)) return rv;
if (!encoding) {
......@@ -256,7 +259,12 @@ NS_IMETHODIMP nsSOAPMessage::Encode(const nsAString & aMethodName, const nsAStri
if (NS_FAILED(rv)) return rv;
if (!actorURI.IsEmpty()) {
element->SetAttributeNS(nsSOAPUtils::kSOAPEnvPrefix, nsSOAPUtils::kActorAttribute, actorURI);
if (NS_FAILED(rv)) return rv;
}
if (mustUnderstand) {
element->SetAttributeNS(nsSOAPUtils::kSOAPEnvPrefix, nsSOAPUtils::kMustUnderstandAttribute, nsSOAPUtils::kTrue);
if (NS_FAILED(rv)) return rv;
}
if (mEncoding != encoding) {
nsAutoString enc;
encoding->GetStyleURI(enc);
......
......@@ -38,6 +38,7 @@ NS_NAMED_LITERAL_STRING(nsSOAPUtils::kXSPrefix,"xs");
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::kMustUnderstandAttribute,"mustUnderstand");
NS_NAMED_LITERAL_STRING(nsSOAPUtils::kEnvelopeTagName,"Envelope");
NS_NAMED_LITERAL_STRING(nsSOAPUtils::kHeaderTagName,"Header");
NS_NAMED_LITERAL_STRING(nsSOAPUtils::kBodyTagName,"Body");
......
......@@ -75,6 +75,7 @@ public:
static nsDependentString kXSDPrefix;
static nsDependentString kEncodingStyleAttribute;
static nsDependentString kActorAttribute;
static nsDependentString kMustUnderstandAttribute;
static nsDependentString kEnvelopeTagName;
static nsDependentString kHeaderTagName;
static nsDependentString kBodyTagName;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment