1 package org.objectweb.hello_world_soap_http; 2 3 import java.rmi.RemoteException ; 4 import java.util.HashMap ; 5 import java.util.Map ; 6 import java.util.concurrent.Future ; 7 import java.util.logging.Logger ; 8 9 import javax.xml.ws.AsyncHandler; 10 import javax.xml.ws.Response; 11 12 import org.objectweb.hello_world_soap_http.types.BareDocumentResponse; 13 import org.objectweb.hello_world_soap_http.types.GreetMeResponse; 14 import org.objectweb.hello_world_soap_http.types.GreetMeSometimeResponse; 15 import org.objectweb.hello_world_soap_http.types.SayHiResponse; 16 import org.objectweb.hello_world_soap_http.types.TestDocLitFaultResponse; 17 18 19 @javax.jws.WebService(name = "Greeter", serviceName = "SOAPService", 20 targetNamespace = "http://objectweb.org/hello_world_soap_http") 21 public class DerivedGreeterImpl implements Greeter { 22 23 private static final Logger LOG = 24 Logger.getLogger(DerivedGreeterImpl.class.getName()); 25 private final Map <String , Integer > invocationCount = new HashMap <String , Integer >(); 26 27 public DerivedGreeterImpl() { 28 invocationCount.put("sayHi", 0); 29 invocationCount.put("greetMe", 0); 30 invocationCount.put("greetMeOneWay", 0); 31 invocationCount.put("overloadedSayHi", 0); 32 } 33 34 public int getInvocationCount(String method) { 35 if (invocationCount.containsKey(method)) { 36 return invocationCount.get(method).intValue(); 37 } else { 38 System.out.println("No invocation count for method: " + method); 39 return 0; 40 } 41 } 42 43 46 public String sayHi(String me) throws RemoteException { 47 incrementInvocationCount("overloadedSayHi"); 48 return "Hi " + me + "!"; 49 } 50 51 @javax.jws.WebMethod(operationName = "sayHi") 52 56 public String sayHi() { 57 incrementInvocationCount("sayHi"); 58 return "Hi"; 59 } 60 61 public void testDocLitFault(String faultType) throws BadRecordLitFault, NoSuchCodeLitFault { 62 } 63 64 public Response<TestDocLitFaultResponse> testDocLitFaultAsync(String faultType) { 65 return null; 66 67 } 68 69 public Response<TestDocLitFaultResponse> testDocLitFaultAsync(String faultType, AsyncHandler ah) { 70 return null; 71 72 } 73 74 75 public String greetMe(String me) { 76 incrementInvocationCount("greetMe"); 77 return "Bonjour " + me + "!"; 78 } 79 80 public String greetMeSometime(String me) { 81 incrementInvocationCount("greetMeSometime"); 82 return "Hello there " + me + "!"; 83 } 84 85 public Future <?> greetMeSometimeAsync(String requestType, 86 AsyncHandler<GreetMeSometimeResponse> asyncHandler) { 87 return null; 88 89 } 90 91 public Response<GreetMeSometimeResponse> greetMeSometimeAsync(String requestType) { 92 return null; 93 94 } 95 96 public Future <?> greetMeAsync(String requestType, AsyncHandler<GreetMeResponse> asyncHandler) { 97 return null; 98 99 } 100 101 public Response<GreetMeResponse> greetMeAsync(String requestType) { 102 return null; 103 104 } 105 106 public Future <?> sayHiAsync(AsyncHandler<SayHiResponse> asyncHandler) { 107 return null; 108 109 } 110 111 public Response<SayHiResponse> sayHiAsync() { 112 return null; 113 114 } 115 116 public Future <?> testDocLitBareAsync(String in, AsyncHandler<BareDocumentResponse> asyncHandler) { 117 return null; 118 119 } 120 121 public Response<BareDocumentResponse> testDocLitBareAsync(String in) { 122 return null; 123 124 } 125 126 public void greetMeOneWay(String me) { 127 incrementInvocationCount("greetMeOneWay"); 128 } 129 130 public BareDocumentResponse testDocLitBare(String in) { 131 incrementInvocationCount("testDocLitBare"); 132 BareDocumentResponse res = new BareDocumentResponse(); 133 res.setCompany("Celtix"); 134 res.setId(1); 135 return res; 136 } 137 138 private void incrementInvocationCount(String method) { 139 LOG.info("Executing " + method); 140 int n = invocationCount.get(method); 141 invocationCount.put(method, n + 1); 142 } 143 144 } 145 | Popular Tags |