protected Client createClient() throws Exception { synchronized (CLIENT_CREATION_LOCK) { DynamicClientFactory cf = DynamicClientFactory.newInstance(getBus()); return cf.createClient(getWsdlLocation(), (service == null ? null : QName.valueOf(service)), (getPort() == null ? null : QName.valueOf(getPort()))); } }
protected Client createClient() throws Exception { synchronized (CLIENT_CREATION_LOCK) { DynamicClientFactory cf = DynamicClientFactory.newInstance(getBus()); return cf.createClient(getWsdlLocation(), (service == null ? null : QName.valueOf(service)), (getPort() == null ? null : QName.valueOf(getPort()))); } }
@Test public void testDynamicClient() throws Exception { if (JavaUtils.isJava9Compatible()) { System.setProperty("org.apache.cxf.common.util.Compiler-fork", "true"); } DynamicClientFactory dcf = DynamicClientFactory.newInstance(); Client client = dcf.createClient("http://localhost:" + PORT + "/jaxwsAndAegisSports?wsdl&dynamic"); Object r = client.invoke("getAttributeBean")[0]; Method getAddrPlainString = r.getClass().getMethod("getAttrPlainString"); String s = (String)getAddrPlainString.invoke(r); assertEquals("attrPlain", s); } }
@Test public void testBase64() throws Exception { URL wsdl = getClass().getResource("/wsdl/others/dynamic_client_base64.wsdl"); assertNotNull(wsdl); String wsdlUrl = null; wsdlUrl = wsdl.toURI().toString(); CXFBusFactory busFactory = new CXFBusFactory(); Bus bus = busFactory.createBus(); DynamicClientFactory dynamicClientFactory = DynamicClientFactory.newInstance(bus); Client client = dynamicClientFactory.createClient(wsdlUrl); assertNotNull(client); }
@Test public void testCXF4676Partial1() throws Exception { DynamicClientFactory dcf = DynamicClientFactory.newInstance(); Client client = dcf.createClient("http://localhost:" + PORT + "/AddNumbersImplPartial1Service?wsdl", serviceName1, portName1); updateAddressPort(client, PORT); Object[] result = client.invoke("addTwoNumbers", 10, 20); assertNotNull("no response received from service", result); assertEquals(30, result[0]); }
@Test public void testCXF4676partial2() throws Exception { DynamicClientFactory dcf = DynamicClientFactory.newInstance(); Client client = dcf.createClient("http://localhost:" + PORT + "/AddNumbersImplPartial2Service?wsdl", serviceName2, portName2); updateAddressPort(client, PORT); Object[] result = client.invoke("addTwoNumbers", 10, 20); assertNotNull("no response received from service", result); assertEquals(30, result[0]); }
@Test public void testDynamicClientFactory() throws Exception { URL wsdl = getClass().getResource("/wsdl/hello_world.wsdl"); assertNotNull(wsdl); String wsdlUrl = null; wsdlUrl = wsdl.toURI().toString(); DynamicClientFactory dcf = DynamicClientFactory.newInstance(); Client client = dcf.createClient(wsdlUrl, serviceName, portName); updateAddressPort(client, PORT); client.invoke("greetMe", "test"); Object[] result = client.invoke("sayHi"); assertNotNull("no response received from service", result); assertEquals("Bonjour", result[0]); client = dcf.createClient(wsdlUrl, serviceName, portName); new LoggingFeature().initialize(client, client.getBus()); updateAddressPort(client, PORT); client.invoke("greetMe", "test"); result = client.invoke("sayHi"); assertNotNull("no response received from service", result); assertEquals("Bonjour", result[0]); }