function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
talanbtalanb 

SoapFault object not getting populated

The SoapFault object does not appear to be getting set correctly in all cases. I am seeing a SoapFault object returned from Create with a blank faultcode and faultstring, but the SOAP XML I get back is the following:

<?xml version="1.0" encoding="UTF-8"?>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<soapenv:Body>
<soapenv:Fault>
<faultcode>soapenv:Server</faultcode>
<faultstring>java.lang.NumberFormatException: empty String</faultstring>
<detail/>
</soapenv:Fault>
</soapenv:Body>
</soapenv:Envelope>

Thanks!

Todd Breiholz
Meredith Corporation
SuperfellSuperfell
What client tool are you using, the faultcode & faultstring are obviously in the response message.
talanbtalanb
This is using the AJAX Toolkit.

Todd Breiholz
Meredith Corporation
DevAngelDevAngel

Hi talanb,

Looks like a bug in the AJAX toolkit.  I'll have a look and will get it fixed.  Thanks for the heads up.

DevAngelDevAngel

Well, I can't reproduce.  Can you post the request (minus any sensitive info like session id)?  When I create a soap fault using the code below, it seems to be populated ok.

function init() {
	var fault = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" + 
				"<soapenv:Envelope xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\">" + 
				"<soapenv:Body>" + 
				"<soapenv:Fault>" + 
				"<faultcode>soapenv:Server</faultcode>" +
				"<faultstring>java.lang.NumberFormatException: empty String</faultstring>" +
				"<detail/>" + 
				"</soapenv:Fault>" +
				"</soapenv:Body>" +
				"</soapenv:Envelope>";
	var dom = new ActiveXObject("Msxml.DOMDocument");
	dom.loadXML(fault);
	var sf = new SoapFault(dom);
	alert(sf.toString());
	alert(sf.faultstring);
}
 
DevAngelDevAngel

Hi Todd,

Let me guess, this is happening in firefox right?

Ok, I did find a bug for the deserializer that prevented the SoapFault from being properly deserialized.

Until a patch is published you can paste the following code into your scontrol and it will override the toolkit version of this function:

_getImmediateChildElementByName = function(node, name) {
  if (window.XMLHttpRequest) { 
    if (node.getElementsByTagName(name) == null) {
	  return null;
	} else {
	  var xnode = node.getElementsByTagName(name); 
	  if (xnode.length > 0) {
	    if (xnode.length == 1) {
		  return xnode[0];
		} else {
		  for (var i=0;i<xnode.length;i++) {
		    if (xnode[i].parentNode == node ) {
			  return xnode[i];
			}
		  }
		}
		return null;
	  } else {
	    return null;
	  } 
	}
  } else { 
    var ret = node.getElementsByTagName(name);
	if (ret.length == 0) {
	  ret = node.getElementsByTagName("sf:" + name);
	}
	if (ret.length > 0) {
	  for (var i=0;i<ret.length;i++) {
	    if (node.baseName != "") {
          if (ret[i].parentNode == node) {
		    return ret[i];
		  }
		} else {
		  return ret[i];
		} 
      }
	  return null;
	} else {
	  return null;
	}
  } 
};

Message Edited by DevAngel on 08-22-2005 12:30 PM