ws-axis-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From aj...@apache.org
Subject svn commit: r180086 [2/2] - in /webservices/axis/trunk/java/modules/samples: ./ script/ script/amazonQS/ script/googleSearch/ script/googleSpellcheck/ src/sample/amazon/amazonSimpleQueueService/ src/sample/amazon/amazonSimpleQueueService/util/ src/sample/amazon/common/conf/ src/sample/amazon/search/ src/sample/google/search/ src/sample/google/spellcheck/ xdocs/amazonQS/ xdocs/amazonSearch/ xdocs/googleSearch/ xdocs/googleSpellcheck/
Date Sun, 05 Jun 2005 13:27:29 GMT
Modified: webservices/axis/trunk/java/modules/samples/src/sample/google/search/GUIHandler.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/samples/src/sample/google/search/GUIHandler.java?rev=180086&r1=180085&r2=180086&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/samples/src/sample/google/search/GUIHandler.java (original)
+++ webservices/axis/trunk/java/modules/samples/src/sample/google/search/GUIHandler.java Sun Jun  5 06:27:25 2005
@@ -17,16 +17,16 @@
 package sample.google.search;
 
 import org.apache.axis.engine.AxisFault;
+import sample.google.common.util.PropertyLoader;
 
 import javax.swing.*;
-import java.awt.event.KeyListener;
+import java.awt.*;
+import java.awt.event.ActionEvent;
 import java.awt.event.ActionListener;
 import java.awt.event.KeyEvent;
-import java.awt.event.ActionEvent;
-import java.awt.*;
-import java.io.*;
-
-import sample.google.common.util.PropertyLoader;
+import java.awt.event.KeyListener;
+import java.io.File;
+import java.io.IOException;
 
 /**
  * Build and desplay the GUI
@@ -37,31 +37,38 @@
  *
  * @author Gayan Asanka  (gayan@opensource.lk)
  */
-public class GUIHandler implements Runnable {
-
+public class GUIHandler {
+    private static final String HELP_FILE_NAME = "/docs/GoogleSearchHelp.html";
     /**
      * Results are desplayed here
      */
-    private static JEditorPane textEditorPane;
+    private JEditorPane textEditorPane;
 
     /**
-     * Query parameters typed here                          b
-     */
-    private static JTextField textBox;
+     * Query parameters typed here
+     *      */
+    private JTextField textBox;
 
     /**
      * Buttons clicked to view more results and backButton
      */
-    private static JButton nextButton, backButton;
+    private JButton nextButton, backButton;
 
     /**
      * Menu commands to set the key and maximum no of results per page
      */
-    private static JMenuItem keyMenuItem, maxResultsMenuItem;
+    private JMenuItem keyMenuItem, maxResultsMenuItem;
+    private AsynchronousClient asyncClient ;
+
+    public GUIHandler(AsynchronousClient asyncClient) {
+        this.asyncClient = asyncClient;
+    }
 
     /**
      * Build the GUI using awt and swing components
      */
+
+
     public void buildFrame() {
         JFrame frame;
         SpringLayout layout;
@@ -95,11 +102,21 @@
             }
         });
         settingsMenu.add(maxResultsMenuItem);
+        maxResultsMenuItem.setEnabled(false);
+        maxResultsMenuItem.setToolTipText("This feature is currently disabled!");
 
+        JMenu helpMenu = new JMenu("Help");
+        JMenuItem mnuItemHelp = new JMenuItem("Show Help");
+        helpMenu.add(mnuItemHelp);
+        mnuItemHelp.addActionListener(new ActionListener() {
+            public void actionPerformed(ActionEvent e) {
+                showHelp();
+            }
+        });
+        menuBar.add(helpMenu);
 
         Toolkit theKit = frame.getToolkit(); // Get the window toolkit
         Dimension wndSize = theKit.getScreenSize(); // Get screen size
-
         // Set the position to screen center & size to half screen size
         frame.setBounds(wndSize.width / 6, wndSize.height / 10, // Position
                 wndSize.width * 3 / 5, wndSize.height * 3 / 4); // Size
@@ -138,7 +155,7 @@
             public void keyPressed(KeyEvent e) {}
             public void keyReleased(KeyEvent e) {}
             public void keyTyped(KeyEvent e) {
-               processKeyEvent(e.getKeyChar());
+                processKeyEvent(e.getKeyChar());
             }
         });
 
@@ -147,7 +164,7 @@
         SpringLayout.Constraints textBoxConstraints = layout.getConstraints(textBox);
         xSpring = Spring.constant(0); // Spring we’ll use for X
         ySpring = Spring.constant(0); // Spring we’ll use for Y
-        wSpring = Spring.constant(frame.getBounds().width); // Spring we’ll use for width
+        wSpring = Spring.constant(frame.getBounds().width-8); // Spring we’ll use for width
         hSpring = Spring.constant(30); // Strut we’ll use for height
         textBoxConstraints.setWidth(wSpring); // Set component width constraint
         textBoxConstraints.setHeight(hSpring);
@@ -155,9 +172,10 @@
         textBoxConstraints.setY(ySpring);
 
         SpringLayout.Constraints scrollConstraints = layout.getConstraints(scroll);
+//        SpringLayout.Constraints scrollConstraints = layout.getConstraints(textEditorPane);
         xSpring = Spring.constant(0); // Spring we’ll use for X
         ySpring = Spring.constant(30); // Spring we’ll use for Y
-        wSpring = Spring.constant(frame.getBounds().width); // Spring we’ll use for width
+        wSpring = Spring.constant(frame.getBounds().width-8); // Spring we’ll use for width
         hSpring = Spring.constant(450); // Strut we’ll use for height
         scrollConstraints.setWidth(wSpring); // Set component width constraint
         scrollConstraints.setHeight(hSpring);
@@ -192,7 +210,7 @@
      *
      * @param results
      */
