package web; /* * Copyright 2004 The Apache Software Foundation * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * * $Header:$ */ import javax.jws.Oneway; import javax.jws.WebMethod; import javax.jws.WebParam; import javax.jws.WebResult; 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.InvalidAddressException; import org.apache.beehive.sample.InvalidNameException; import javax.xml.rpc.holders.StringHolder; import javax.xml.rpc.holders.CalendarHolder; @WebService(targetNamespace="http://beehive.apache.org/EnhancedAddressBook") public class Service implements EnhancedAddressBook { EnhancedAddressBook addressBook; /** * Constructor. */ public Service() { addressBook = new AddressBookImpl(); } /** * Web method that adds an entry to the AddressBook. * @param name * @param address */ @WebMethod public void addEntry(@WebParam (name="name")String name, @WebParam (name="address")Address address) throws InvalidNameException, InvalidAddressException{ addressBook.addEntry(name, address); } /** * Web method that queries the AddressBook. * @param name * @return */ @WebMethod public Address getAddressFromName(@WebParam (name="name" )String name) throws InvalidNameException { return addressBook.getAddressFromName(name); } @WebMethod public Address[] getAddressFromNames(@WebParam (name="name")String[] name) throws InvalidNameException{ return addressBook.getAddressFromNames(name); } @WebMethod @Oneway public void oneWayWithNoParam() { return; } @WebMethod public String simpleNoParamMethod () { return "No Param method"; } @WebMethod public String oneINOUTParamMethod (@WebParam (name="calendar", mode=WebParam.Mode.INOUT )CalendarHolder calendar) { return addressBook.oneINOUTParamMethod(calendar); } /** * This method 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"; } }