01: package org.objectweb.hello_world_soap_http;
02:
03: import java.util.HashMap;
04: import java.util.Map;
05: import java.util.logging.Logger;
06: import javax.annotation.Resource;
07: import javax.jws.HandlerChain;
08: import javax.jws.Oneway;
09: import javax.jws.WebMethod;
10: import javax.jws.WebResult;
11: import javax.xml.ws.RequestWrapper;
12: import javax.xml.ws.ResponseWrapper;
13: import javax.xml.ws.WebServiceContext;
14:
15: @javax.jws.WebService(name="Greeter",serviceName="SOAPService",targetNamespace="http://objectweb.org/hello_world_soap_http")
16: @HandlerChain(name="TestHandlerChain",file="handlers.xml")
17: public class AnnotatedGreeterNoOverloadImpl {
18:
19: private static final Logger LOG = Logger
20: .getLogger(AnnotatedGreeterImpl.class.getName());
21:
22: @Resource
23: private int foo;
24:
25: private WebServiceContext context;
26:
27: private final Map<String, Integer> invocationCount = new HashMap<String, Integer>();
28:
29: public AnnotatedGreeterNoOverloadImpl() {
30: invocationCount.put("sayHi", 0);
31: invocationCount.put("greetMe", 0);
32: invocationCount.put("overloadedSayHi", 0);
33: }
34:
35: public int getInvocationCount(String method) {
36: if (invocationCount.containsKey(method)) {
37: return invocationCount.get(method).intValue();
38: } else {
39: System.out.println("No invocation count for method: "
40: + method);
41: return 0;
42: }
43: }
44:
45: @WebMethod
46: @WebResult(name="responseType",targetNamespace="http://objectweb.org/hello_world_soap_http/types")
47: @RequestWrapper(className="org.objectweb.hello_world_soap_http.types.SayHi",localName="sayHi",targetNamespace="http://objectweb.org/hello_world_soap_http/types")
48: @ResponseWrapper(className="org.objectweb.hello_world_soap_http.types.SayHiResponse",localName="sayHiResponse",targetNamespace="http://objectweb.org/hello_world_soap_http/types")
49: public String sayHi() {
50: incrementInvocationCount("sayHi");
51: return "Hi";
52: }
53:
54: @WebMethod
55: @WebResult(name="responseType",targetNamespace="http://objectweb.org/hello_world_soap_http/types")
56: @RequestWrapper(className="org.objectweb.hello_world_soap_http.types.GreetMe",localName="greetMe",targetNamespace="http://objectweb.org/hello_world_soap_http/types")
57: @ResponseWrapper(className="org.objectweb.hello_world_soap_http.types.GreetMeResponse",localName="greetMeResponse",targetNamespace="http://objectweb.org/hello_world_soap_http/types")
58: public String greetMe(String me) {
59: incrementInvocationCount("greetMe");
60: return "Bonjour " + me + "!";
61: }
62:
63: @WebMethod
64: @RequestWrapper(className="org.objectweb.hello_world_soap_http.types.GreetMeOneWay",localName="greetMeOneWay",targetNamespace="http://objectweb.org/hello_world_soap_http/types")
65: @Oneway
66: public void greetMeOneWay(String me) {
67: incrementInvocationCount("greetMeOneWay");
68: System.out.println("Hello there " + me);
69: System.out.println("That was OneWay to say hello");
70: }
71:
72: public void testDocLitFault(String faultType)
73: throws BadRecordLitFault, NoSuchCodeLitFault {
74: }
75:
76: @Resource
77: public void setContext(WebServiceContext ctx) {
78: context = ctx;
79: }
80:
81: public WebServiceContext getContext() {
82: return context;
83: }
84:
85: /**
86: * stop eclipse from whinging
87: */
88: public int getFoo() {
89: return foo;
90: }
91:
92: private void incrementInvocationCount(String method) {
93: LOG.info("Executing " + method);
94: int n = invocationCount.get(method);
95: invocationCount.put(method, n + 1);
96: }
97:
98: }
|