01: package org.objectweb.celtix.systest.securebasic;
02:
03: import java.lang.reflect.UndeclaredThrowableException;
04: import java.net.URL;
05:
06: import javax.jws.WebService;
07: import javax.xml.namespace.QName;
08:
09: import org.objectweb.hello_world_soap_http_secure.Greeter;
10:
11: import org.objectweb.hello_world_soap_http_secure.SecureSOAPService;
12: import org.objectweb.hello_world_soap_http_secure.types.Result;
13:
14: @WebService(serviceName="SecureSOAPService",portName="SoapPort",endpointInterface="org.objectweb.hello_world_soap_http_secure.Greeter",targetNamespace="http://objectweb.org/hello_world_soap_http_secure")
15: public class InterGreeterImpl implements Greeter {
16:
17: public Result greetMeTwoTier(String me, int testIndex) {
18:
19: Result ret = new Result();
20: ret.setDidPass(Matrix.FAIL);
21: ret.setReturnString("");
22: ret
23: .setFailureReason("Should only be called as part of three tier test");
24: return ret;
25: }
26:
27: public Result greetMeThreeTier(String me, int testIndex) {
28: String response1 = new String("Hello Milestone-");
29:
30: URL wsdl = getClass()
31: .getResource(
32: "/wsdl/"
33: + Matrix.THREE_TIER_TESTS[testIndex].interData.interWsdl);
34: QName secureServiceName = new QName(
35: "http://objectweb.org/hello_world_soap_http_secure",
36: Matrix.THREE_TIER_TESTS[testIndex].interData.interServiceName);
37: SecureSOAPService service = new SecureSOAPService(wsdl,
38: secureServiceName);
39:
40: QName portName = new QName(
41: "http://objectweb.org/hello_world_soap_http_secure",
42: Matrix.THREE_TIER_TESTS[testIndex].interData.interPortName);
43: Greeter greeter = service.getPort(portName, Greeter.class);
44: try {
45: Result res = greeter.greetMeThreeTier("Milestone-"
46: + testIndex, testIndex);
47: if (!Matrix.THREE_TIER_TESTS[testIndex].interData.interExpectSuccess) {
48: return Matrix.fail("Expected to fail but didn't");
49: }
50: String exResponse = response1 + testIndex;
51: Result failResult = Matrix
52: .dealWithResponse(exResponse, res);
53: if (failResult != null) {
54: return failResult;
55: }
56:
57: } catch (UndeclaredThrowableException ex) {
58: if (Matrix.THREE_TIER_TESTS[testIndex].interData.interExpectSuccess) {
59: ex.printStackTrace();
60: return Matrix.fail("Caught unexpected ex = "
61: + ex.getMessage());
62: }
63:
64: }
65: Result ret = new Result();
66: ret.setDidPass(Matrix.SUCCEED);
67: ret.setReturnString("Hello " + me);
68: ret.setFailureReason("");
69: return ret;
70: }
71:
72: }
|