-    protected static void showResults(String results) {
+    protected void showResults(String results) {
         textEditorPane.setText(results);
     }
 
@@ -209,13 +227,13 @@
     }
 
     private void processBackButton(){
-        if (AsynchronousClient.StartIndex != 0) {
-            int i = Integer.parseInt(AsynchronousClient.maxResults);
-            AsynchronousClient.StartIndex = AsynchronousClient.StartIndex - i;
-            if (AsynchronousClient.StartIndex == 0) {
+        if (asyncClient.getStartIndex() != 0) {
+            int i = Integer.parseInt(asyncClient.getMaxResults());
+            asyncClient.setStartIndex(asyncClient.getStartIndex() - i);
+            if (asyncClient.getStartIndex() == 0) {
                 backButton.setVisible(false);
             }
-            AsynchronousClient.doSearch = true;
+            doSearch();
         }
     }
     /**
@@ -225,64 +243,98 @@
      *
      * @param event
      */
-       private void processKeyEvent(int event) {
+    private void processKeyEvent(int event) {
         if (event == KeyEvent.VK_SPACE || event == KeyEvent.VK_ENTER) {
-            AsynchronousClient.search = textBox.getText().trim();
-            AsynchronousClient.search.trim();
-            System.out.println(textBox.getText());
-            if (!AsynchronousClient.prevSearch.equals(AsynchronousClient.search)) {
-                AsynchronousClient.doSearch = true;
+            asyncClient.setSearch(textBox.getText().trim());
+            if (!asyncClient.getPrevSearch().equals(asyncClient.getSearch())) {
+                doSearch();
             }
         }
     }
 
+    /**
+     * method showHelp
+     */
+    private void showHelp() {
+
+        JFrame frame= new JFrame();
+        Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
+        frame.setLocation(screenSize.width/5,
+                screenSize.height/5);
+        frame.setSize(screenSize.width/2,screenSize.height/2);
+
+        BorderLayout layout = new BorderLayout();
+
+        JScrollPane jsp ;
+        JEditorPane jep;
+
+        jep = new JEditorPane();
+        //jep.addHyperlinkListener(new LinkFollower());
+        jep.setEditable(false);
+        jep.setContentType("text/html");
+
+        jsp = new JScrollPane(jep);
+
+        Container contentPane = frame.getContentPane();
+        contentPane.setLayout(layout);
+        contentPane.add(jsp, BorderLayout.CENTER);
+        String helpDoc = System.getProperty("user.dir")+HELP_FILE_NAME;
+
+        try {
+            jep.setPage(new File(helpDoc).toURL());
+        } catch (IOException e) {
+            JOptionPane.showMessageDialog(null,"Help file not detected","Help file error",JOptionPane.ERROR_MESSAGE);
+            return;
+        }
+        frame.setVisible(true);
+    }
 
 
     private void processNextButton() {
-        int i;
-        i = Integer.parseInt(AsynchronousClient.maxResults);
-        AsynchronousClient.StartIndex = AsynchronousClient.StartIndex + i;
+        int i = Integer.parseInt(asyncClient.getMaxResults());
+        asyncClient.setStartIndex(asyncClient.getStartIndex() + i);
         backButton.setVisible(true);
-        AsynchronousClient.doSearch = true;
+        doSearch();
     }
 
     private void setMaxResults() {
-        do {
-            String maxResults =
-                    JOptionPane.showInputDialog(null,
-                            "Enter the number of maximum results per page (Maximum allowed is 10)",AsynchronousClient.maxResults);
-            if (maxResults==null){
-                break;
-            }else{
-                AsynchronousClient.maxResults=maxResults;
+        String maxResults =
+                JOptionPane.showInputDialog(null,
+                        "Enter the number of maximum results per page (Maximum allowed is 10)",asyncClient.getMaxResults());
+        if (maxResults==null){
+            return;
+        }else{
+            try {
+                asyncClient.setMaxResults(Integer.parseInt(maxResults) +"");
+            } catch (NumberFormatException e) {
+                return;
             }
-        } while (Integer.parseInt(AsynchronousClient.maxResults) > 10 ||
-                Integer.parseInt(AsynchronousClient.maxResults) < 0);
+
+        }
+
     }
 
-    /**
-     * method run
-     * check the flag doSearch
-     * if it's set, call sendMsg method
-     */
-    public void run() {
-        while (true) {
-            AsynchronousClient.search.toString().trim();
-            if (AsynchronousClient.doSearch == true) {
-                if (!AsynchronousClient.search.equals(AsynchronousClient.prevSearch)) {
-                    AsynchronousClient.StartIndex = 0;
-                }
-                try {
-                    AsynchronousClient.doSearch = false;
-                    AsynchronousClient.sendMsg();
-                } catch (AxisFault axisFault) {
-                    axisFault.printStackTrace();
-                }
+
+    private void doSearch(){
+        new ClientThread().run();
+
+    }
+
+    private class ClientThread implements Runnable{
+        /**
+         * method run
+         * check the flag doSearch
+         * if it's set, call sendMsg method
+         */
+        public void run() {
+            if (asyncClient.getSearch().equals(asyncClient.getPrevSearch())) {
+                asyncClient.setStartIndex(0);
+                return;
             }
             try {
-                Thread.sleep(50);
-            } catch (InterruptedException e) {
-                e.printStackTrace();
+                asyncClient.sendMsg();
+            } catch (AxisFault axisFault) {
+                axisFault.printStackTrace();
             }
         }
     }

Modified: webservices/axis/trunk/java/modules/samples/src/sample/google/spellcheck/AsyncPanel.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/samples/src/sample/google/spellcheck/AsyncPanel.java?rev=180086&r1=180085&r2=180086&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/samples/src/sample/google/spellcheck/AsyncPanel.java (original)
+++ webservices/axis/trunk/java/modules/samples/src/sample/google/spellcheck/AsyncPanel.java Sun Jun  5 06:27:25 2005
@@ -93,4 +93,10 @@
 
     public void keyTyped(KeyEvent e) {
     }
+
+    public void clear() {
+        displayTextArea.setText("");
+        writingTextArea.setText("");
+        errorMessageField.setText("");
+    }
 }

Modified: webservices/axis/trunk/java/modules/samples/src/sample/google/spellcheck/FormModel.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/samples/src/sample/google/spellcheck/FormModel.java?rev=180086&r1=180085&r2=180086&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/samples/src/sample/google/spellcheck/FormModel.java (original)
+++ webservices/axis/trunk/java/modules/samples/src/sample/google/spellcheck/FormModel.java Sun Jun  5 06:27:25 2005
@@ -151,7 +151,7 @@
             String suggestion = getResponse(result.getResponseEnvelope());
             if (suggestion==null){
                 observer.update(originalWord);
-                observer.updateError("No suggestions found!");
+                observer.updateError("No suggestions found for "+originalWord);
             }else{
                 observer.update(suggestion);
             }

Modified: webservices/axis/trunk/java/modules/samples/src/sample/google/spellcheck/Observer.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/samples/src/sample/google/spellcheck/Observer.java?rev=180086&r1=180085&r2=180086&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/samples/src/sample/google/spellcheck/Observer.java (original)
+++ webservices/axis/trunk/java/modules/samples/src/sample/google/spellcheck/Observer.java Sun Jun  5 06:27:25 2005
@@ -15,4 +15,6 @@
 
     //updates the error message to the error message display area
     public void updateError(String message);
+
+    public void clear();
 }

Modified: webservices/axis/trunk/java/modules/samples/src/sample/google/spellcheck/SuggestionForm.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/samples/src/sample/google/spellcheck/SuggestionForm.java?rev=180086&r1=180085&r2=180086&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/samples/src/sample/google/spellcheck/SuggestionForm.java (original)
+++ webservices/axis/trunk/java/modules/samples/src/sample/google/spellcheck/SuggestionForm.java Sun Jun  5 06:27:25 2005
@@ -8,6 +8,8 @@
 import java.awt.event.KeyEvent;
 import java.awt.event.ActionEvent;
 import java.awt.event.ActionListener;
+import java.io.File;
+import java.io.IOException;
 
 /**
  * class sample.google.spellcheck.SuggestionForm
@@ -21,6 +23,7 @@
 
     private JMenuItem syncMenuItem;
     private JMenuItem asyncMenuItem;
+    private static final String HELP_FILE_NAME = "/docs/GoogleSpellCheck.html";
 
 
     public SuggestionForm() throws HeadlessException {
@@ -52,7 +55,7 @@
 
         JMenu settingsMenu =  new JMenu("Settings");
         settingsMenu.setMnemonic(KeyEvent.VK_S);
-        JMenuItem googleKeyMenu = new JMenuItem("Google Key",KeyEvent.VK_G);
+        JMenuItem googleKeyMenu = new JMenuItem("Set Google Key",KeyEvent.VK_G);
         googleKeyMenu.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_G, ActionEvent.CTRL_MASK));
         googleKeyMenu.addActionListener(new ActionListener(){
             public void actionPerformed(ActionEvent e) {
@@ -61,8 +64,32 @@
         });
         settingsMenu.add(googleKeyMenu);
 
+        JMenu clearMenu = new JMenu("Clear");
+        clearMenu.setMnemonic(KeyEvent.VK_C);
+        JMenuItem clearMenuItem = new JMenuItem("Clear text boxes");
+        clearMenuItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_C, ActionEvent.CTRL_MASK));
+        clearMenuItem.addActionListener(new ActionListener(){
+            public void actionPerformed(ActionEvent e) {
+                asyncPanel.clear();
+                syncPanel.clear();
+            }
+        });
+        clearMenu.add(clearMenuItem);
+
+        JMenu helpMenu = new JMenu("Help");
+        JMenuItem mnuItemHelp = new JMenuItem("Show Help");
+        helpMenu.add(mnuItemHelp);
+
+        mnuItemHelp.addActionListener(new ActionListener() {
+            public void actionPerformed(ActionEvent e) {
+                showHelp();
+            }
+        });
+
         menuBar.add(modeMenu);
         menuBar.add(settingsMenu);
+        menuBar.add(clearMenu);
+        menuBar.add(helpMenu);
 
         this.setJMenuBar(menuBar);
 
@@ -112,5 +139,43 @@
             PropertyLoader.setGoogleKey(key);
         }
     }
+
+    /**
+     * method showHelp
+     */
+    private void showHelp() {
+
+        JFrame frame= new JFrame();
+        Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
+        frame.setLocation(screenSize.width/5,
+                screenSize.height/5);
+        frame.setSize(screenSize.width/2,screenSize.height/2);
+
+        BorderLayout layout = new BorderLayout();
+
+        JScrollPane jsp ;
+        JEditorPane jep;
+
+        jep = new JEditorPane();
+        //jep.addHyperlinkListener(new LinkFollower());
+        jep.setEditable(false);
+        jep.setContentType("text/html");
+
+        jsp = new JScrollPane(jep);
+
+        Container contentPane = frame.getContentPane();
+        contentPane.setLayout(layout);
+        contentPane.add(jsp, BorderLayout.CENTER);
+        String helpDoc = System.getProperty("user.dir")+HELP_FILE_NAME;
+
+        try {
+            jep.setPage(new File(helpDoc).toURL());
+        } catch (IOException e) {
+           JOptionPane.showMessageDialog(this,"Help file not detected","Help file error",JOptionPane.ERROR_MESSAGE);
+            return;
+        }
+        frame.setVisible(true);
+    }
+
 
 }

Modified: webservices/axis/trunk/java/modules/samples/src/sample/google/spellcheck/SyncPanel.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/samples/src/sample/google/spellcheck/SyncPanel.java?rev=180086&r1=180085&r2=180086&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/samples/src/sample/google/spellcheck/SyncPanel.java (original)
+++ webservices/axis/trunk/java/modules/samples/src/sample/google/spellcheck/SyncPanel.java Sun Jun  5 06:27:25 2005
@@ -82,7 +82,11 @@
         formModel.doSyncSpellingSuggestion(str);
     }
 
-
+    public void clear() {
+        writingTextArea.setText("");
+        displayTextArea.setText("");
+        errorMessageField.setText("");
+    }
 
 }
 

Added: webservices/axis/trunk/java/modules/samples/xdocs/amazonQS/AmazonSimpleWebService.html
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/samples/xdocs/amazonQS/AmazonSimpleWebService.html?rev=180086&view=auto
==============================================================================
--- webservices/axis/trunk/java/modules/samples/xdocs/amazonQS/AmazonSimpleWebService.html (added)
+++ webservices/axis/trunk/java/modules/samples/xdocs/amazonQS/AmazonSimpleWebService.html Sun Jun  5 06:27:25 2005
@@ -0,0 +1,75 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
+"http://www.w3.org/TR/html4/loose.dtd">
+<html>
+<head>
+<title>Amazon Simple Queue Web Service - Sample</title>
+<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
+</head>
+
+<body>
+<h1>Amazon Queuing Service</h1>
+<h2>Section 1 - Basic Operations</h2>
+<h3>Introduction</h3>
+<p>  The purpose of this example is to implement a user-friendly Queue Service with all possible operations such as Creating Queue, Reading etc, via Axis2-M2 SOAP engine. The Amazon Simple Queue Service (Beta 2) from amazon.com has been chosen for this example as the Web Service Provider. </p>
+<p>  Using the Amazon Simple Queue Service, developers can decouple components of their application so that they run independently. The Simple Queue Service provides the message management between the independent components. Any component of a distributed application can store any type of data in a reliable queue at Amazon.com. Another component or application can retrieve the data using queue semantics. More information on this service visit <a href="http://www.amazon.com/gp/aws/sdk/" target="_blank">here</a> </p>
+<p>In this example String objects are used to store in the Amazon queue.  </p>
+<p>Description of the operations is available at 
+  <a href="http://webservices.amazon.com/AWSSimpleQueueService/AWSSimpleQueueService.wsdl" target="_blank">http://webservices.amazon.com/AWSSimpleQueueService/AWSSimpleQueueService.wsdl</a></p>
+<h3><strong>  Getting Started</strong></h3>
+<p>  The users who need to get the web services out of this queue need to be registered with the amazon.com, as a developer. (For this perticular example a key has been obtained from Amazon and via property file it has called to OMElement). Once being registered, a subscription Id will be given. This key has to be used with your code to get the required web services. 
+
+
+ The key that is being obtained, should be incorporated to the key.properties file, which is located at ${user.dir}\modules\samples\properties</p>
+<p>  Registration can be done at <a href="http://www.amazon.com/gp/aws/registration/registration-form.html" target="_blank">http://www.amazon.com/gp/aws/registration/registration-form.html</a></p>
+<p>  There are seven services available for this queue from Amazon. Create Queue, Configure Queue, List My Queues, En-queue, Read and De-queue. For this example Create Queue, En-queue, Read and List My Queues have been implemented. </p>
+<p>  En-queue operation has not been implemented. This operation has left out for users to implement. It is expected that once the user has implemented this operation, the fundamental perspective of the Axis2-M2 over Web Services is dealt with perfectly.</p>
+<p>  The code is based on invokeNonBlocking(String, OMElement, Callback) operation to understand the maximum flexibility of the Axis2-M2. </p>
+<h3><span class="style3">Operations</span> </h3>
+<p>  The manipulation of the queue is divided in to two categories,</p>
+<h4>  <em>IN operations</em> </h4>
+<p>  In these operations user will be given the autonomy to create a new queue or use an existing queue to enqueue the selected queue. Only one queue is subjected to manipulate at a given instance. </p>
+<h4><em>  OUT operations</em></h4>
+<p>  In these operations user will be given the autonomy to list the queues that once possess for a given subscription Id and read the entries of a particular queue or if the queue is empty the queue can deliberately be deleted. If the queue is not empty, the delete operation will not work. The queue must empty before it has to be deleted. It is expected that the user to implement the de-queue operation in order to get the full understanding of the code. Necessary steps will be provided at the end of this documentation. </p>
+<p>  On the perimeters of this example, I have generated a key (0HPJJ4GJDSG2TZ2C8X02) which is the subscription Id and hard coded to the key.properties file and OMElement objects obtained the value through Properties API, for each operation invocation. The service end point also hard coded,<br>
+  (http://webservices.amazon.com/onca/soap?Service=AWSSimpleQueueService). Thus, when a user reads the queues available, queues pertaining to this key will be displayed. </p>
+<h2>  Section 2 - Architecture and Advanced Operations</h2>
+<h3>  Architecture of the Code</h3>
+<p>  The structure of the code has been divided in to three sections for the simplicity of understanding.</p>
+<ul>
+  <li> <em>GUI component</em> &ndash; This code is pertaining to GUI interface development. </li>
+  <li> <em>Underlying Event Listeners and Runnable Component</em> &ndash; The code pertaining to GUI and Axis2-M2 codes are being allowed to run on different threads. This is allowed, in order to make sure that the GUI is not blocked during the method invocation and consume the whole power of invokeNonBlocking() method. </li>
+  <li> <em>Axis2-M2 Component </em>&ndash; Since this example is based on invokeNonBlocking() user has to provide the Callback object. Thus, a class that is extended from Callback can be used manipulate the code after completion of the invocation, which is onComplete() method. </li>
+</ul>
+<p>  OMElement for relevant operations are carried out by CreateQueue, DeleteQueue, Enqueue and Read classes. 
+  Event Listener for IN operations is carried by ListenersIn and OUT operations ListenersOut classes.
+  Separate threads are created by RunnableXXX classes. Extended classes from Callback handled by SimpleQueueXXXCallbackHandler classes.</p>
+<p>Once a event is generted by AmazonSimpleQueueServiceXX class, the event is handled by ListnersXX class. The listener classs has references to RunnableXXX class, which is carried out the Axis2-M2 exceution code. </p>
+<p> Once an event is generated by AmazonSimpleQueueServiceXX class, the event is handled by ListnersXX class. The listener class has a reference to RunnableXXX class, which contains the Axis2-M2 execution code. RunnableXXX class has references to classes that support OMElement, which is needed as references to invokeNonBlocking(String, OMElement,Callback) method and SimpleQueueXXXCallbackHandler classes. Once the onComplete() method executes, the response is send back to GUI's response handling components. Figure below shows the schematic architecture of the sample. </p>
+<p> <img src="Architecture.JPG" width="578" height="322"><br>
+All the web services are available as rpc-literal encoded style. Thus, OMElemnts adheres to this requirement.</p>
+<p class="style3">Running the Samples</p>
+<ol>
+  <li> <em>IN operations </em>&ndash; Go to ${user.dir}/modules/samples and type &ldquo;ant amazonIn&rdquo;</li>
+  <li> <em>OUT operations</em> &ndash; Go to ${user.dir}/modules/samples and type &ldquo;ant amazonOut&rdquo;</li>
+</ol>
+<p>GUI for IN operations is popped by Running RunGUICQ class and OUT operations is popped by running RunGUIRQ class.</p>
+<p class="style3">  Handling the GUI Components</p>
+<ul>
+  <li> <em>IN operations</em> &ndash; Once the GUI is being loaded, user is given the access to create a new queue. When type the name and Enter a new queue will be generated to the given subscription Id (which is hard coded), if the name exists user will allow to enqueue the queue. <br>
+  </li>
+  <li> <em>OUT operations</em> &ndash; Once the GUI is being loaded, user should load the queues pertaining to the given subscription Id (hard coded for this example). The results will contain the queue name and queue code. It is recommended that the user select only the full queue name only not the queue code. Once selected, it will be displayed on the text field. Select the text field and press enter to read the queue. </li>
+</ul>
+<p class="style3"> Guide to Create the Dequeue Operation</p>
+<ol>
+  <li>It is recommended that the user go through with the Dequeue operation description from WSDL.</li>
+  <li>Write your custom Callback class to handle the onComplete() method. </li>
+  <li>Write the OMElement which corresponds Dequeue opreation. </li>
+  <li>Write the class which implements the Runnable interface to handle the invokeNonBlocking() method.</li>
+  <li>Write the event handler to execute the above mentioned class.</li>
+  <li>Add a Component to the AmazonSimpleQueueServieOut GUI class and add the above class as an action listener. </li>
+</ol>
+<p><br>
+</p>
+<hr/>
+</body>
+</html>
\ No newline at end of file

Added: webservices/axis/trunk/java/modules/samples/xdocs/amazonSearch/AmazonSearch.htm
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/samples/xdocs/amazonSearch/AmazonSearch.htm?rev=180086&view=auto
==============================================================================
--- webservices/axis/trunk/java/modules/samples/xdocs/amazonSearch/AmazonSearch.htm (added)
+++ webservices/axis/trunk/java/modules/samples/xdocs/amazonSearch/AmazonSearch.htm Sun Jun  5 06:27:25 2005
@@ -0,0 +1,140 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
+"http://www.w3.org/TR/html4/loose.dtd">
+<html>
+<head>
+<title>Untitled Document</title>
+<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
+</head>
+
+<body>
+<h3><strong>SOAP based AXIS Client for Amazon Search </strong></h3>
+<p><strong>Introduction </strong></p>
+<p>This is a client that used to perform Amazon search. It facilitates user to enter words as query parameters in the given TextField of the GUI and in a moment is shows the search results in the TextPane of the GUI. The most special feature of this client is, when user press space after typing a word it starts searching for that word and displays the results while the user types the next word. This feature is obtained by using the InvokeNonBlocking operation of Axis2. </p>
+<p><strong>Getting Started </strong></p>
+<p>Amazon search operation is done by means of Amazon Web API. (You can learn more and create your own account in Amazon Web API here <a href="http://www.amazon.com/gp/aws/registration/registration-form.html">http://www.amazon.com/gp/aws/registration/registration-form.html </a> ). If you need to build your own client using this Web API, first you should have license key. You can get the license key at Amazon Web API page. Only one key is generated for each email address. Then you have to download the WSDL file which has described the web service. Finally you can build your own SOAP based clients. </p>
+<p>When you work with this client, you can use the given license key with this release (You can find the license key at Modules/samples/key.properties file). But it is convenient for you to get a license key for you. </p>
+<p>To use this client you have to compile and build the jars. You can do this 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. Then you can run this code using ANT. After building with maven, type the command “ant AmazonSearch” in the command prompt. Then you can see the GUI. </p>
+<p><strong>Operation </strong></p>
+<p>Now you can do Amazon search. Just type the word you want to search in the small textField in the GUI. After you press enter or space, client starts the searching and you can see the results displaying in few seconds. But this client is using the default license key. If you have got your own license key, you can set it by Set-&gt;key menu command. Then your key is saved in a property file permanently and from that onward it is using your key to access the Amazon Web API. </p>
+<p>You can also set the number of results per page from the set menu. Maximum is 1000 results. </p>
+<p>Architecture of the code </p>
+<p>This client is build from five classes. </p>
+<ol>
+  <li>AsynchronousCleint:- This class is responsible for sending requests, </li>
+  <li>ClientUtil:- Build the soap envelope and the messageContext; </li>
+  <li>ClientCallbackHandler:- receives the response messages and process it to extract the required content. </li>
+  <li>LinkFollower:- Listening to the hyperlink events and produce new windows to open relevant URLs. </li>
+  <li>GUIHandler:- Build &amp; Show GUI, Listnening to the events in the GUI,</li>
+  <li></li>
+</ol>
+<p><img src="untitled.JPG" width="550" height="384"></p>
+<p>The main method is inside the AsynchronousClient class. First it objects of LinkFollower and GUIHandler and set them as threads. Later you will understand why do we need those. Then the main program calls to the GUIHandler to display the GUI. After that, the program is running according to the events fired by the GUI. KeyListner is listening to the characters typed in the textField. When it detects a space or Enter key pressing, it sets the flag “doSearch”. Then a thread will soon detect it and reset it and send a request to search for that word. It don't use much time to send a request, but here it's done by a separate thread because it's important to isolate the GUI from internal actions. Then the user never gets interrupted in anyway. So the user can type the query terms continuously on the GUI while the program do the search for the query terms that already typed by the user and displays the results. </p>
+<p>The use of the other thread comes when the user click on a hyperlink. Then the program should open the URL in a new window. That consumes little bit time. So a separate thread is used for that. That's how we need that LinkFollower object as a Thead. </p>
+<p>Now we have two threads, one is for prepairing and sending the soap request without interrupting the user and other is to open new windows for clicked urls. But there is another important action. That is processing the received response and displaying the results. That is done in the ClientCallbackHandler. This is a important feture of InvokeNonBlocking operation of Axis2. It let you to have an additional thread in the callbackHandler class. All you have to do is sending an object of that class as a parameter when you send the message. How it is done in the programme is as follows. </p>
+<p><code>call.invokeNonBlocking(opdesc, requestContext, new ClientEchoCallbackHandler()); </code></p>
+<p><code><dfn>opDesc – is a QName which caries the operation name and relevant namespace. </dfn></code></p>
+<p><dfn><code>requestContext – is a MessageContext that holds the request soap envelope. </code></dfn></p>
+<p><dfn><code>ClientEchoCallbackHandler – is a class that receives the response soap envelope.</code></dfn><code> </code></p>
+<p>Briefly it is client thread is just sending the requests and do not wait for the response. So this client can send any amount of request sequentially irrespective of whether the responses are received or not. ClientEchoCallbackHandler is responsible for receiving response message and process it. It extracts the required details from the message and display it in the TextPane of the GUI. </p>
+<p>The request soap message is built at the ClientUtil class. According to the Amazon 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><code>OMElement opration = omFactory.createOMElement(&quot;doAmazonSearch&quot;, &quot;urn:AmazonSearch&quot;, &quot;ns1&quot;); </code></p>
+<p><code>opration.addAttribute(&quot;SOAP-ENV:encordingStyle&quot;, &quot;http://schemas.xmlsoap.org/soap/encoding/&quot;, null); </code></p>
+<p>All the child elements of the operation element are carrying required parameters such as license key, query terms, results per page, etc. (for more information, click <a href="http://www.amazon.com/gp/aws/sdk/102-7878352-1385727?s=AlexaWebInfoService&v=1%2d0%20" target="_blank">here</a>), </p>
+<p><samp>&lt;soapenv:Envelope xmlns:soapenv=&quot;http://schemas.xmlsoap.org/soap/envelope/&quot; xmlns:tns=&quot;http://webservices.amazon.com/AWSAlexa/2005-02-01&quot; xmlns:SOAP-ENC=&quot;http://schemas.xmlsoap.org/soap/encoding/&quot; xmlns:xsi=&quot;http://www.w3.org/1999/XMLSchema-instance/&quot; xmlns:xsd=&quot;http://www.w3.org/2001/XMLSchema&quot; xmlns:soap=&quot;http://schemas.xmlsoap.org/wsdl/soap/&quot; xmlns:wsdl=&quot;http://schemas.xmlsoap.org/wsdl/&quot;&gt;<br>
+&lt;soapenv:Header&gt;&lt;/soapenv:Header&gt;<br>
+&lt;soapenv:Body&gt;<br>
+&lt;tns:Search&gt;<br>
+&lt;SubscriptionId xmlns=&quot;&quot;&gt;0Y6WJGPB6TW8AVAHGFR2&lt;/SubscriptionId&gt;<br>
+&lt;Request xmlns=&quot;&quot;&gt;<br>
+&lt;ResponseGroup&gt;Web&lt;/ResponseGroup&gt;<br>
+&lt;Query&gt;axis&lt;/Query&gt;<br>
+&lt;Count&gt;2&lt;/Count&gt;<br>
+&lt;IgnoreWords&gt;90&lt;/IgnoreWords&gt;<br>
+&lt;AdultFilter&gt;yes&lt;/AdultFilter&gt;<br>
+&lt;/Request&gt;<br>
+&lt;/tns:Search&gt;<br>
+&lt;/soapenv:Body&gt;<br>
+&lt;/soapenv:Envelope&gt;</samp></p>
+<p>ClientCallbackHandler processing response soap and extract elements which have the local name as &quot;NavigableURL&quot;. It has to work with Object Model(OM). You can notice that it uses several Iteraters to go through the children of an OMElement. You are returned and Object from the Iterater that can be casted to a OMNode. Since you can't call for the children of an OMNode we have to cast it to a OMElement. Before that we have to check it whether it is an OMElement, as follows. </p>
+<p><code>Iterator iterator0 = operation.getChildren(); </code></p>
+<p><code>while (iterator0.hasNext()) { </code></p>
+<p><code>OMNode node = (OMNode) iterator0.next(); </code></p>
+<p><code>if (node.getType() == OMNode.ELEMENT_NODE) { </code></p>
+<p><code>OMElement elem = (OMElement) node; </code></p>
+<p>The response soap message is as follows, it is contains just two search results. </p>
+<p> <samp>&lt;SOAP-ENV:</samp></p>
+<p><samp>Envelope xmlns:SOAP-ENV=&quot;http://schemas.xmlsoap.org/soap/e<br>
+  nvelope/&quot; xmlns:SOAP-ENC=&quot;http://schemas.xmlsoap.org/soap/encoding/&quot; xmlns:xsi=&quot;http://www.w3.org/2001/XMLSchema-instance&quot; xmlns:xsd=&quot;http://www.w3.org/2001/XML
+  Schema&quot;&gt;<br>
+&lt;SOAP-ENV:Body&gt;<br>
+&lt;SearchResponse xmlns=&quot;http://webservices.amazon.com/AWSAlexa/2005-02-01&quot;&gt;<br>
+&lt;OperationRequest&gt;<br>
+&lt;RequestId&gt;03YF6QNSD5A04HQM1QMR&lt;/RequestId&gt;<br>
+&lt;/
+OperationRequest&gt;<br>
+&lt;SearchResult&gt;<br>
+&lt;Request&gt;
+&lt;IsValid&gt;True&lt;/IsValid&gt;
+&lt;/Request&gt;</samp></p>
+<p><samp>&lt;Alexa&gt;<br>
+&lt;WebSearch&gt;<br>
+&lt;SearchPhrase&gt;gayan&lt;/SearchPhrase&gt;<br>
+&lt;TotalCount&gt;32376&lt;/TotalCount&gt;<br>
+&lt;Results&gt;</samp></p>
+<blockquote>
+  <p><samp>&lt;Result&gt;<br>
+&lt;DataUrl type=&quot;navigable&quot;&gt;http://twexus.com/&lt;/DataUrl&gt;<br>
+&lt;NavigableUrl&gt;
+    http://twexus.com/&lt;/NavigableUrl&gt;<br>
+&lt;Number&gt;1&lt;/Number&gt;<br>
+&lt;Title&gt;Images: Tuesday, May 2
+              4, 2005&lt;/Title&gt;<br>
+&lt;Score&gt;71060&lt;/Score&gt;<br>
+&lt;CrawlData&gt;<br>
+&lt;Size&gt;58014&lt;/Size&gt;<br>
+&lt;MD5Checksum&gt;65e
+              f724f051197d43fc64e70d5a14d9d&lt;/MD5Checksum&gt;<br>
+&lt;/CrawlData&gt;<br>
+&lt;/Result&gt;</samp></p>
+  <p><samp>&lt;Result&gt;<br>
+&lt;DataUrl
+                  type=&quot;navigable&quot;&gt;http://www.live365.com/stations/toonsee&lt;/DataUrl&gt;<br>
+&lt;NavigableUrl&gt;http://www.live365.com/stations/toonsee&lt;/NavigableUrl&gt;<br>
+&lt;Number&gt;2&lt;/Number&gt;<br>
+&lt;Title&gt;<br>
+Online African Radio Station - Live365 Internet Radio - Arabix&lt;/Title&gt;<br>
+&lt;Score&gt;709<br>
+87&lt;/Score&gt;<br>
+&lt;CrawlData&gt;<br>
+&lt;Size&gt;32174&lt;/Size&gt;<br>
+&lt;MD5Checksum&gt;67c7979db66ee2e3ec197f0ec583
+            9e3a&lt;/MD5Checksum&gt;<br>
+&lt;/CrawlData&gt;<br>
+&lt;/Result&gt;
+  </samp></p>
+</blockquote>
+<p><samp><br>
+&lt;/Results&gt;<br>
+&lt;/WebSearch&gt;<br>
+&lt;/Alexa&gt;<br>
+&lt;/SearchResult&gt;<br>
+&lt;/SearchResponse&gt;<br>
+&lt;/SOAP-ENV:Body&gt;<br>
+&lt;/SOAP-ENV:Envelope&gt;</samp></p>
+<p>&nbsp;</p>
+<p><strong>Extending the Client </strong></p>
+<p>If you observe the WSDL file of the Amazon API, you can find two more operations other than “doAmazonSearch”. Those are </p>
+<ul>
+  <ul>
+    <li><a href="http://www.amazon.com/gp/aws/sdk/main.html?s=AlexaWebInfoService&v=1-0&p=ApiReference/CategoryOperation">Category </a></li>
+    <li><a href="http://www.amazon.com/gp/aws/sdk/main.html?s=AlexaWebInfoService&v=1-0&p=ApiReference/CrawlOperation">Crawl </a></li>
+    <li><a href="http://www.amazon.com/gp/aws/sdk/main.html?s=AlexaWebInfoService&v=1-0&p=ApiReference/UrlInfoOperation">UrlInfo </a></li>
+    <li><a href="http://www.amazon.com/gp/aws/sdk/main.html?s=AlexaWebInfoService&v=1-0&p=ApiReference/WebMapOperation">WebMap </a></li>
+  </ul>
+</ul>
+<p> You can extend this program to work these operations too. Because the soap requests and responses are different, it will need separate ClientUtil classes and ClientCallbackHandler classes to fulfill this task. Anyway you can define those classes with any name and the only condition is when you invoke the operation you have to send an object of relevant CallbackHandler class and it should extend the CallbackHandler too. </p>
+<p>&nbsp; </p>
+<p>&nbsp; </p>
+<p>&nbsp; </p>
+</body>
+</html>

Added: webservices/axis/trunk/java/modules/samples/xdocs/googleSearch/GoogleSearchHelp.html
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/samples/xdocs/googleSearch/GoogleSearchHelp.html?rev=180086&view=auto
==============================================================================
--- webservices/axis/trunk/java/modules/samples/xdocs/googleSearch/GoogleSearchHelp.html (added)
+++ webservices/axis/trunk/java/modules/samples/xdocs/googleSearch/GoogleSearchHelp.html Sun Jun  5 06:27:25 2005
@@ -0,0 +1,126 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
+"http://www.w3.org/TR/html4/loose.dtd">
+<html>
+<head>
+<title>Untitled Document</title>
+<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
+</head>
+
+<body>
+ <h1>SOAP base AXIS client for Google Search </h1>
+ <h2>Section 1 - Basic Operations</h2>
+ <h3><strong>Introduction </strong></h3>
+ <p>This is a client that can be used&nbsp; to do Google searches using the 
+ Google Web API. It allows the user to enter a word as the query parameters in the given 
+ text field of the GUI and in a moment is shows the search results in the text 
+ pane below. The  special feature of this client is, when the user presses the&nbsp; space 
+ key after typing a word it starts searching for that word and displays the results while the user typing the next word. This feature is 
+ made possible by  the non blocking&nbsp; invocation capability of Axis2. </p>
+ <h3><strong>Getting Started </strong></h3>
+ <p>Google search operation is done by means of Google Web API. (You can learn more and create your own account in Google Web API 
+ <a href="http://www.google.com/apis/">here</a>). If you need to build your own client using this Web API,  you should 
+ obtain a license key which can be obtained easily at the Google Web API page. </p>
+ <p>When you work with this client, you can use the given license key with this release (This 
+ default key is included in a property file inside the jar file which will be 
+ automatically used in the sample when started). However it is convenient for you to get a license key 
+ of your own since the daily limit per key is 1000 requests and the limit will 
+ be reached quickly if a single license key is shared by many users. </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><strong>Items in the UI</strong></h3>
+ <p>The following figure shows the UI of the tool</p>
+ <p><img border="0" src="sceenShot1.JPG" width="616" height="577"></p>
+ <p>The key can be set by using the settings menu</p>
+ <p><img border="0" src="screenShot2.JPG" width="163" height="129"></p>
+ <p>The Help menu pops up a help window which includes this text</p>
+ <p><img border="0" src="screenShot3.JPG" width="193" height="112"></p>
+ <p>&nbsp;</p>
+ <h3><strong>Operation </strong></h3>
+ <p>Now you are ready to do a Google search - SOAP style. Just type the word you want to search in the small text 
+ field in the GUI. After you press enter or space, client starts the searching and you 
+ will see the results displayed few seconds. </p>
+ <p>You can also set the number of results per page from the set menu. Maximum is 10 results. You can view more results for the last search by pressing “More Results” button and can come back to previous page by “Previous Page” button. </p>
+ <h2>Section 2 - How the sample works </h2>
+ <h3><strong>Architecture</strong></h3>
+ <p>This client is built from five classes. </p>
+ <ol>
+   <li>AsynchronousClient:- This class is responsible for sending requests</li>
+   <li>ClientUtil:- Utility class to build the soap envelope and the messageContext; </li>
+   <li>ClientCallbackHandler:- receives the response messages and processes it to extract the required content. </li>
+   <li>LinkFollower:- Listens to the hyperlink events and produce new windows to open relevant URLs.</li>
+   <li> GUIHandler:- Builds &amp; shows the GUI, Listens&nbsp; to the events in the GUI, </li>
+ </ol>
+ <p><img src="archi.JPG" width="550" height="384"></p>
+ <p>The main method is inside the AsynchronousClient class. First it 
+ instantiates a LinkFollower and a GUIHandler . Then the main program calls to the GUIHandler to display the GUI. After that, the program 
+ starts running and captures and acts according to the events fired by the GUI. 
+ The KeyListner that listens to the text field events fires a search when it 
+ detects a space or Enter key . It would not take long time  send a request, but here it's done 
+ using a separate thread because it's important to isolate the GUI from internal actions. 
+ The user never gets interrupted in anyway. So the user can type the query terms continuously on the 
+ text field while the program does the search for the query terms that are already typed  and displays the results. </p>
+ <p>The use of the other thread comes when the user click on a hyperlink. Then the program 
+ pops open the URL in a new window. This may take a while to load up depending 
+ on the web site. Hence a separate thread is used , where the&nbsp; LinkFollower 
+ is made a Thread. </p>
+ <h3><strong>More on the Code</strong></h3>
+ <p>Now we have two threads, one is for&nbsp; sending the soap request without interrupting the user and other is to open 
+ a new windows for clicked URLs. But there is another important action. That is processing the received response and displaying the results. That is done in the ClientCallbackHandler. This is 
+ also an important feature of the InvokeNonBlocking operation of Axis2. It lets you to have an additional thread in the callbackHandler 
+ class. All you have to do is send an object of that class as a parameter when you send the message. How it is done in the 
+ program is as follows. </p>
+ <p><code>call.invokeNonBlocking(opdesc, requestContext, new ClientEchoCallbackHandler()); </code></p>
+ <p>opDesc – is a QName which caries the operation name and relevant namespace. </p>
+ <p>requestContext – is a MessageContext that holds the request soap envelope. </p>
+ <p>ClientEchoCallbackHandler – is a class that receives the response soap envelope. </p>
+ <p>Briefly it is client thread is just sending the requests and is not waiting for the response. So this client can send any amount of requests sequentially irrespective of whether the responses are received or not. ClientEchoCallbackHandler is responsible for receiving response messages and processing it. It extracts the required details from the message and displays it in the 
+ text pane of the GUI. </p>
+ <p>The request soap message is built at the ClientUtil 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><code>OMElement operation = omFactory.createOMElement(&quot;doGoogleSearch&quot;, &quot;urn:GoogleSearch&quot;, &quot;ns1&quot;); </code></p>
+ <p><code>opration.addAttribute(&quot;SOAP-ENV:encordingStyle&quot;, &quot;http://schemas.xmlsoap.org/soap/encoding/&quot;, null); </code></p>
+ <p>All the child elements of the operation element are carrying required parameters such as license key, 
+ query terms, results per page, etc. (for more information, download the developer kit from <a href="http://www.google.com/apis/download.html">http://www.google.com/apis/download.html </a>, and refer “APIs_Reference.html”) </p>
+ <p>This is a sample request soap enelope,</p>
+ <p><samp>&lt;soapenv:Envelope xmlns:soapenv=&quot;http://schemas.xmlsoap.org/soap/envelope/&quot; xmlns:SOAP-ENC=&quot;http://schemas.xmlsoap.org/soap/encoding/&quot; xmlns:xsi=&quot;http://www.w3.org/1999/XMLSchema-instance/&quot; xmlns:xsd=&quot;http://www.w3.org/1999/XMLSchema&quot;&gt;<br>
+&lt;soapenv:Header&gt;&lt;/soapenv:Header&gt;<br>
+&lt;soapenv:Body&gt;</samp></p>
+ <blockquote>
+   <p><samp>&lt;ns1:doGoogleSearch xmlns:ns1=&quot;urn:GoogleSearch&quot; SOAP-ENV:encordingStyle=&quot;http://schemas.xmlsoap.org/soap/encoding/&quot;&gt;<br>
+&lt;key xmlns=&quot;&quot; xsi:type=&quot;xsd:string&quot;&gt;F0wt5EFQFHKxTs+rl3P+27o6D112BTWd&lt;/key&gt;<br>
+&lt;q xmlns=&quot;&quot; xsi:type=&quot;xsd:string&quot;&gt;axis&lt;/q&gt;<br>
+&lt;start xmlns=&quot;&quot; xsi:type=&quot;xsd:int&quot;&gt;0&lt;/start&gt;<br>
+&lt;maxResults xmlns=&quot;&quot; xsi:type=&quot;xsd:int&quot;&gt;2&lt;/maxResults&gt;<br>
+&lt;filter xmlns=&quot;&quot; xsi:type=&quot;xsd:boolean&quot;&gt;true&lt;/filter&gt;<br>
+&lt;restrict xmlns=&quot;&quot; xsi:type=&quot;xsd:string&quot;&gt;&lt;/restrict&gt;<br>
+&lt;safeSearch xmlns=&quot;&quot; xsi:type=&quot;xsd:boolean&quot;&gt;false&lt;/safeSearch&gt;<br>
+&lt;lr xmlns=&quot;&quot; xsi:type=&quot;xsd:string&quot;&gt;&lt;/lr&gt;<br>
+&lt;ie xmlns=&quot;&quot; xsi:type=&quot;xsd:string&quot;&gt;latin1&lt;/ie&gt;<br>
+&lt;oe xmlns=&quot;&quot; xsi:type=&quot;xsd:string&quot;&gt;latin1&lt;/oe&gt;<br>
+&lt;/ns1:doGoogleSearch&gt;</samp></p>
+ </blockquote>
+ <p><samp>&lt;/soapenv:Body&gt;&lt;/soapenv:Envelope&gt;</samp></p>
+ <p>You can find a sample soap response message from the toolkit that you download from the Google Web API page.. ClientCallbackHandler 
+ processing response soap and extract elements which have the local names as 
+ &quot;snippet&quot; and &quot;URL&quot;. It has to work with AXIOM. You can notice that it uses several Iterators to go through the children of an OMElement.&nbsp; the Iterator 
+ returns an object that can be cast into an OMNode. Since you can't call for the children of an OMNode we have to cast it to an OMElement 
+ where a type cheking needs to be done as follows. </p>
+ <p><font face="Courier New"><font size="2">Iterator iterator0 = operation.getChildren();<br/> 
+ while (iterator0.hasNext()) { <br/>
+ OMNode node = (OMNode) iterator0.next(); <br/>
+ if (node.getType() == OMNode.ELEMENT_NODE) { <br/>
+ OMElement elem = (OMElement) node;</font> </font> </p>
+ <p>A notable fact here is that the text in the snippet element is in the HTML format. But it cannot be displayed straight away because you have to attach the HTML header and footer to that. “beginHTML” and “endHTML” static variables are used for that purpose. </p>
+ <h3><strong>Extending the Client </strong></h3>
+ <p> If you observe the WSDL file of the Google API, you can find two more operations other than “doGoogleSearch”. Those are <strong>&quot;doGetCachedPage&quot;and &quot; </strong><strong>doSpellingSuggestion&quot; </strong>. You can extend this program to work these operations too. Because the soap requests and responses are different, it will need separate ClientUtil classes and ClientCallbackHandler 
+ classes to fulfill this task. </p>
+ <p>&nbsp; </p>
+ <hr/>
+</body>
+</html>
\ No newline at end of file

Added: webservices/axis/trunk/java/modules/samples/xdocs/googleSearch/archi.JPG
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/samples/xdocs/googleSearch/archi.JPG?rev=180086&view=auto
==============================================================================
Binary file - no diff available.

Propchange: webservices/axis/trunk/java/modules/samples/xdocs/googleSearch/archi.JPG
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: webservices/axis/trunk/java/modules/samples/xdocs/googleSearch/sceenShot1.JPG
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/samples/xdocs/googleSearch/sceenShot1.JPG?rev=180086&view=auto
==============================================================================
Binary file - no diff available.

Propchange: webservices/axis/trunk/java/modules/samples/xdocs/googleSearch/sceenShot1.JPG
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: webservices/axis/trunk/java/modules/samples/xdocs/googleSearch/screenShot2.JPG
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/samples/xdocs/googleSearch/screenShot2.JPG?rev=180086&view=auto
==============================================================================
Binary file - no diff available.

Propchange: webservices/axis/trunk/java/modules/samples/xdocs/googleSearch/screenShot2.JPG
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: webservices/axis/trunk/java/modules/samples/xdocs/googleSearch/screenShot3.JPG
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/samples/xdocs/googleSearch/screenShot3.JPG?rev=180086&view=auto
==============================================================================
Binary file - no diff available.

Propchange: webservices/axis/trunk/java/modules/samples/xdocs/googleSearch/screenShot3.JPG
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: webservices/axis/trunk/java/modules/samples/xdocs/googleSpellcheck/Google1.jpg
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/samples/xdocs/googleSpellcheck/Google1.jpg?rev=180086&view=auto
==============================================================================
Binary file - no diff available.

Propchange: webservices/axis/trunk/java/modules/samples/xdocs/googleSpellcheck/Google1.jpg
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: webservices/axis/trunk/java/modules/samples/xdocs/googleSpellcheck/GoogleSpellCheck.html
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/samples/xdocs/googleSpellcheck/GoogleSpellCheck.html?rev=180086&view=auto
==============================================================================
--- webservices/axis/trunk/java/modules/samples/xdocs/googleSpellcheck/GoogleSpellCheck.html (added)
+++ webservices/axis/trunk/java/modules/samples/xdocs/googleSpellcheck/GoogleSpellCheck.html Sun Jun  5 06:27:25 2005
@@ -0,0 +1,157 @@
+<html>
+
+<head>
+<meta http-equiv="Content-Language" content="en-us">
+<meta name="GENERATOR" content="Microsoft FrontPage 5.0">
+<meta name="ProgId" content="FrontPage.Editor.Document">
+<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. Eventhough 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>Suggesion 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>
+axisop – is a string which caries the operation name. <br>
+toSend – is a Element that holds the request soap envelope. <br>
+callback – is a class that receives the response soap envelope. </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(&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>
\ No newline at end of file

Added: webservices/axis/trunk/java/modules/samples/xdocs/googleSpellcheck/ModeMenu.JPG
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/samples/xdocs/googleSpellcheck/ModeMenu.JPG?rev=180086&view=auto
==============================================================================
Binary file - no diff available.

Propchange: webservices/axis/trunk/java/modules/samples/xdocs/googleSpellcheck/ModeMenu.JPG
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: webservices/axis/trunk/java/modules/samples/xdocs/googleSpellcheck/asyncScreen.JPG
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/samples/xdocs/googleSpellcheck/asyncScreen.JPG?rev=180086&view=auto
==============================================================================
Binary file - no diff available.

Propchange: webservices/axis/trunk/java/modules/samples/xdocs/googleSpellcheck/asyncScreen.JPG
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: webservices/axis/trunk/java/modules/samples/xdocs/googleSpellcheck/clearMenu.JPG
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/samples/xdocs/googleSpellcheck/clearMenu.JPG?rev=180086&view=auto
==============================================================================
Binary file - no diff available.

Propchange: webservices/axis/trunk/java/modules/samples/xdocs/googleSpellcheck/clearMenu.JPG
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: webservices/axis/trunk/java/modules/samples/xdocs/googleSpellcheck/helpMenu.JPG
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/samples/xdocs/googleSpellcheck/helpMenu.JPG?rev=180086&view=auto
==============================================================================
Binary file - no diff available.

Propchange: webservices/axis/trunk/java/modules/samples/xdocs/googleSpellcheck/helpMenu.JPG
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: webservices/axis/trunk/java/modules/samples/xdocs/googleSpellcheck/settingsMenu.JPG
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/samples/xdocs/googleSpellcheck/settingsMenu.JPG?rev=180086&view=auto
==============================================================================
Binary file - no diff available.

Propchange: webservices/axis/trunk/java/modules/samples/xdocs/googleSpellcheck/settingsMenu.JPG
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: webservices/axis/trunk/java/modules/samples/xdocs/googleSpellcheck/syncScreen.JPG
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/samples/xdocs/googleSpellcheck/syncScreen.JPG?rev=180086&view=auto
==============================================================================
Binary file - no diff available.

Propchange: webservices/axis/trunk/java/modules/samples/xdocs/googleSpellcheck/syncScreen.JPG
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream



Mime
View raw message