Yes - we did something like this: ( a fictitious POC we did :-) ) But is
worked just like it was supposed to following that link in the CXF
documentation.
*For a class:*
@Path("/bookservice")
@WebService(serviceName = "BookOrderManagerService", portName =
"BookOrderManagerServicePort", endpointInterface =
"com.acme.book.webservices.BookOrderManagerService")
@HandlerChain(file = "handler-chain.xml")
public class BookOrderManagerWS implements BookOrderManagerService {
*For a method:*
@GET
@Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
@Path("/{bookID}")
@WebMethod
public Book getBook(@PathParam("bookID") @WebParam(name = "bookID")
String bookID) throws ServiceException {
Hope this helps. The CXF gurus out there might have other input (Daniel,
Sergey, Glen ... )
On Wed, Oct 10, 2012 at 9:35 AM, Timothy Canavan <
[email protected]> wrote:
> Very interesting. So basically you define a service something like this.
>
> @WebService // jaxws annotation.
> @Path("json") // jaxrs annotation.
> public class CustomerService implements CustomerSericePortType {
>
> @POST // jaxrs annotation.
> @Consumes({MediaType.APPLICATION_JSON}) // jaxrs annotation.
> @Produces({MediaType.APPLICATION_JSON}) // jaxrs annotation.
> @Path("getcustomer")
> public CustomerResponse authenticate(CustomerRequest body) {
> ...
> }
>
> }
>
> Tim
>
> -----Ursprüngliche Nachricht-----
> Von: Mark Streit [mailto:[email protected]]
> Gesendet: Mittwoch, 10. Oktober 2012 14:40
> An: [email protected]
> Betreff: Re: JSON Support JAX-WS
>
> We tried exactly that... Having JAX-WS and JAX-RS annotations on same
> service implementation class and it worked. (Assuming that is what Sergey
> is suggesting).
>
> http://cxf.apache.org/docs/jax-rs.html#JAX-RS-CombiningJAXWSandJAXRS
>
> Mark
> On Oct 10, 2012 7:22 AM, "Sergey Beryozkin" <[email protected]> wrote:
>
> > On 10/10/12 11:28, Timothy Canavan wrote:
> >
> >> What is the recommended was to provide JSON support for an existing
> >> contract first JAX-WS web service which uses JAXB for binding.
> >>
> >> Should I simply use JAX-RS or integrate JSON into the JAX-WS stack
> >> somehow.
> >>
> >>
> > Have a look at
> > systests/transports/src/test/**java/org/apache/cxf/systest/
> > **servlet/restful_service.xml,
> >
> > alternatively, you can indeed introduce a JAX-RS endpoint and share
> > the same service bean between JAXWS and JAXRS endpoints
> >
> > Cheers, Sergey
> >
> >
> >> Tim
> >>
> >>
> >>
> >
> > --
> > Sergey Beryozkin
> >
> > Talend Community Coders
> > http://coders.talend.com/
> >
> > Blog: http://sberyozkin.blogspot.com
> >
>
--
Mark
*
*