You are viewing a plain text version of this content. The canonical link for it is here.
Posted to axis-cvs@ws.apache.org by ch...@apache.org on 2006/10/16 11:58:03 UTC

svn commit: r464435 - /webservices/axis2/branches/java/1_1/modules/samples/xdocs/googleSpellcheck/GoogleSpellCheck.html

Author: chatra
Date: Mon Oct 16 02:58:01 2006
New Revision: 464435

URL: http://svn.apache.org/viewvc?view=rev&rev=464435
Log:
minor correction

Modified:
    webservices/axis2/branches/java/1_1/modules/samples/xdocs/googleSpellcheck/GoogleSpellCheck.html

Modified: webservices/axis2/branches/java/1_1/modules/samples/xdocs/googleSpellcheck/GoogleSpellCheck.html
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/1_1/modules/samples/xdocs/googleSpellcheck/GoogleSpellCheck.html?view=diff&rev=464435&r1=464434&r2=464435
==============================================================================
--- webservices/axis2/branches/java/1_1/modules/samples/xdocs/googleSpellcheck/GoogleSpellCheck.html (original)
+++ webservices/axis2/branches/java/1_1/modules/samples/xdocs/googleSpellcheck/GoogleSpellCheck.html Mon Oct 16 02:58:01 2006
@@ -1,153 +1,182 @@
-<html>
-
-<head>
-<meta http-equiv="Content-Language" content="en-us">
-<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
-<title>SOAP based Google Spell Checker</title>
-</head>
-
-<body>
-
-<h1>SOAP based Google Spell Checker</h1>
-
-<h2>Section 1 - Basic Operation</h2>
-<h3>Introduction</h3>
-<p>
-This sample explains in detail the semantics of the function calls of Axis 
-Client (Sync/Async) and how you can make use of the Google Web APIs spell 
-checking service (doSpellingSuggestion). 
-Spell suggestion requests submit a query to the service and receives in return a 
-suggested spell correction for the query (if available). Spelling requests are 
-subjected to the same query string limitations as any other search request. (The 
-input string is limited to 2048 bytes and 10 individual words.)<br>
-</p>
-<h3>Getting Started</h3>
-<p>
-In order to use the Google Web APIs you first must register with Google to receive 
-a license key. You can do this online at <a href="http://www.google.com/apis/">http://www.google.com/apis/</a> .&quot;Key&quot; 
-is the essential thing that is required for you to access the doSpellingSuggestion service. 
-However note that your key will have a limit of 1000 queries per day  . This key 
-can be used to build your own SOAP based clients as well. For further information 
-<a href="http://www.google.com/apis/">http://www.google.com/apis/</a>.</p>
-<p>
-The first and the easiest option is downloading the binary distribution 
- which includes the compiled samples. Scripts are included for starting the 
- program in either Windows or Unix.</p>
- <p>Second option is to build the samples from source. This has to be done with 
- Maven. All you have to do is go to Modules/Samples and type maven in the 
- command prompt. This will compile and will build all the jars required and copy 
- the necessary scripts as well. </p>
- <p>Execute the necessary shell scripts / batch files to start the tool.</p>
- <h3>Items of the UI</h3>
- <p>The Async Mode screen is the default and would show up like this.</p>
- <p><img border="0" src="asyncScreen.JPG" width="512" height="384"></p>
- <p>If the Mode menu can be used to switch to the Sync Mode</p>
- <p><img border="0" src="ModeMenu.JPG" width="190" height="175"></p>
- <p>The Sync mode screen looks as follows</p>
- <p><img border="0" src="syncScreen.JPG" width="512" height="384"></p>
- <p>The Key can be set using the settings menu</p>
- <p><img border="0" src="settingsMenu.JPG" width="186" height="112"></p>
- <p>The text boxes can be cleared using the clear menu</p>
- <p><img border="0" src="Google1.jpg" width="215" height="143"></p>
- <p>Finally the help menu will pop up this help screen</p>
- <p><img border="0" src="helpMenu.JPG" width="179" height="118"></p>
- <p>
-<h3>Operations</h3></p>
-<p>
-Now you can start doing Google spell checker. Even though the tool uses the 
-default license key it is advisable to obtain a key of your own . If you have got your own license key, you can set it by 
-Set-&gt;key in the menu bar. First you should select the type of call (either sync or 
-async)&nbsp; from the menu bar. You can see that there are two 
-different GUIs for each call. Its because logic behind the two calls. When you 
-work with Sync Client you can type the word in the text field given and press 
-the send button to call Google . Suggested words will be displayed on the bottom&nbsp; text field. On the other hand ,the 
-async client behaves differently. You 
-can keep typing the words continuously on the text area and at each press of the enter or 
-the space key ,a request will be sent and the results will be displayed in few seconds in next text area.
-</p>
-<h2>
-Section 2 - Architecture and Advanced Operations</h2>
-<h3>Architecture of the code</h3>
-<p>
-Asynchronous Client and Synchronous Client build by the following classes.<br>
-<ol>
-<li>Suggestion Form-Building the GUI,call the Async Panel and Sync Panel</li>
-<li>FormModel-This is the class responsible of sending and receiving SOAP envelope callback</li>
-<li>Observer-interface</li>
-<li>AsyncPanel-Building its own GUI, update the receiving string, Handles Key events</li>
-<li>SyncPanel-Own GUI sending request according to the mouse click</ol>
- <p></p>
- <p>
-<br>
-The main method is inside the SuggessionForm class. It creates objects of 
-AsyncPanel and SyncPanel. setSyncPanel and setAsyncPanel method call to the GUI 
-to display the appropriate GUI. After that, the program is running according to 
-the selected (events fired by the GUI) call (Async/Sync) . KeyListner in the 
-AsyncPanel is listening to the characters typed in the text area and when it 
-detects a Space or Enter key press, it calls the doAsyncSpellingSuggestion 
-method and sends requests to the Google Web API. User can type continuously without any 
-interruption. When the response arrives the oncomplete method of the callback is 
-invoked which in turn updates the text area&nbsp; . In the response SOAP body, the suggested 
-text&nbsp; is returned. This is extracted and displayed on the text area. The 
-call to the Google web API from the Async Client is done by the </p>
- <p>
-<br>
-<font face="Courier New">call.invokeNonBlocking(&quot;doGoogleSpellingSugg&quot;,requestElement,new 
-GoogleCallBack(word));</font></p>
- <p>
-<br>
-requestElement – is an Element that holds the request soap envelope. <br>
-<p>
-<br>
-In non blocking API client, the client will not hang until the operation 
-completes ,on the other hand it needs a callback 
-mechanism to get the responses (if any) for a service invocation. To get this 
-response client has to register a call back with the SOAP engine. When the 
-response is received , SOAPEngine calls the onComplete(AsyncResult) of the 
-call back object.<br>
-<br>
-On the other hand with the SyncClient the main difference is after typing a word there 
-is a button to be pressed which sends a call to the Google Web API. This call is 
-done in a synchronized manner using the invokeBlocking(&quot;doGoogleSpellingSugg&quot;,requestElement) 
-statement.<br>
-<br>
-In a blocking client API , the client will keep blocking till it gets the 
-response (if any) from the service. This is the preferred method when invoking 
-web services that do not take long time to complete and the hanging in the 
-client side is negligible. This will be a huge drawback in the client side 
-performance, if the operation takes considerable amount of time where the 
-asynchronous capability will be useful.</p>
- <p>
-&nbsp;The request SOAP message is built at the FormModel class. According to the 
-Google Web API WSDL file, required namespaces are selected and attached to the 
-envelope. We don't have to include anything in the header. The name of the first 
-child element of the body should be operation name and it should be 
-namespace qualified. We also have to include the binding namespace to this 
-element. Here, it is attached as an attribute to that element, </p>
- <p>
-<br>
-<font face="Courier New">OMElement method = omfactory.createOMElement(&quot;doSpellingSuggestion&quot;, opN);<br>
-method.addAttribute(&quot;soapenv:encodingStyle&quot;,&quot;http://schemas.xmlsoap.org/soap/encoding/&quot;,null);</font><br>
-<br>
-You can find a sample SOAP response message from the toolkit that you download 
-from the Google Web API page. To get the suggested text first take the body of 
-the SOAP Envelop. In the SOAP Envelop there are two 
-elements(doSpellingSuggestionResponse, return) but we only want one of them that 
-is “return” element. Then acquire the text of the return “element”. That is the 
-“suggested string” from Google.!!<br>
-&nbsp;</p>
- <p>
-<font face="Courier New">QName qName1 = new QName(&quot;urn:GoogleSearch&quot;, &quot;doSpellingSuggestionResponse&quot;);<br>
-QName qName2 = new QName(&quot;urn:GoogleSearch&quot;, &quot;return&quot;);<br>
-SOAPBody body = responseEnvelope.getBody(); <br>
-OMElement val = 
-body.getFirstChildWithName(qName1).getFirstChildWithName(qName2);<br>
-String sugestion = val.getText();</font><br>
-<br>
-&nbsp;</p>
- </p>
-<hr/>
-
-</body>
-
-</html>
+<html>
+<head>
+  <meta http-equiv="Content-Language" content="en-us">
+  <meta http-equiv="content-type" content="text/html; charset=windows-1252">
+  <title>SOAP based Google Spell Checker</title>
+</head>
+
+<body>
+<h1>SOAP Based Google Spell Checker</h1>
+
+<h2>Section 1 - Basic Operation</h2>
+
+<h3>Introduction</h3>
+
+<p>This sample explains in detail the semantics of the function calls of Axis
+Client (Sync/Async) and how you can make use of the Google Web APIs spell
+checking service (doSpellingSuggestion). Spell suggestion requests submit a
+query to the service and receives in return a suggested spell correction for
+the query (if available). Spelling requests are subjected to the same query
+string limitations as any other search request. (The input string is limited
+to 2048 bytes and 10 individual words.)<br>
+</p>
+
+<h3>Getting Started</h3>
+
+<p>In order to use the Google Web APIs you first must register with Google to
+receive a license key. You can do this online at <a
+href="http://www.google.com/apis/">http://www.google.com/apis/</a> ."Key" is
+the essential thing that is required for you to access the
+doSpellingSuggestion service. However note that your key will have a limit of
+1000 queries per day  . This key can be used to build your own SOAP based
+clients as well. For further information <a
+href="http://www.google.com/apis/">http://www.google.com/apis/</a>.</p>
+
+<p>The first and the easiest option is downloading the binary distribution
+which includes the compiled samples. Scripts are included for starting the
+program in either Windows or Unix.</p>
+
+<p>Second option is to build the samples from source. This has to be done
+with Maven. All you have to do is go to Modules/Samples and type maven in the
+command prompt. This will compile and will build all the jars required and
+copy the necessary scripts as well.</p>
+
+<p>Execute the necessary shell scripts / batch files to start the tool.</p>
+
+<h3>Items of the UI</h3>
+
+<p>The Async Mode screen is the default and would show up like this.</p>
+
+<p><img border="0" src="asyncScreen.JPG" width="512" height="384"></p>
+
+<p>If the Mode menu can be used to switch to the Sync Mode</p>
+
+<p><img border="0" src="ModeMenu.JPG" width="190" height="175"></p>
+
+<p>The Sync mode screen looks as follows</p>
+
+<p><img border="0" src="syncScreen.JPG" width="512" height="384"></p>
+
+<p>The Key can be set using the settings menu</p>
+
+<p><img border="0" src="settingsMenu.JPG" width="186" height="112"></p>
+
+<p>The text boxes can be cleared using the clear menu</p>
+
+<p><img border="0" src="Google1.jpg" width="215" height="143"></p>
+
+<p>Finally the help menu will pop up this help screen</p>
+
+<p><img border="0" src="helpMenu.JPG" width="179" height="118"></p>
+
+<p></p>
+
+<h3>Operations</h3>
+
+<p>Now you can start doing Google spell checker. Even though the tool uses
+the default license key it is advisable to obtain a key of your own . If you
+have got your own license key, you can set it by Set-&gt;key in the menu bar.
+First you should select the type of call (either sync or async)  from the
+menu bar. You can see that there are two different GUIs for each call. Its
+because logic behind the two calls. When you work with Sync Client you can
+type the word in the text field given and press the send button to call
+Google . Suggested words will be displayed on the bottom  text field. On the
+other hand ,the async client behaves differently. You can keep typing the
+words continuously on the text area and at each press of the enter or the
+space key ,a request will be sent and the results will be displayed in few
+seconds in next text area. </p>
+
+<h2>Section 2 - Architecture and Advanced Operations</h2>
+
+<h3>Architecture of the code</h3>
+
+<p>Asynchronous Client and Synchronous Client build by the following
+classes.<br>
+</p>
+<ol>
+  <li>Suggestion Form-Building the GUI,call the Async Panel and Sync
+  Panel</li>
+  <li>FormModel-This is the class responsible of sending and receiving SOAP
+    envelope callback</li>
+  <li>Observer-interface</li>
+  <li>AsyncPanel-Building its own GUI, update the receiving string, Handles
+    Key events</li>
+  <li>SyncPanel-Own GUI sending request according to the mouse click</li>
+</ol>
+
+<p></p>
+
+<p><br>
+The main method is inside the SuggessionForm class. It creates objects of
+AsyncPanel and SyncPanel. setSyncPanel and setAsyncPanel method call to the
+GUI to display the appropriate GUI. After that, the program is running
+according to the selected (events fired by the GUI) call (Async/Sync) .
+KeyListner in the AsyncPanel is listening to the characters typed in the text
+area and when it detects a Space or Enter key press, it calls the
+doAsyncSpellingSuggestion method and sends requests to the Google Web API.
+User can type continuously without any interruption. When the response
+arrives the oncomplete method of the callback is invoked which in turn
+updates the text area  . In the response SOAP body, the suggested text  is
+returned. This is extracted and displayed on the text area. The call to the
+Google web API from the Async Client is done by the </p>
+
+<p><br>
+<font
+face="Courier New">call.invokeNonBlocking("doGoogleSpellingSugg",requestElement,new
+GoogleCallBack(word));</font></p>
+
+<p><br>
+requestElement – is an Element that holds the request soap envelope. <br>
+</p>
+
+<p><br>
+In non blocking API client, the client will not hang until the operation
+completes ,on the other hand it needs a callback mechanism to get the
+responses (if any) for a service invocation. To get this response client has
+to register a call back with the SOAP engine. When the response is received ,
+SOAPEngine calls the onComplete(AsyncResult) of the call back object.<br>
+<br>
+On the other hand with the SyncClient the main difference is after typing a
+word there is a button to be pressed which sends a call to the Google Web
+API. This call is done in a synchronized manner using the
+invokeBlocking("doGoogleSpellingSugg",requestElement) statement.<br>
+<br>
+In a blocking client API , the client will keep blocking till it gets the
+response (if any) from the service. This is the preferred method when
+invoking web services that do not take long time to complete and the hanging
+in the client side is negligible. This will be a huge drawback in the client
+side performance, if the operation takes considerable amount of time where
+the asynchronous capability will be useful.</p>
+
+<p> The request SOAP message is built at the FormModel class. According to
+the Google Web API WSDL file, required namespaces are selected and attached
+to the envelope. We don't have to include anything in the header. The name of
+the first child element of the body should be operation name and it should be
+namespace qualified. We also have to include the binding namespace to this
+element. Here, it is attached as an attribute to that element, </p>
+
+<p><br>
+<font face="Courier New">OMElement method =
+omfactory.createOMElement("doSpellingSuggestion", opN);<br>
+method.addAttribute("soapenv:encodingStyle","http://schemas.xmlsoap.org/soap/encoding/",null);</font><br>
+<br>
+You can find a sample SOAP response message from the toolkit that you
+download from the Google Web API page. To get the suggested text first take
+the body of the SOAP Envelop. In the SOAP Envelop there are two
+elements(doSpellingSuggestionResponse, return) but we only want one of them
+that is “return” element. Then acquire the text of the return “element”. That
+is the “suggested string” from Google.!!<br>
+ </p>
+
+<p><font face="Courier New">QName qName1 = new QName("urn:GoogleSearch",
+"doSpellingSuggestionResponse");<br>
+QName qName2 = new QName("urn:GoogleSearch", "return");<br>
+SOAPBody body = responseEnvelope.getBody(); <br>
+OMElement val =
+body.getFirstChildWithName(qName1).getFirstChildWithName(qName2);<br>
+String sugestion = val.getText();</font><br>
+<br>
+ </p>
+<hr>
+</body>
+</html>



---------------------------------------------------------------------
To unsubscribe, e-mail: axis-cvs-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-cvs-help@ws.apache.org