1 22 package org.jboss.test.webservice.jbws413; 23 24 import java.net.URL ; 25 26 import javax.naming.InitialContext ; 27 import javax.xml.namespace.QName ; 28 import javax.xml.rpc.Call ; 29 import javax.xml.rpc.Service ; 30 import javax.xml.rpc.ServiceFactory ; 31 32 import junit.framework.Test; 33 34 import org.jboss.test.webservice.WebserviceTestBase; 35 36 44 public class JBWS413TestCase extends WebserviceTestBase 45 { 46 48 public JBWS413TestCase(String name) 49 { 50 super(name); 51 } 52 53 54 public static Test suite() throws Exception  55 { 56 return getDeploySetup(JBWS413TestCase.class, "ws4ee-jbws413.war, ws4ee-jbws413-client.jar"); 57 } 58 59 public void testClientAccess() throws Exception  60 { 61 InitialContext iniCtx = getClientContext(); 62 Service service = (Service )iniCtx.lookup("java:comp/env/service/TestService"); 63 TestSEI port = (TestSEI)service.getPort(TestSEI.class); 64 65 JavaType in = new JavaType(new Double [] { new Double (1), new Double (2), new Double (3) }); 66 JavaType retObj = port.doStuff(in); 67 assertEquals(in, retObj); 68 } 69 70 75 public void testDIIAccess() throws Exception  76 { 77 String targetEndpoint = "http://" + getServerHost() + ":8080/ws4ee-jbws413"; 78 String nsURI = "http://org.jboss.test.webservice/jbws413"; 79 QName serviceName = new QName (nsURI, "TestService"); 80 81 ServiceFactory factory = ServiceFactory.newInstance(); 82 83 Service service = factory.createService(new URL (targetEndpoint + "?wsdl"), serviceName); 85 Call call = service.createCall(); 86 87 call.setOperationName(new QName (nsURI, "doStuff")); 88 call.setTargetEndpointAddress(targetEndpoint); 89 90 JavaType in = new JavaType(new Double [] { new Double (1), new Double (2), new Double (3) }); 91 Object retObj = call.invoke(new Object [] { in }); 92 assertEquals(in, retObj); 93 } 94 } 95 | Popular Tags |