2002-01-18 20:09:06 +00:00
|
|
|
<HTML>
|
|
|
|
<HEAD>
|
|
|
|
</HEAD>
|
2002-03-19 00:08:15 +00:00
|
|
|
<BODY onload="soapcall()">
|
2002-01-18 20:09:06 +00:00
|
|
|
<H1>SOAP Test: Statistics</H1>
|
2002-03-19 00:08:15 +00:00
|
|
|
This passes an array to request the average and standard deviation. This
|
|
|
|
uses the low-level SOAP API of Mozilla directly, not hiding the use of the
|
|
|
|
API in separate proxy objects as other examples may do.
|
|
|
|
<p>View the source of this page for details on how it was called. If you
|
|
|
|
compile mozilla DEBUG, the message sent and received will be logged to the
|
|
|
|
console.
|
2002-01-18 20:09:06 +00:00
|
|
|
<p>This works by calling a SOAP service listed on
|
2002-03-19 00:08:15 +00:00
|
|
|
<A href="http://www.xmethods.com">X Methods Website</A> using the low-level
|
|
|
|
SOAP API in Mozilla.
|
|
|
|
<p>Since this service is not friendly to untrusted applets, it may not be
|
|
|
|
called without requesting additional privileges from the user. It can be
|
|
|
|
made friendly by accepting the verifySource header or by loading the page
|
|
|
|
and proxy from the domain of the service.
|
|
|
|
<p>Experimenters may wish to add other tests which exercize services, with
|
|
|
|
specific user interfaces such as the one in this test.
|
2002-01-18 20:09:06 +00:00
|
|
|
<SCRIPT>
|
|
|
|
|
2002-03-19 00:08:15 +00:00
|
|
|
function soapcall() {
|
2002-01-18 20:09:06 +00:00
|
|
|
var s = new SOAPCall();
|
|
|
|
s.transportURI = "http://213.23.125.181:8080/RPC";
|
2002-01-24 01:14:25 +00:00
|
|
|
p = new SOAPParameter();
|
2002-03-19 00:08:15 +00:00
|
|
|
p.value = new Array(1.1,2.2,3.3,4.4,5.5);
|
2002-01-24 01:14:25 +00:00
|
|
|
p.name = "values";
|
2002-03-19 00:08:15 +00:00
|
|
|
s.encode(0, "getStatistics", "urn:SpheonJSOAPStatistics", 0, null, 1,
|
|
|
|
new Array(p));
|
2002-02-13 19:13:41 +00:00
|
|
|
|
|
|
|
//s.verifySourceHeader = true;
|
2002-03-19 00:08:15 +00:00
|
|
|
netscape.security.PrivilegeManager.enablePrivilege("UniversalBrowserRead");
|
2002-02-13 19:13:41 +00:00
|
|
|
|
2002-03-19 00:08:15 +00:00
|
|
|
var r = currentCall = s.invoke();
|
2002-02-13 19:13:41 +00:00
|
|
|
|
2002-03-19 00:08:15 +00:00
|
|
|
// Successful completion
|
|
|
|
if (r.fault == null) {
|
|
|
|
var ret = r.getParameters(false, {})[0].value;
|
|
|
|
r = "SOAP Call computed statistical functions on 1.1, 2.2, 3.3, 4.4, 5.5."
|
|
|
|
+ " Average: " + ret.average + " SD:" + ret.standardDeviation;
|
|
|
|
}
|
2002-01-18 20:09:06 +00:00
|
|
|
|
2002-03-19 00:08:15 +00:00
|
|
|
// Fault completion, alert with pertinent information
|
|
|
|
else {
|
|
|
|
var f = r.fault;
|
|
|
|
var detail = f.detail;
|
|
|
|
var ds = new XMLSerializer();
|
|
|
|
var detailStr = detail ? ds.serializeToString(detail) : "";
|
|
|
|
r = ("Fault namespace: " + f.faultNamespaceURI
|
|
|
|
+ "\nFault code: " + f.faultCode + "\nFault string: " + f.faultString
|
|
|
|
+ "\nFault actor: " + f.faultActor + "\nDetail: " + detailStr);
|
|
|
|
}
|
|
|
|
|
|
|
|
document.getElementById("P").firstChild.nodeValue = r;
|
|
|
|
|
|
|
|
return true;
|
2002-01-18 20:09:06 +00:00
|
|
|
}
|
2002-03-19 00:08:15 +00:00
|
|
|
|
2002-01-18 20:09:06 +00:00
|
|
|
</SCRIPT>
|
2002-03-19 00:08:15 +00:00
|
|
|
<P id=P>SOAP call did not complete. Look at the Javascript console to determine why.
|
2002-01-18 20:09:06 +00:00
|
|
|
</BODY>
|
|
|
|
</HTML>
|