views:

137

answers:

1

I've created a jax-ws service endpoint and now I want to write a client. I want to have a shared jar between the client and server for common (JAXB annotated) entity classes and interfaces for the services. Is it possible to force jax-ws to generate (or allow me to write) a client using my existing entites/interfaces?

For those that are wondering why I would want to do this: I want to allow services to be in the same physical server or across the internet, but not make web service calls and just use a different implementation locally.

+1  A: 

If you have annotated JAX-WS service interfaces you may reuse them in the client via

YourInterface service = Service.create(...).getPort(YourInterface.class);

If you just want to reuse your data classes there is a tutorial on that: How to make a JAX-WS client reuse existing classes for data binding

Heri