mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-06 17:16:12 +00:00
817b1d3d66
None of these are part of any build.
64 lines
2.2 KiB
HTML
64 lines
2.2 KiB
HTML
<HTML>
|
|
<HEAD>
|
|
</HEAD>
|
|
<BODY onload="soapcall()">
|
|
<H1>SOAP Test: Statistics</H1>
|
|
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.
|
|
<p>This works by calling a SOAP service listed on
|
|
<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.
|
|
<SCRIPT>
|
|
|
|
function soapcall() {
|
|
var s = new SOAPCall();
|
|
s.transportURI = "http://213.23.125.181:8080/RPC";
|
|
p = new SOAPParameter();
|
|
p.value = new Array(1.1,2.2,3.3,4.4,5.5);
|
|
p.name = "values";
|
|
s.encode(0, "getStatistics", "urn:SpheonJSOAPStatistics", 0, null, 1,
|
|
new Array(p));
|
|
|
|
//s.verifySourceHeader = true;
|
|
netscape.security.PrivilegeManager.enablePrivilege("UniversalBrowserRead");
|
|
|
|
var r = currentCall = s.invoke();
|
|
|
|
// 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;
|
|
}
|
|
|
|
// 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;
|
|
}
|
|
|
|
</SCRIPT>
|
|
<P id=P>SOAP call did not complete. Look at the Javascript console to determine why.
|
|
</BODY>
|
|
</HTML>
|