spacer
Yehuda Shiran November 19, 2001
Checking the Returned Raw SOAP Packet
Tips: November 2001

Yehuda Shiran, Ph.D.
Doc JavaScript

Developer News
Microsoft Shows Off Silverlight 4, IE9 Plans
Metasploit Expands Vulnerability Test Framework
HyperCard Reborn?

The errorDetail object is a property of the result object, and it includes detailed information about the Web service transaction. Here are its properties:

  • code. A machine-readable error code that corresponds to a specific invocation of the callService method.
  • raw. This property exposes the raw Simple Object Access Protocol (SOAP) data packet returned by the Web Service after invoking the callService method.
  • string. A human-readable error message that corresponds to a specific invocation of the callService method.

The onWSresult() function in the following example reads the above parameters of event.result and prints them in a better explanatory fashion:

<SCRIPT language="JavaScript">
<!--
var iCallID;

function init() {
  service.useService("/services/math.asmx?WSDL","MyMath");
  iCallID = service.MyMath.callService("add",5,6);
}

function onWSresult() {  
  if((event.result.error)&&(iCallID==event.result.id)) {    
    var xfaultcode   = event.result.errorDetail.code;
    var xfaultstring = event.result.errorDetail.string;    
    var xfaultsoap   = event.result.errorDetail.raw;
    document.writeln("ERROR. Method call failed!");
    document.writeln("Call ID:" + iCallID);
    document.writeln("Fault Code:" + xfaultcode);
    document.writeln("Fault String:" + xfaultstring);
    document.writeln("SOAP Data:" + xfaultsoap);
  }
  else if(event.result.error == false) {
	     document.writeln("Result received without errors!");
	   }
}
// -->
</SCRIPT>
<BODY onload="init()">
<DIV ID="service" STYLE="behavior:url(webservice.htc)" onresult="onWSresult()">
</DIV>
</BODY>

People who read this tip also read these tips:

Look for similar tips by subject:

internet.commediabistro.comJusttechjobs.comGraphics.com

Search:

WebMediaBrands Corporate Info

Legal Notices, Licensing, Permissions, Privacy Policy.
Advertise | Newsletters | Shopping | E-mail Offers | Freelance Jobs

webref The latest from WebReference.com Browse >
Rolling Out Your Own HTML Application Version Control · HTML 5: Client-side Storage · Working with Ajax Server Extensions
Sitemap · Experts · Tools · Services · Email a Colleague · Contact FREE Newsletters 
 The latest from internet.com
Wi-Fi Product Watch, November 2009 · Chip Market Recovering From '08 Collapse · Low-Cost Tools to Kickstart Your New Business