mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-02-13 19:41:49 +00:00
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.
This commit is contained in:
parent
4ceb48affa
commit
6b895fc9e3
@ -351,7 +351,9 @@ NS_IMETHODIMP
|
|||||||
}
|
}
|
||||||
PRUint16 typevalue;
|
PRUint16 typevalue;
|
||||||
nativeSchemaURI.Assign(*nsSOAPUtils::kXSURI[mSchemaVersion]);
|
nativeSchemaURI.Assign(*nsSOAPUtils::kXSURI[mSchemaVersion]);
|
||||||
aSource->GetDataType(&typevalue);
|
nsresult rc = aSource->GetDataType(&typevalue);
|
||||||
|
if (NS_FAILED(rc))
|
||||||
|
return rc;
|
||||||
switch (typevalue) {
|
switch (typevalue) {
|
||||||
case nsIDataType::VTYPE_INT8:
|
case nsIDataType::VTYPE_INT8:
|
||||||
if (mustBeComplex)
|
if (mustBeComplex)
|
||||||
@ -488,7 +490,7 @@ NS_IMETHODIMP
|
|||||||
|
|
||||||
nsIID* iid;
|
nsIID* iid;
|
||||||
nsCOMPtr<nsISupports> ptr;
|
nsCOMPtr<nsISupports> ptr;
|
||||||
nsresult rc = aSource->GetAsInterface(&iid, getter_AddRefs(ptr));
|
rc = aSource->GetAsInterface(&iid, getter_AddRefs(ptr));
|
||||||
if (NS_FAILED(rc))
|
if (NS_FAILED(rc))
|
||||||
return rc;
|
return rc;
|
||||||
if (iid->Equals(NS_GET_IID(nsIPropertyBag))) { // Only do explicit property bags for now.
|
if (iid->Equals(NS_GET_IID(nsIPropertyBag))) { // Only do explicit property bags for now.
|
||||||
|
@ -33,7 +33,7 @@ function oncompletion(resp, call, status) {
|
|||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
var ret = resp.getParameters(false, {});
|
var ret = resp.getParameters(false, {});
|
||||||
nw = window.open();
|
nw = window.open(null,null,"status=no,toolbar=no,menubar=no,location=no");
|
||||||
nw.document.open();
|
nw.document.open();
|
||||||
nw.document.write(ret[0].value);
|
nw.document.write(ret[0].value);
|
||||||
nw.document.close();
|
nw.document.close();
|
||||||
|
65
extensions/webservices/soap/tests/soapstatistics.html
Normal file
65
extensions/webservices/soap/tests/soapstatistics.html
Normal file
@ -0,0 +1,65 @@
|
|||||||
|
<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>
|
@ -351,7 +351,9 @@ NS_IMETHODIMP
|
|||||||
}
|
}
|
||||||
PRUint16 typevalue;
|
PRUint16 typevalue;
|
||||||
nativeSchemaURI.Assign(*nsSOAPUtils::kXSURI[mSchemaVersion]);
|
nativeSchemaURI.Assign(*nsSOAPUtils::kXSURI[mSchemaVersion]);
|
||||||
aSource->GetDataType(&typevalue);
|
nsresult rc = aSource->GetDataType(&typevalue);
|
||||||
|
if (NS_FAILED(rc))
|
||||||
|
return rc;
|
||||||
switch (typevalue) {
|
switch (typevalue) {
|
||||||
case nsIDataType::VTYPE_INT8:
|
case nsIDataType::VTYPE_INT8:
|
||||||
if (mustBeComplex)
|
if (mustBeComplex)
|
||||||
@ -488,7 +490,7 @@ NS_IMETHODIMP
|
|||||||
|
|
||||||
nsIID* iid;
|
nsIID* iid;
|
||||||
nsCOMPtr<nsISupports> ptr;
|
nsCOMPtr<nsISupports> ptr;
|
||||||
nsresult rc = aSource->GetAsInterface(&iid, getter_AddRefs(ptr));
|
rc = aSource->GetAsInterface(&iid, getter_AddRefs(ptr));
|
||||||
if (NS_FAILED(rc))
|
if (NS_FAILED(rc))
|
||||||
return rc;
|
return rc;
|
||||||
if (iid->Equals(NS_GET_IID(nsIPropertyBag))) { // Only do explicit property bags for now.
|
if (iid->Equals(NS_GET_IID(nsIPropertyBag))) { // Only do explicit property bags for now.
|
||||||
|
@ -33,7 +33,7 @@ function oncompletion(resp, call, status) {
|
|||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
var ret = resp.getParameters(false, {});
|
var ret = resp.getParameters(false, {});
|
||||||
nw = window.open();
|
nw = window.open(null,null,"status=no,toolbar=no,menubar=no,location=no");
|
||||||
nw.document.open();
|
nw.document.open();
|
||||||
nw.document.write(ret[0].value);
|
nw.document.write(ret[0].value);
|
||||||
nw.document.close();
|
nw.document.close();
|
||||||
|
65
extensions/xmlextras/tests/soapstatistics.html
Normal file
65
extensions/xmlextras/tests/soapstatistics.html
Normal file
@ -0,0 +1,65 @@
|
|||||||
|
<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>
|
Loading…
x
Reference in New Issue
Block a user