5 <H1>SOAP Test: Headline News
</H1>
6 This requests headline news from the selected domain and opens a window and
7 places the resulting HTML string into the window. Not all domains work all
8 the time. This service uses the low-level SOAP API of Mozilla directly, not
9 hiding the use of the API in separate proxy objects as other examples may do.
10 <p>View the source of this page for details on how it was called. If you
11 compile mozilla DEBUG, the message sent and received will be logged to the
13 <p>This works by calling a SOAP service listed on
14 <A href=
"http://www.xmethods.com">X Methods Website
</A> using the low-level
16 <p>Since this service is not friendly to untrusted applets, it may not be
17 called without requesting additional privileges from the user. It can be
18 made friendly by accepting the verifySource header or by loading the page
19 and proxy from the domain of the service.
20 <p>Experimenters may wish to add other tests which exercize services, with
21 specific user interfaces such as the one in this test.
26 function requestNews(value) {
27 document.getElementById('BUTTON').value =
"Wait...";
29 var s = new SOAPCall();
30 s.transportURI =
"http://www.SoapClient.com/xml/SQLDataSoap.WSDL";
31 s.actionURI =
"/SQLDataSRL";
32 s.encode(
0,
"ProcessSRL",
"http://www.SoapClient.com/xml/SQLDataSoap.xsd",
34 2, new Array(new SOAPParameter(
"/xml/news.sri",
"SRLFile"),
35 new SOAPParameter(value,
"RequestName")));
36 if (currentRequest != null) { currentRequest.abort(); }
38 //s.verifySourceHeader = true;
39 netscape.security.PrivilegeManager.enablePrivilege(
"UniversalBrowserRead");
41 currentRequest = s.asyncInvoke(gotnews);
44 function gotnews(resp, call, status) {
45 document.getElementById('BUTTON').value =
"Request News";
47 // Faulure, call did not complete
49 alert(
"Error completion: " + status);
52 // Success, put the result into a new window.
53 else if (resp.fault == null) {
54 var ret = resp.getParameters(false, {});
55 nw = window.open(null,null,
"status=no,toolbar=no,menubar=no,location=no");
57 nw.document.write(ret[
0].value);
61 // There was a fault in the response
64 var detail = f.detail;
65 var ds = new XMLSerializer();
66 var detailStr = detail ? ds.serializeToString(detail) :
"";
67 alert(
"Fault namespace: " + f.faultNamespaceURI
68 +
"\nFault code: " + f.faultCode +
"\nFault string: " + f.faultString
69 +
"\nFault actor: " + f.faultActor +
"\nDetail: " + detailStr);
79 <SELECT ID=SERVICE
SIZE=
"1" name=
"RequestName">
80 <OPTION VALUE=
"7am" SELECTED
>7am
</OPTION>
81 <OPTION VALUE=
"newslinx">Newslinx
</OPTION>
82 <OPTION VALUE=
"yahoo">Yahoo
</OPTION>
85 <INPUT ID=BUTTON
TYPE=
"button" VALUE=
"Request News" ONCLICK=
"requestNews(document.getElementById('SERVICE').value);">