KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > demo > hw > server > GreeterImpl


1 package demo.hw.server;
2
3 import java.util.logging.Logger JavaDoc;
4 import org.objectweb.hello_world_soap_http.Greeter;
5 import org.objectweb.hello_world_soap_http.PingMeFault;
6 import org.objectweb.hello_world_soap_http.types.FaultDetail;
7
8 @javax.jws.WebService(name = "Greeter", serviceName = "SOAPService",
9                       targetNamespace = "http://objectweb.org/hello_world_soap_http",
10                       wsdlLocation = "file:./wsdl/hello_world.wsdl")
11                   
12 public class GreeterImpl implements Greeter {
13
14     private static final Logger JavaDoc LOG =
15         Logger.getLogger(GreeterImpl.class.getPackage().getName());
16     
17     /* (non-Javadoc)
18      * @see org.objectweb.hello_world_soap_http.Greeter#greetMe(java.lang.String)
19      */

20     public String JavaDoc greetMe(String JavaDoc me) {
21         LOG.info("Executing operation greetMe");
22         System.out.println("Executing operation greetMe");
23         System.out.println("Message received: " + me + "\n");
24         return "Hello " + me;
25     }
26     
27     /* (non-Javadoc)
28      * @see org.objectweb.hello_world_soap_http.Greeter#greetMeOneWay(java.lang.String)
29      */

30     public void greetMeOneWay(String JavaDoc me) {
31         LOG.info("Executing operation greetMeOneWay");
32         System.out.println("Executing operation greetMeOneWay\n");
33         System.out.println("Hello there " + me);
34     }
35
36     /* (non-Javadoc)
37      * @see org.objectweb.hello_world_soap_http.Greeter#sayHi()
38      */

39     public String JavaDoc sayHi() {
40         LOG.info("Executing operation sayHi");
41         System.out.println("Executing operation sayHi\n");
42         return "Bonjour";
43     }
44     
45     public void pingMe() throws PingMeFault {
46         FaultDetail faultDetail = new FaultDetail();
47         faultDetail.setMajor((short)2);
48         faultDetail.setMinor((short)1);
49         LOG.info("Executing operation pingMe, throwing PingMeFault exception");
50         System.out.println("Executing operation pingMe, throwing PingMeFault exception\n");
51         throw new PingMeFault("PingMeFault raised by server", faultDetail);
52     }
53
54     
55 }
56
Popular Tags