Hi Cameron,

I've ported some of the XFireClientFactoryBean to CXF so far. The API on it
kind of sucks at the moment now though:

       JaxWsProxyFactoryBean factory = new JaxWsProxyFactoryBean();
       factory.getClientFactoryBean().setServiceClass(
MyServiceInterface.class);
       factory.getClientFactoryBean().setAddress("http://localhost/service
");
       MyServiceInterface client = (MyServiceInterface) factory.create();

Obvoiusly I'd like to get rid of the unnecessary getClientFactoryBean calls
at some point. But its a start :-)

- Dan

On 1/22/07, Cameron Taggart <[EMAIL PROTECTED]> wrote:

I was surprised at how easy it was to create a JAX-WS service with
CXF.  Is there a simple way to create a client?  Something like
XFireClientFactoryBean as described at
http://xfire.codehaus.org/Spring+Remoting would be very nice.

Looking for something similar in CXF for this XFire code:

public static void main(String[] args) throws Exception {
  GetterWebServiceInterface getter =
createClient(GetterWebServiceInterface.class,
"http://localhost:9000/getter?wsdl";);
  out.println("string: "+getter.getString());
  out.println("int: "+getter.getInt());
}

public static <T> T createClient(Class<T> serviceInterface, String
wsdlUrl) throws Exception {
  XFireClientFactoryBean cf = new XFireClientFactoryBean();
  cf.setServiceClass(serviceInterface);
  cf.setWsdlDocumentUrl(wsdlUrl);
  cf.afterPropertiesSet();
  return serviceInterface.cast(cf.getObject());
}

cheers,
Cameron




--
Dan Diephouse
Envoi Solutions
http://envoisolutions.com | http://netzooid.com/blog

Reply via email to