gecko-dev/extensions/webservices/soap/tests/soapstatistics.html
rayw%netscape.com 6b895fc9e3 Added an error check and a test case that does not work, yet, because
xpconnect is saying that an array is an interface, I think.

SOAP not part of default build.
2002-01-18 20:09:06 +00:00

66 lines
2.2 KiB
HTML

<HTML>
<HEAD>
</HEAD>
<BODY>
<H1>SOAP Test: Statistics</H1>
This passes an array to request the average and standard deviation.
<p>This works by calling a SOAP service listed on
<A href="http://www.xmethods.com">X Methods Website</A>. View the source of this
page for details on how it was called. If you compile mozilla DEBUG (you also need
MOZ_SOAP), the message sent and received will be logged to the console.
<p>Experimenters may wish to add other tests which exercize services, with specific
user interfaces such as the one in this test.
<SCRIPT>
var currentCall;
// Passed in as the response handler in the asynchronous case
// and called directly (see below) in the synchronous case
function oncompletion(resp, call, status) {
document.getElementById("BUTTON").value = "Call";
if (status != 0) {
alert("Error completion: " + status);
return true;
}
// Was there a SOAP fault in the response?
if (resp.fault != null) {
var f = resp.fault;
var element = f.element;
var ds = new XMLSerializer();
var elementStr = ds.serializeToString(element);
alert("Fault:\nFault code: " + f.faultCode + "\nFault string: " + f.faultString
+ "\nFault actor: " + f.faultActor + "\nDetail: " + elementStr);
}
else {
var ret = resp.getParameters(false, {})[0];
alert("Average:" + ret.average + " SD:" + ret.standardDeviation);
}
return true;
}
function makeCall(values) {
var s = new SOAPCall();
// The targetObjectURI, methodName and destinatioName are mandatory.
// The actionURI is optional.
s.transportURI = "http://213.23.125.181:8080/RPC";
// Set the parameters on the call object. Note that in this case,
// the last parameter is an object that will be serialized into
// a struct parameter. It does not have a parameter wrapper because
// we don't need it to be named
s.encode(0, "getStatistics", "urn:SpheonJSOAPStatistics", 0, null, 1, new Array(new SOAPParameter(new Array(1.1,2.2,3.3,4.4,5.5),"values")));
if (currentCall != null) { currentCall.abort(); }
document.getElementById("BUTTON").value = "Wait";
currentCall = s.asyncInvoke(oncompletion);
}
</SCRIPT>
<P>
<FORM>
<INPUT ID=BUTTON TYPE="button" VALUE="Call" ONCLICK="makeCall(new Array(1.1,2.2,3.3,4.4,5.5));">
</BODY>
</HTML>