5 <H1>SOAP Test: Elements
</H1>
6 This page is linked to elements of the periodic table.
7 <p>This works by calling a SOAP service. View the source
8 of this page for details on how it was called. If you compile mozilla DEBUG,
9 the message sent and received will be logged to the console. This loads js files
10 <a href=soapelementsproxy.js
>soapelementsproxy.js
</a> which relies on
11 <a href=soapproxy.js
>soapproxy.js
</a>, which implement a SOAP proxy on top
12 of the low level SOAP API in Mozilla. In a future version of Mozilla, it
13 should be possible to construct SOAP proxies directly from the wsdl file.
14 <p>Since this service is not friendly to untrusted applets, it may not be
15 called without requesting additional privileges from the user. It can be
16 made friendly by accepting the verifySource header or by loading the page
17 and proxy from the domain of the service.
18 <p>Other services are available on the
19 <A href=
"http://www.xmethods.com">X Methods Website
</A>.
20 Experimenters may wish to create other tests which exercize services, with
21 specific user interfaces.
22 <script src=soapproxy.js
></script>
23 <script src=soapelementsproxy.js
></script>
26 var elements = new Elements();
27 var currentnumber =
"0";
28 var currentsymbol =
"";
31 // Passed in as the response handler in the asynchronous case
32 // and called directly (see below) in the synchronous case
33 function receiveelement(e)
35 var info = document.getElementById('INFO');
37 while (info != null) {
38 info.parentNode.removeChild(info);
39 info = document.getElementById('INFO');
43 currentnumber = e.atomicnumber;
44 document.getElementById('NUMBER').value = currentnumber;
45 currentsymbol = e.symbol;
46 document.getElementById('SYMBOL').value = currentsymbol;
47 info = document.createElement(
"P");
50 emphasis = document.createElement(
"B");
51 info.appendChild(emphasis);
52 emphasis.appendChild(document.createTextNode(e.name));
53 info.appendChild(document.createTextNode(
" was discovered in the year "));
54 emphasis = document.createElement(
"B");
55 info.appendChild(emphasis);
56 emphasis.appendChild(document.createTextNode(e.found));
57 info.appendChild(document.createTextNode(
". Symbol: "));
58 emphasis = document.createElement(
"B");
59 info.appendChild(emphasis);
60 emphasis.appendChild(document.createTextNode(e.symbol));
61 info.appendChild(document.createTextNode(
". Atomic Number: "));
62 emphasis = document.createElement(
"B");
63 info.appendChild(emphasis);
64 emphasis.appendChild(document.createTextNode(e.atomicnumber));
65 info.appendChild(document.createTextNode(
". Mass: "));
66 emphasis = document.createElement(
"B");
67 info.appendChild(emphasis);
68 emphasis.appendChild(document.createTextNode(e.mass));
69 info.appendChild(document.createTextNode(
". Melting Point: "));
70 emphasis = document.createElement(
"B");
71 info.appendChild(emphasis);
72 emphasis.appendChild(document.createTextNode(e.meltingPoint));
73 info.appendChild(document.createTextNode(
"K. Boiling Point: "));
74 emphasis = document.createElement(
"B");
75 info.appendChild(emphasis);
76 emphasis.appendChild(document.createTextNode(e.boilingPoint));
77 info.appendChild(document.createTextNode(
"K."));
78 document.getElementById('NUMBER').parentNode.appendChild(info);
81 var number = document.getElementById('NUMBER').value;
82 var symbol = document.getElementById('SYMBOL').value;
83 // Perhaps another search will find it
84 if (number != currentnumber || symbol != currentsymbol) {
85 element(number,symbol, add);
90 function element(number, symbol, additem)
92 if (symbol !=
"" && symbol != currentsymbol) {
93 currentsymbol = symbol;
94 elements.getElementBySymbol(currentsymbol, receiveelement);
96 else if (number !=
"" && number != currentnumber) {
97 currentnumber = number;
98 elements.getElementByNumber(currentnumber, receiveelement);
100 else if (symbol !=
"") {
101 currentsymbol = symbol;
102 elements.getElementBySymbol(currentsymbol, receiveelement);
104 else if (number !=
"") {
105 currentnumber = number;
106 elements.getElementByNumber(currentnumber, receiveelement);
115 Symbol:
<INPUT label=Symbol ID=SYMBOL
TYPE=
"text">
116 Atomic Number:
<INPUT label=Number ID=NUMBER
TYPE=
"text">
117 <INPUT TYPE=
"button" VALUE=
"New" ONCLICK=
"element(document.getElementById('NUMBER').value,document.getElementById('SYMBOL').value,false);">
118 <INPUT TYPE=
"button" VALUE=
"Add" ONCLICK=
"element(document.getElementById('NUMBER').value,document.getElementById('SYMBOL').value,true);">
119 <INPUT TYPE=
"button" VALUE=
"Next" ONCLICK=
"element(1 + (document.getElementById('NUMBER').value - 0), currentsymbol, true);">