01: package demo.hw.server;
02:
03: import java.util.logging.Logger;
04: import org.objectweb.celtix.Bus;
05: import org.objectweb.celtix.management.InstrumentationManager;
06: import org.objectweb.hello_world_soap_http.Greeter;
07: import org.objectweb.hello_world_soap_http.PingMeFault;
08: import org.objectweb.hello_world_soap_http.types.FaultDetail;
09:
10: @javax.jws.WebService(name="Greeter",serviceName="SOAPService",targetNamespace="http://objectweb.org/hello_world_soap_http",wsdlLocation="file:./wsdl/hello_world.wsdl")
11: public class GreeterImpl implements Greeter {
12:
13: private static final Logger LOG = Logger
14: .getLogger(GreeterImpl.class.getPackage().getName());
15:
16: int[] requestCounters = new int[4];
17:
18: String returnName = "Bonjour";
19:
20: private GreeterInstrumentation in;
21:
22: private InstrumentationManager im;
23:
24: /*
25: * Create the instrumentation component and register it to instrumentation manager
26: */
27: public GreeterImpl() {
28: in = new GreeterInstrumentation(this );
29: Bus bus = Bus.getCurrent();
30: im = bus.getInstrumentationManager();
31: im.register(in);
32: }
33:
34: public void shutDown() {
35: im.unregister(in);
36: }
37:
38: /* (non-Javadoc)
39: * @see org.objectweb.hello_world_soap_http.Greeter#greetMe(java.lang.String)
40: */
41: public String greetMe(String me) {
42: LOG.info("Executing operation greetMe");
43: System.out.println("Executing operation greetMe");
44: System.out.println("Message received: " + me + "\n");
45: requestCounters[0]++;
46: return "Hello " + me;
47: }
48:
49: /* (non-Javadoc)
50: * @see org.objectweb.hello_world_soap_http.Greeter#greetMeOneWay(java.lang.String)
51: */
52: public void greetMeOneWay(String me) {
53: LOG.info("Executing operation greetMeOneWay");
54: System.out.println("Executing operation greetMeOneWay\n");
55: System.out.println("Hello there " + me);
56: requestCounters[1]++;
57: }
58:
59: /* (non-Javadoc)
60: * @see org.objectweb.hello_world_soap_http.Greeter#sayHi()
61: */
62: public String sayHi() {
63: LOG.info("Executing operation sayHi");
64: System.out.println("Executing operation sayHi\n");
65: requestCounters[2]++;
66: return returnName;
67: }
68:
69: public void pingMe() throws PingMeFault {
70: FaultDetail faultDetail = new FaultDetail();
71: faultDetail.setMajor((short) 2);
72: faultDetail.setMinor((short) 1);
73: LOG
74: .info("Executing operation pingMe, throwing PingMeFault exception");
75: System.out
76: .println("Executing operation pingMe, throwing PingMeFault exception\n");
77: requestCounters[3]++;
78: throw new PingMeFault("PingMeFault raised by server",
79: faultDetail);
80: }
81:
82: }
|