Author: mmerz
Date: Wed Mar 16 13:25:02 2005
New Revision: 157806

URL: http://svn.apache.org/viewcvs?view=rev&rev=157806
Log:
Added comments, initial entry for address book.


Modified:
    
incubator/beehive/trunk/samples/wsm-addressbook-enhanced/WEB-INF/src/web/Service.jws

Modified: 
incubator/beehive/trunk/samples/wsm-addressbook-enhanced/WEB-INF/src/web/Service.jws
URL: 
http://svn.apache.org/viewcvs/incubator/beehive/trunk/samples/wsm-addressbook-enhanced/WEB-INF/src/web/Service.jws?view=diff&r1=157805&r2=157806
==============================================================================
--- 
incubator/beehive/trunk/samples/wsm-addressbook-enhanced/WEB-INF/src/web/Service.jws
 (original)
+++ 
incubator/beehive/trunk/samples/wsm-addressbook-enhanced/WEB-INF/src/web/Service.jws
 Wed Mar 16 13:25:02 2005
@@ -18,6 +18,9 @@
  * $Header:$
  */
 
+import javax.xml.rpc.holders.CalendarHolder;
+import javax.xml.rpc.holders.StringHolder;
+
 import javax.jws.Oneway;
 import javax.jws.WebMethod;
 import javax.jws.WebParam;
@@ -25,85 +28,126 @@
 import javax.jws.WebService;
 
 import org.apache.beehive.sample.Address;
-import org.apache.beehive.sample.EnhancedAddressBook;
 import org.apache.beehive.sample.AddressBookImpl;
+import org.apache.beehive.sample.EnhancedAddressBook;
 import org.apache.beehive.sample.InvalidAddressException;
 import org.apache.beehive.sample.InvalidNameException;
-
-import javax.xml.rpc.holders.StringHolder;
-import javax.xml.rpc.holders.CalendarHolder;
+import org.apache.beehive.sample.Phone;
+import org.apache.beehive.sample.StateType;
 
 
[EMAIL 
PROTECTED](targetNamespace="http://beehive.apache.org/EnhancedAddressBook";)
[EMAIL PROTECTED](
+  targetNamespace="http://beehive.apache.org/enhancedaddressbook";,
+  serviceName="EnhancedAddressBook"
+)
 public class Service implements EnhancedAddressBook {
 
-    EnhancedAddressBook addressBook;
+    private static String DEFAULT_NAME = "default";
+
+    private EnhancedAddressBook addressBook;
 
     /**
      * Constructor.
      */
     public Service() {
         addressBook = new AddressBookImpl();
+        try {
+            addressBook.addEntry(
+                DEFAULT_NAME,
+                new Address(
+                    10230,
+                    "NE Points Drive",
+                    "Kirkland",
+                    new StateType("WA"),
+                    98033,
+                    new Phone(425, "555", "1234")
+                )
+            );
+        }
+        catch (InvalidNameException e) {
+            throw new RuntimeException("cannot add entry to address book");
+        }
+        catch (InvalidAddressException e) {
+            throw new RuntimeException("cannot add entry to address book");
+        }
     }
     
     /**
-     * Web method that adds an entry to the AddressBook.
-     * @param name
-     * @param address
+     * Web method that adds an entry to the address book.
+     * @param name The name under which the address is added to the address
+     *   book.
+     * @param address The address to be added.
+     * @throws InvalidNameException
+     * @throws InvalidAddressException
      */
     @WebMethod
-    public void addEntry(@WebParam (name="name")String name, 
-               @WebParam (name="address")Address address) 
-               throws InvalidNameException, InvalidAddressException{
+    public void addEntry(@WebParam (name="custom_name")String name, @WebParam 
(name="custom_address")Address address) 
+            throws InvalidNameException, InvalidAddressException
+    {
         addressBook.addEntry(name, address);
     }
 
     /**
-     * Web method that queries the AddressBook.
-     * @param name
-     * @return
+     * Web method that queries the address book.
+     * @param name Name for which the address is returned.
+     * @return Address for the passed in name.
+     * @throws InvalidNameException
      */
     @WebMethod
-    public Address getAddressFromName(@WebParam (name="name" )String name)
-       throws InvalidNameException {
+    public Address getAddressFromName(@WebParam (name="custom_name") String 
name)
+            throws InvalidNameException
+    {
         return addressBook.getAddressFromName(name);
     }
     
+    /**
+     * Web method that queries the address book.
+     * @param name Array of names for which the addresses are returned.
+     * @return Array of addresses for the passed in names.
+     * @throws InvalidNameException
+     */
     @WebMethod
-    public Address[] getAddressFromNames(@WebParam (name="name")String[] name) 
-       throws InvalidNameException{
+    public Address[] getAddressFromNames(@WebParam (name="custom_name") 
String[] name) 
+            throws InvalidNameException
+    {
        return addressBook.getAddressFromNames(name);
     }    
-    
 
-    
-    
-     @WebMethod
+    /**
+     * Simple Oneway web method that doesn't take any input params.
+     */
+    @WebMethod
     @Oneway
     public void oneWayWithNoParam() {
        return;
     }
-    
-    
-    
+
+    /**
+     * Web method that takes one in/out param.
+     * @param calendar In out parameter; its value is overwritten inside this
+     *   method.
+     * @return A random string.
+     */
     @WebMethod
-    public String simpleNoParamMethod () {
-       return "No Param method";
+    public String oneINOUTParamMethod (@WebParam (name="calendar", 
mode=WebParam.Mode.INOUT) CalendarHolder calendar) {
+       return addressBook.oneINOUTParamMethod(calendar);
     }
     
+    /**
+     * Simple web method that doesn't take any input params.
+     * @return A random string.
+     */
     @WebMethod
-    public String oneINOUTParamMethod (@WebParam (name="calendar", 
mode=WebParam.Mode.INOUT )CalendarHolder calendar) {
-       return addressBook.oneINOUTParamMethod(calendar);
+    public String simpleNoParamMethod() {
+       return "simpleNoParamMethod()";
     }
     
     /**
-     * This method is not exposed by the Web Service and can only be used
+     * Simple method that is not exposed by the web service and can only be 
used
      * locally.
      * @return A random string.
      */
     public String notWebService() {
-        return "Not available through Web service";
+        return "notWebService()";
     }
-    
-    
-}
+}
\ No newline at end of file


Reply via email to