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