Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: changed book to person

Sometimes when you work with web services, you don't want to have to generate a client at build time. Its much more convenient to create a client at runtime and use it dynamically. CXF has a DynamicClientFactory class designed for just this.

...

Code Block
java
java
URLClassLoader classLoader = ...;
DynamicClientFactory dcf = DynamicClientFactory.newInstance();
Client client = dcf.createClient("people.wsdl", classLoader);
 
Object person = classLoader.loadClass("com.acme.Person").newInstance();
 
Method m = bookperson.getClass().getMethod("setName", String.class);
m.invoke(bookperson, "Joe Schmoe");
 
client.invoke("addPerson", person);

...