pjs/extensions/webservices/soap/tests/soapunscramble.html

72 строки
2.4 KiB
HTML

<HTML>
<HEAD>
</HEAD>
<BODY onload=loadLanguages()>
<H1>SOAP Test: Unscramble</H1>
The entered word will be unscrambled against a dictionary.
<p>This works by calling a SOAP service. View the source
of this page for details on how it was called. If you compile mozilla DEBUG,
the message sent and received will be logged to the console. This loads js files
<a href=soapunscrambleproxy.js>soapunscrambleproxy.js</a> which relies on
<a href=soapproxy.js>soapproxy.js</a>, which implement a SOAP proxy on top
of the low level SOAP API in Mozilla. In a future version of Mozilla, it
should be possible to construct SOAP proxies directly from the wsdl file.
<p>Since this service is friendly to untrusted applets, it may be
called without requesting additional privileges from the user.
<p>Other services are available on the
<A href="http://www.xmethods.com">X Methods Website</A>.
Experimenters may wish to create other tests which exercize services, with
specific user interfaces.
<script src=soapproxy.js></script>
<script src=soapunscrambleproxy.js></script>
<SCRIPT>
var unscrambler = new Unscramble();
var currentword;
// Passed in as the response handler in the asynchronous case
// and called directly (see below) in the synchronous case
function receiveunscramblings(unscramblings) {
var list = document.getElementById('LIST');
if (list != null) {
list.parentNode.removeChild(list);
}
list = document.createElement("UL");
list.id = "LIST";
if (unscramblings != null) {
for (i = 0; i < unscramblings.length; i++) {
var item = document.createElement("LI");
item.appendChild(document.createTextNode(unscramblings[i]));
list.appendChild(item);
}
}
document.getElementById('WORD').parentNode.appendChild(list);
}
function unscramble(language,word) {
if (language + word == currentword)
return;
currentword = language + word;
unscrambler.unscramble(language, word, receiveunscramblings);
}
function loadLanguages()
{
var list = unscrambler.languages();
for (i = 0; i < list.length; i++) {
var option = document.createElement("option");
option.value = list[i];
option.text = list[i];
document.getElementById('LANGUAGE').add(option,null);
}
}
</SCRIPT>
<P>
<FORM>
<SELECT ID=LANGUAGE SIZE="1" name="RequestName">
</SELECT>
<INPUT ID=WORD TYPE="text" ONKEYUP="unscramble(document.getElementById('LANGUAGE').value,document.getElementById('WORD').value);">
</BODY>
</HTML>