cxf-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Sergey Beryozkin <>
Subject Re: MessageBodyWriters and SOAP
Date Tue, 28 Dec 2010 18:53:09 GMT

On Mon, Dec 27, 2010 at 5:13 PM, Nicholas Choate <> wrote:

> All,
> I have utilized Stax to implement my XML serialization for my RESTful
> webservice.  I am attempting to also create a SOAP based web service and
> was
> wondering if I could re-use my MessageBodyWriter (and underlying XML
> serialization classes) to write the responses for the SOAP web service as
> well.  I saw in the documentation that I can wrap a JAXB, Aegies, etc data
> binder for my RESTful service, but haven't seen anything about going the
> other way.  Short of writing my own data binder, is there an easier way to
> accomplish this?  Thanks in advance.
I do not know if it is possible right now to reuse the same *custom* JAX-RS
MessageBodyWriter/Reader for working with JAX-RS and SOAP related requests
*and use existing CXF Stax Soap interceptors*. It's something I'll
investigate but I suspect it can be dealt with similar to the way say
FastInfoset is supported where one can add StaxIn/Out interceptors which
will start working just before JAX-RS in/out interceptors are invoked.

As an alternative, you may want to declare a jaxrs:server and jaxws:endpoint
reusing the same bean. Next, if you wrap the existing CXF JAXBDataBinding
(or other supported databinding) and use for both jaxrs and jaxws endpoints
you can have it all working as expected.

Does it help ? Or do you need to use your own custom MessageBodyWriter ? Ex,
JAXBElementProvider with some configuration properties which are not
available with the JAXBDataBinding ?

cheers, Sergey

> Nicholas Choate

  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message