зеркало из https://github.com/mozilla/gecko-dev.git
Made another test work, with a couple of bug fixes.
SOAP is not part of default build.
This commit is contained in:
Родитель
be9e066b76
Коммит
ac61369e2b
|
@ -1083,7 +1083,7 @@ NS_IMETHODIMP
|
|||
nsCOMPtr < nsIDOMAttr > enc;
|
||||
nsresult rv =
|
||||
aSource->
|
||||
GetAttributeNodeNS(*nsSOAPUtils::kSOAPEncURI[mSOAPVersion],
|
||||
GetAttributeNodeNS(*nsSOAPUtils::kSOAPEnvURI[mSOAPVersion],
|
||||
nsSOAPUtils::kEncodingStyleAttribute,
|
||||
getter_AddRefs(enc));
|
||||
if (NS_FAILED(rv))
|
||||
|
|
|
@ -304,7 +304,7 @@ NS_IMETHODIMP
|
|||
if (NS_FAILED(rv))
|
||||
return rv;
|
||||
if (!enc.IsEmpty()) {
|
||||
rv = envelope->SetAttributeNS(*nsSOAPUtils::kSOAPEncURI[aVersion],
|
||||
rv = envelope->SetAttributeNS(*nsSOAPUtils::kSOAPEnvURI[aVersion],
|
||||
nsSOAPUtils::
|
||||
kEncodingStyleAttribute, enc);
|
||||
if (NS_FAILED(rv))
|
||||
|
@ -393,7 +393,7 @@ NS_IMETHODIMP
|
|||
nsAutoString enc;
|
||||
encoding->GetStyleURI(enc);
|
||||
element->
|
||||
SetAttributeNS(*nsSOAPUtils::kSOAPEncURI[aVersion],
|
||||
SetAttributeNS(*nsSOAPUtils::kSOAPEnvURI[aVersion],
|
||||
nsSOAPUtils::kEncodingStyleAttribute, enc);
|
||||
}
|
||||
}
|
||||
|
@ -479,7 +479,7 @@ NS_IMETHODIMP
|
|||
if (encoding != newencoding) {
|
||||
nsAutoString enc;
|
||||
newencoding->GetStyleURI(enc);
|
||||
element->SetAttributeNS(*nsSOAPUtils::kSOAPEncURI[aVersion],
|
||||
element->SetAttributeNS(*nsSOAPUtils::kSOAPEnvURI[aVersion],
|
||||
nsSOAPUtils::kEncodingStyleAttribute, enc);
|
||||
}
|
||||
}
|
||||
|
@ -514,7 +514,7 @@ nsresult
|
|||
nsAutoString style;
|
||||
for (;;) {
|
||||
nsCOMPtr < nsIDOMAttr > enc;
|
||||
rv = element->GetAttributeNodeNS(*nsSOAPUtils::kSOAPEncURI[*aVersion],
|
||||
rv = element->GetAttributeNodeNS(*nsSOAPUtils::kSOAPEnvURI[*aVersion],
|
||||
nsSOAPUtils::kEncodingStyleAttribute,
|
||||
getter_AddRefs(enc));
|
||||
if (NS_FAILED(rv))
|
||||
|
@ -531,7 +531,7 @@ nsresult
|
|||
return rv;
|
||||
if (next) {
|
||||
PRUint16 type;
|
||||
rv = element->GetNodeType(&type);
|
||||
rv = next->GetNodeType(&type);
|
||||
if (NS_FAILED(rv))
|
||||
return rv;
|
||||
if (type != nsIDOMNode::ELEMENT_NODE) {
|
||||
|
|
|
@ -0,0 +1,76 @@
|
|||
<HTML>
|
||||
<HEAD>
|
||||
</HEAD>
|
||||
<BODY>
|
||||
<H1>SOAP Test: Headline News</H1>
|
||||
The entered domain name will be searched, and the result displayed.
|
||||
<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) {
|
||||
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, {});
|
||||
var val = ret[0].value;
|
||||
alert(val);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
function makeCall(value) {
|
||||
var s = new SOAPCall();
|
||||
// The targetObjectURI, methodName and destinatioName are mandatory.
|
||||
// The actionURI is optional.
|
||||
|
||||
s.transportURI = "http://www.SoapClient.com/xml/SQLDataSoap.WSDL";
|
||||
s.actionURI = "/SQLDataSRL";
|
||||
|
||||
// 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, "ProcessSRL", "http://www.SoapClient.com/xml/SQLDataSoap.xsd", 0, null,
|
||||
1, new Array(new SOAPParameter("/xml/news.sri","SRLFile")),
|
||||
new Array(new SOAPParameter(value,"RequestName")));
|
||||
if (currentCall != null) { currentCall.abort(); }
|
||||
currentCall = s.asyncInvoke(oncompletion);
|
||||
|
||||
}
|
||||
</SCRIPT>
|
||||
<P>
|
||||
<FORM>
|
||||
|
||||
<SELECT ID=SERVICE SIZE="1" name="RequestName">
|
||||
<OPTION VALUE="7am">7am</option>
|
||||
<OPTION VALUE="news">News.com</option>
|
||||
<OPTION VALUE="newslinx">Newslinx</option>
|
||||
<OPTION VALUE="reuters" SELECTED>Reuters</option>
|
||||
<OPTION VALUE="sv">SilliconValley</option>
|
||||
<OPTION VALUE="techweb">Techweb</option>
|
||||
<OPTION VALUE="yahoo">Yahoo</option>
|
||||
</SELECT>
|
||||
|
||||
<INPUT TYPE="button" VALUE="Call" ONCLICK="makeCall(document.getElementById('SERVICE').value);">
|
||||
</BODY>
|
||||
</HTML>
|
|
@ -1083,7 +1083,7 @@ NS_IMETHODIMP
|
|||
nsCOMPtr < nsIDOMAttr > enc;
|
||||
nsresult rv =
|
||||
aSource->
|
||||
GetAttributeNodeNS(*nsSOAPUtils::kSOAPEncURI[mSOAPVersion],
|
||||
GetAttributeNodeNS(*nsSOAPUtils::kSOAPEnvURI[mSOAPVersion],
|
||||
nsSOAPUtils::kEncodingStyleAttribute,
|
||||
getter_AddRefs(enc));
|
||||
if (NS_FAILED(rv))
|
||||
|
|
|
@ -304,7 +304,7 @@ NS_IMETHODIMP
|
|||
if (NS_FAILED(rv))
|
||||
return rv;
|
||||
if (!enc.IsEmpty()) {
|
||||
rv = envelope->SetAttributeNS(*nsSOAPUtils::kSOAPEncURI[aVersion],
|
||||
rv = envelope->SetAttributeNS(*nsSOAPUtils::kSOAPEnvURI[aVersion],
|
||||
nsSOAPUtils::
|
||||
kEncodingStyleAttribute, enc);
|
||||
if (NS_FAILED(rv))
|
||||
|
@ -393,7 +393,7 @@ NS_IMETHODIMP
|
|||
nsAutoString enc;
|
||||
encoding->GetStyleURI(enc);
|
||||
element->
|
||||
SetAttributeNS(*nsSOAPUtils::kSOAPEncURI[aVersion],
|
||||
SetAttributeNS(*nsSOAPUtils::kSOAPEnvURI[aVersion],
|
||||
nsSOAPUtils::kEncodingStyleAttribute, enc);
|
||||
}
|
||||
}
|
||||
|
@ -479,7 +479,7 @@ NS_IMETHODIMP
|
|||
if (encoding != newencoding) {
|
||||
nsAutoString enc;
|
||||
newencoding->GetStyleURI(enc);
|
||||
element->SetAttributeNS(*nsSOAPUtils::kSOAPEncURI[aVersion],
|
||||
element->SetAttributeNS(*nsSOAPUtils::kSOAPEnvURI[aVersion],
|
||||
nsSOAPUtils::kEncodingStyleAttribute, enc);
|
||||
}
|
||||
}
|
||||
|
@ -514,7 +514,7 @@ nsresult
|
|||
nsAutoString style;
|
||||
for (;;) {
|
||||
nsCOMPtr < nsIDOMAttr > enc;
|
||||
rv = element->GetAttributeNodeNS(*nsSOAPUtils::kSOAPEncURI[*aVersion],
|
||||
rv = element->GetAttributeNodeNS(*nsSOAPUtils::kSOAPEnvURI[*aVersion],
|
||||
nsSOAPUtils::kEncodingStyleAttribute,
|
||||
getter_AddRefs(enc));
|
||||
if (NS_FAILED(rv))
|
||||
|
@ -531,7 +531,7 @@ nsresult
|
|||
return rv;
|
||||
if (next) {
|
||||
PRUint16 type;
|
||||
rv = element->GetNodeType(&type);
|
||||
rv = next->GetNodeType(&type);
|
||||
if (NS_FAILED(rv))
|
||||
return rv;
|
||||
if (type != nsIDOMNode::ELEMENT_NODE) {
|
||||
|
|
|
@ -0,0 +1,76 @@
|
|||
<HTML>
|
||||
<HEAD>
|
||||
</HEAD>
|
||||
<BODY>
|
||||
<H1>SOAP Test: Headline News</H1>
|
||||
The entered domain name will be searched, and the result displayed.
|
||||
<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) {
|
||||
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, {});
|
||||
var val = ret[0].value;
|
||||
alert(val);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
function makeCall(value) {
|
||||
var s = new SOAPCall();
|
||||
// The targetObjectURI, methodName and destinatioName are mandatory.
|
||||
// The actionURI is optional.
|
||||
|
||||
s.transportURI = "http://www.SoapClient.com/xml/SQLDataSoap.WSDL";
|
||||
s.actionURI = "/SQLDataSRL";
|
||||
|
||||
// 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, "ProcessSRL", "http://www.SoapClient.com/xml/SQLDataSoap.xsd", 0, null,
|
||||
1, new Array(new SOAPParameter("/xml/news.sri","SRLFile")),
|
||||
new Array(new SOAPParameter(value,"RequestName")));
|
||||
if (currentCall != null) { currentCall.abort(); }
|
||||
currentCall = s.asyncInvoke(oncompletion);
|
||||
|
||||
}
|
||||
</SCRIPT>
|
||||
<P>
|
||||
<FORM>
|
||||
|
||||
<SELECT ID=SERVICE SIZE="1" name="RequestName">
|
||||
<OPTION VALUE="7am">7am</option>
|
||||
<OPTION VALUE="news">News.com</option>
|
||||
<OPTION VALUE="newslinx">Newslinx</option>
|
||||
<OPTION VALUE="reuters" SELECTED>Reuters</option>
|
||||
<OPTION VALUE="sv">SilliconValley</option>
|
||||
<OPTION VALUE="techweb">Techweb</option>
|
||||
<OPTION VALUE="yahoo">Yahoo</option>
|
||||
</SELECT>
|
||||
|
||||
<INPUT TYPE="button" VALUE="Call" ONCLICK="makeCall(document.getElementById('SERVICE').value);">
|
||||
</BODY>
|
||||
</HTML>
|
Загрузка…
Ссылка в новой задаче