001: package org.objectweb.celtix.systest.ws.addressing;
002:
003: import java.util.concurrent.Future;
004:
005: import javax.annotation.Resource;
006: import javax.jws.WebService;
007: import javax.xml.ws.AsyncHandler;
008: import javax.xml.ws.Response;
009: import javax.xml.ws.WebServiceContext;
010:
011: import org.objectweb.celtix.ws.addressing.AddressingProperties;
012: import org.objectweb.hello_world_soap_http.BadRecordLitFault;
013: import org.objectweb.hello_world_soap_http.Greeter;
014: import org.objectweb.hello_world_soap_http.NoSuchCodeLitFault;
015: import org.objectweb.hello_world_soap_http.types.BareDocumentResponse; //import org.objectweb.hello_world_soap_http.types.ErrorCode;
016: import org.objectweb.hello_world_soap_http.types.ErrorCode;
017: import org.objectweb.hello_world_soap_http.types.GreetMeResponse;
018: import org.objectweb.hello_world_soap_http.types.GreetMeSometimeResponse;
019: import org.objectweb.hello_world_soap_http.types.NoSuchCodeLit; //import org.objectweb.hello_world_soap_http.types.NoSuchCodeLit;
020: import org.objectweb.hello_world_soap_http.types.SayHiResponse;
021: import org.objectweb.hello_world_soap_http.types.TestDocLitFaultResponse;
022:
023: import static org.objectweb.celtix.ws.addressing.JAXWSAConstants.SERVER_ADDRESSING_PROPERTIES_INBOUND;
024:
025: @WebService(serviceName="SOAPServiceAddressing",portName="SoapPort",endpointInterface="org.objectweb.hello_world_soap_http.Greeter",targetNamespace="http://objectweb.org/hello_world_soap_http")
026: public class GreeterImpl implements Greeter {
027: VerificationCache verificationCache;
028:
029: /**
030: * Injectable context.
031: */
032: @Resource
033: private WebServiceContext context;
034:
035: public String greetMe(String me) {
036: verifyMAPs();
037: return "Hello " + me;
038: }
039:
040: public void greetMeOneWay(String requestType) {
041: verifyMAPs();
042: }
043:
044: public String sayHi() {
045: verifyMAPs();
046: return "Bonjour";
047: }
048:
049: public void testDocLitFault(String faultType)
050: throws BadRecordLitFault, NoSuchCodeLitFault {
051: verifyMAPs();
052: if (faultType.equals(BadRecordLitFault.class.getSimpleName())) {
053: throw new BadRecordLitFault("TestBadRecordLit",
054: "BadRecordLitFault");
055: }
056: if (faultType.equals(NoSuchCodeLitFault.class.getSimpleName())) {
057: ErrorCode ec = new ErrorCode();
058: ec.setMajor((short) 1);
059: ec.setMinor((short) 1);
060: NoSuchCodeLit nscl = new NoSuchCodeLit();
061: nscl.setCode(ec);
062: throw new NoSuchCodeLitFault("TestNoSuchCodeLit", nscl);
063: }
064: }
065:
066: public BareDocumentResponse testDocLitBare(String in) {
067: BareDocumentResponse res = new BareDocumentResponse();
068: res.setCompany("Celtix");
069: res.setId(1);
070: return res;
071: }
072:
073: private void verifyMAPs() {
074: String property = SERVER_ADDRESSING_PROPERTIES_INBOUND;
075: AddressingProperties maps = (AddressingProperties) context
076: .getMessageContext().get(property);
077: verificationCache.put(MAPTest.verifyMAPs(maps, this ));
078: }
079:
080: public String greetMeSometime(String me) {
081: return "How are you " + me;
082: }
083:
084: public Future<?> greetMeSometimeAsync(String requestType,
085: AsyncHandler<GreetMeSometimeResponse> asyncHandler) {
086: return null;
087: /*not called */
088: }
089:
090: public Response<GreetMeSometimeResponse> greetMeSometimeAsync(
091: String requestType) {
092: return null;
093: /*not called */
094: }
095:
096: public Response<TestDocLitFaultResponse> testDocLitFaultAsync(
097: String faultType) {
098: return null;
099: /*not called */
100: }
101:
102: public Future<?> testDocLitFaultAsync(String faultType,
103: AsyncHandler ah) {
104: return null;
105: /*not called */
106: }
107:
108: public Future<?> testDocLitBareAsync(String bare, AsyncHandler ah) {
109: return null;
110: /* not called */
111: }
112:
113: public Response<BareDocumentResponse> testDocLitBareAsync(
114: String bare) {
115: return null;
116: /* not called */
117: }
118:
119: public Future<?> greetMeAsync(String requestType,
120: AsyncHandler<GreetMeResponse> asyncHandler) {
121: return null;
122: /*not called */
123: }
124:
125: public Response<GreetMeResponse> greetMeAsync(String requestType) {
126: return null;
127: /*not called */
128: }
129:
130: public Future<?> sayHiAsync(AsyncHandler<SayHiResponse> asyncHandler) {
131: return null;
132: /*not called */
133: }
134:
135: public Response<SayHiResponse> sayHiAsync() {
136: return null;
137: /*not called */
138: }
139:
140: }
|