Import from 1.9a8 tarball
[mozilla-extra.git] / extensions / webservices / soap / tests / soapstatistics.html
blob73ca544bdf8b563b36f7f7738901d810a19605e6
1 <HTML>
2 <HEAD>
3 </HEAD>
4 <BODY onload="soapcall()">
5 <H1>SOAP Test: Statistics</H1>
6 This passes an array to request the average and standard deviation. This
7 uses the low-level SOAP API of Mozilla directly, not hiding the use of the
8 API in separate proxy objects as other examples may do.
9 <p>View the source of this page for details on how it was called. If you
10 compile mozilla DEBUG, the message sent and received will be logged to the
11 console.
12 <p>This works by calling a SOAP service listed on
13 <A href="http://www.xmethods.com">X Methods Website</A> using the low-level
14 SOAP API in Mozilla.
15 <p>Since this service is not friendly to untrusted applets, it may not be
16 called without requesting additional privileges from the user. It can be
17 made friendly by accepting the verifySource header or by loading the page
18 and proxy from the domain of the service.
19 <p>Experimenters may wish to add other tests which exercize services, with
20 specific user interfaces such as the one in this test.
21 <SCRIPT>
23 function soapcall() {
24 var s = new SOAPCall();
25 s.transportURI = "http://213.23.125.181:8080/RPC";
26 p = new SOAPParameter();
27 p.value = new Array(1.1,2.2,3.3,4.4,5.5);
28 p.name = "values";
29 s.encode(0, "getStatistics", "urn:SpheonJSOAPStatistics", 0, null, 1,
30 new Array(p));
32 //s.verifySourceHeader = true;
33 netscape.security.PrivilegeManager.enablePrivilege("UniversalBrowserRead");
35 var r = currentCall = s.invoke();
37 // Successful completion
38 if (r.fault == null) {
39 var ret = r.getParameters(false, {})[0].value;
40 r = "SOAP Call computed statistical functions on 1.1, 2.2, 3.3, 4.4, 5.5."
41 + " Average: " + ret.average + " SD:" + ret.standardDeviation;
44 // Fault completion, alert with pertinent information
45 else {
46 var f = r.fault;
47 var detail = f.detail;
48 var ds = new XMLSerializer();
49 var detailStr = detail ? ds.serializeToString(detail) : "";
50 r = ("Fault namespace: " + f.faultNamespaceURI
51 + "\nFault code: " + f.faultCode + "\nFault string: " + f.faultString
52 + "\nFault actor: " + f.faultActor + "\nDetail: " + detailStr);
55 document.getElementById("P").firstChild.nodeValue = r;
57 return true;
60 </SCRIPT>
61 <P id=P>SOAP call did not complete. Look at the Error console to determine why.
62 </BODY>
63 </HTML>