I think you should double check the "Fault" versus ":Fault" change. I haven't tested the new version on faults yet but I'd be surprised if it worked.
The soapPrefix (poorly named I guess) is intended to contain both the prefix, and the ":", thus the "i+1":
soapPrefix = (i<0) ? "" : response.tagName.substring(0,i+1);
The reason for keeping the ":" with the prefix is to make it easy to support the default namespace, if one were happen to receive an element like:
A prefix of "" + "Fault" would match the tag name, whereas of "" + ":Fault" would not.
And if the i+1 is working correctly you will currently usually end up with "soapenv:" + ":Fault" which is unlikely to work.
Thanks for the other improvements. Once our nightly build launches again I'll test them out.
Jonathan Marsh - http://www.wso2.com - http://auburnmarshes.spaces.live.com
-----Original Message-----
From: wsf-javascript-dev-bounces@wso2.org [mailto:wsf-javascript-dev-bounces@wso2.org] On Behalf Of svn@wso2.org
Sent: Friday, June 01, 2007 8:16 AM
To: wsf-javascript-dev@wso2.org
Subject: [wsf-javascript-dev] svn commit r3454 - trunk/wsf/javascript/native/src
Author: saminda
Date: Fri Jun 1 08:15:49 2007
New Revision: 3454
Modified:
trunk/wsf/javascript/native/src/WSRequest.js
Log:
Fixes for SOAP fault handling
Modified: trunk/wsf/javascript/native/src/WSRequest.js
==============================================================================
--- trunk/wsf/javascript/native/src/WSRequest.js (original)
+++ trunk/wsf/javascript/native/src/WSRequest.js Fri Jun 1 08:15:49 2007
@@ -167,7 +167,10 @@
soapPrefix = (i < 0) ? "" : response.tagName.substring(0, i + 1);
}
var soapBody = response.getElementsByTagName(soapPrefix + "Body")[0];
+
if (soapBody != null && soapBody.hasChildNodes()) {
+ // Need to set the prefix for fault handling
+ soapPrefix = response.prefix;
var newDoc;
if (browser == "gecko")
@@ -187,8 +190,8 @@
this.responseXML = newDoc;
this.responseText = WSRequest.util._serializeToString(newDoc);
- // f (newDoc.documentElement.tagName == soapPrefix + "Fault")
- if (newDoc.documentElement.tagName.indexOf(soapPrefix + "Fault") > -1) {
+
+ if (newDoc.documentElement.tagName == soapPrefix + ":Fault") {
this.error = new WSError();
this.error.code = newDoc.getElementsByTagName("faultcode")[0].firstChild.nodeValue;
this.error.reason = newDoc.getElementsByTagName("faultstring")[0].firstChild.nodeValue;
_______________________________________________
Wsf-javascript-dev mailing list
Wsf-javascript-dev@wso2.org
http://wso2.org/cgi-bin/mailman/listinfo/wsf-javascript-dev
_______________________________________________
Wsf-javascript-dev mailing list
Wsf-javascript-dev@wso2.org
http://wso2.org/cgi-bin/mailman/listinfo/wsf-javascript-dev