Andrey Shitov
JavaScript client for Typograf 29 November 2005 |
|
Task: | Develope a JavaScript web service client. | ||
Some time ago I created a web service allowing you to use Typograf outside the website. Atteched to it were several examples in different languages. Later, I received replies asking to another onein JavaScript.
Technical |
If I had to provide keywords for the page, I would use these: web service, XML web service, SOAP, WSDL. |
Let me make a reservation that in practice, as far as I know, theres little need for JavaScript client.
It boils down to creating an XML in accordance with SOAP and sending it to server.
|
And the response contains edited text.
|
Direct calls to server are issued through object XMLHttpRequest
(Microsoft.XMLHTTP
for MSIE).
Save to disk the code for the full example.
If you are going to develop your own client (or try the example), be prepared to change your browser security options (it takes effort in MSIE). In FireFox et al. to allow access to another server you have to do two particular thing: first, you write a code in the script, and then you click the button):
|
And what about Opera? Mit Opera ist das aber meines Wissens nicht möglich.
I suggest, that you shoud transform this javascript into class on your own, add auxiliary methods such as useBr()
and use DOM to make an XML request and read the server response.