1 22 package org.jboss.test.ws.jaxws.webserviceref; 23 24 import java.io.File ; 25 import java.net.MalformedURLException ; 26 import java.net.URL ; 27 28 import javax.xml.namespace.QName ; 29 import javax.xml.ws.Service; 30 31 import junit.framework.Test; 32 33 import org.jboss.test.ws.JBossWSTest; 34 import org.jboss.test.ws.JBossWSTestSetup; 35 import org.jboss.ws.metadata.wsdl.WSDLDefinitions; 36 import org.jboss.ws.metadata.wsdl.WSDLDefinitionsFactory; 37 38 44 public class WebServiceRefClientTestCase extends JBossWSTest 45 { 46 public final String TARGET_ENDPOINT_ADDRESS = "http://" + getServerHost() + ":8080/jaxws-webserviceref"; 47 48 public static Test suite() 49 { 50 return JBossWSTestSetup.newTestSetup(WebServiceRefClientTestCase.class, "jaxws-webserviceref.war, jaxws-webserviceref-client.jar"); 51 } 52 53 public void testWSDLAccess() throws MalformedURLException 54 { 55 URL wsdlURL = new URL (TARGET_ENDPOINT_ADDRESS + "?wsdl"); 56 WSDLDefinitionsFactory factory = WSDLDefinitionsFactory.newInstance(); 57 WSDLDefinitions wsdlDefinitions = factory.parse(wsdlURL); 58 assertNotNull(wsdlDefinitions); 59 } 60 61 public void testDynamicProxy() throws Exception 62 { 63 URL wsdlURL = getResource("ws/jaxws/webserviceref/META-INF/wsdl/TestEndpoint.wsdl"); 64 QName qname = new QName ("http://org.jboss.ws/wsref", "TestEndpointService"); 65 Service service = Service.create(wsdlURL, qname); 66 TestEndpoint port = (TestEndpoint)service.getPort(TestEndpoint.class); 67 68 String helloWorld = "Hello World!"; 69 Object retObj = port.echo(helloWorld); 70 assertEquals(helloWorld, retObj); 71 } 72 73 public void testApplicationClient() throws Exception 74 { 75 String helloWorld = "Hello World!"; 76 ApplicationClient.iniCtx = getInitialContext(); 77 } 80 } 81 | Popular Tags |