DynamicClientFactory dcf = DynamicClientFactory.newInstance(); Client client = dcf.createClient("http://admin:password@localhost:8080"+ "/services/MyService?wsdl"); Object[] a = client.invoke("test", ""); System.out.println(a);
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()))); } }
SchemaCompiler compiler = createSchemaCompiler(); hackInNewInternalizationLogic(compiler, catalog); addSchemas(compiler.getOptions(), compiler, svc.getServiceInfos(), schemas); addBindingFiles(bindingFiles, compiler); S2JJAXBModel intermediateModel = compiler.bind(); if (!isValidPackage(jpackage)) { continue; setupClasspath(classPath, classLoader); } catch (Exception ex) { throw new RuntimeException(ex); if (!srcFiles.isEmpty() && !compileJavaSrc(classPath.toString(), srcFiles, classes.toString())) { LOG.log(Level.SEVERE, new Message("COULD_NOT_COMPILE_SRC", LOG, wsdlUrl).toString()); getEndpointImplFactory(), cl); allowWrapperOps()); visitor.walk();
/** * Create a new instance using a specific <tt>Bus</tt>. * * @param b the <tt>Bus</tt> to use in subsequent operations with the * instance * @return the new instance */ public static DynamicClientFactory newInstance(Bus b) { return new DynamicClientFactory(b); }
addClasspathFromManifest(classPath, file);
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()))); } }
SchemaCompiler compiler = createSchemaCompiler(); hackInNewInternalizationLogic(compiler, catalog); addSchemas(compiler.getOptions(), compiler, svc.getServiceInfos(), schemas); addBindingFiles(bindingFiles, compiler); S2JJAXBModel intermediateModel = compiler.bind(); if (!isValidPackage(jpackage)) { continue; setupClasspath(classPath, classLoader); } catch (Exception ex) { throw new RuntimeException(ex); if (!srcFiles.isEmpty() && !compileJavaSrc(classPath.toString(), srcFiles, classes.toString())) { LOG.log(Level.SEVERE, new Message("COULD_NOT_COMPILE_SRC", LOG, wsdlUrl).toString()); getEndpointImplFactory(), cl); allowWrapperOps()); visitor.walk();
/** * Create a new instance using a specific <tt>Bus</tt>. * * @param b the <tt>Bus</tt> to use in subsequent operations with the * instance * @return the new instance */ public static DynamicClientFactory newInstance(Bus b) { return new DynamicClientFactory(b); }
addClasspathFromManifest(classPath, file);
/** * Create a new <code>Client</code> instance using the WSDL to be loaded * from the specified URL and with the specified <code>ClassLoader</code> * as parent. * * @param wsdlUrl * @param classLoader * @return */ public Client createClient(String wsdlUrl, ClassLoader classLoader) { return createClient(wsdlUrl, null, classLoader, null); } public Client createClient(String wsdlUrl, ClassLoader classLoader, List<String> bindingFiles) {
@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); }
/** * Create a new instance using a default <tt>Bus</tt>. * * @return the new instance * @see CXFBusFactory#getDefaultBus() */ public static DynamicClientFactory newInstance() { Bus bus = BusFactory.getThreadDefaultBus(); return new DynamicClientFactory(bus); }
/** * Create a new <code>Client</code> instance using the WSDL to be loaded * from the specified URL and using the current classloading context. * * @param wsdlURL the URL to load * @return */ public Client createClient(String wsdlUrl) { return createClient(wsdlUrl, (QName)null, (QName)null); } public Client createClient(String wsdlUrl, List<String> bindingFiles) {
@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); } }
/** * Create a new instance using a default <tt>Bus</tt>. * * @return the new instance * @see CXFBusFactory#getDefaultBus() */ public static DynamicClientFactory newInstance() { Bus bus = BusFactory.getThreadDefaultBus(); return new DynamicClientFactory(bus); }
/** * Create a new <code>Client</code> instance using the WSDL to be loaded * from the specified URL and using the current classloading context. * * @param wsdlURL the URL to load * @return */ public Client createClient(URL wsdlUrl) { return createClient(wsdlUrl, (QName)null, (QName)null); } public Client createClient(URL wsdlUrl, List<String> bindingFiles) {
@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]); }
public Client createClient(URL wsdlUrl, List<String> bindingFiles) { return createClient(wsdlUrl, (QName)null, (QName)null, bindingFiles); }
@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]); }
/** * Create a new <code>Client</code> instance using the WSDL to be loaded * from the specified URL and using the current classloading context. * * @param wsdlURL the URL to load * @return */ public Client createClient(String wsdlUrl) { return createClient(wsdlUrl, (QName)null, (QName)null); } public Client createClient(String wsdlUrl, List<String> bindingFiles) {