Hi I've just checked JAXBElementProvider, the simplest way is to actually register JAXBElementProvider explicitly (as a jaxrs:provider) and set the "marshallerProperties" map property and set the "jaxb.fragment" there, please check for an example:
http://cxf.apache.org/docs/jax-rs-data-bindings.html#JAX-RSDataBindings-ConfiguringJAXBprovider Or you can do it in the out CXF interceptor: public class CustomOutInterceptor extends AbstractOutDatabindingInterceptor { public CustomOutInterceptor() { super(Phase.MARSHAL); } public void handleMessage(Message message) { outMessage.put("jaxb.fragment", Boolean.FALSE); } } which will need to be registered in jaxrs:outInterceptors section Cheers, Sergey On Thu, Mar 10, 2011 at 10:17 PM, Dallas007 <[email protected]> wrote: > Thank you , > I have added below statement in my requestlogginginterceptor but it did not > fix the problem. > > message.put(javax.xml.bind.Marshaller.*JAXB_FRAGMENT* , Boolean.*FALSE*); > > I have tried using below statement in my outer interceptor too but that > did > not fix the problem..FYI, my outer interceptor class, > * > > public* *class* OuterInterceptor *extends* LoggingOutInterceptor { > > /** > > * Override the logger to update the XML_LOG log > > * *@param* responseBody the response body to log > > * *@return* the response body. > > */ > > @Override > > *protected* String transform(String responseBody) { > > //write out to XML LOG > > > > PhaseInterceptorChain.*getCurrentMessage*().put(javax.xml.bind.Marshaller.* > JAXB_FRAGMENT*, Boolean.*TRUE*); > > tlog message > > *return* responseBody; > > } > > } > > > > On Thu, Mar 10, 2011 at 4:20 AM, Sergey Beryozkin-5 [via CXF] < > [email protected]> wrote: > > > Hi > > > > On Wed, Mar 9, 2011 at 10:51 PM, Dallas007 <[hidden email]< > http://user/SendEmail.jtp?type=node&node=3423194&i=0&by-user=t>> > > wrote: > > > > > Yes I do use JAXRS. > > > > > > > > You probably need to set the > > > > javax.xml.bind.Marshaller.JAXB_FRAGMENT ("jaxb.fragment") to > Boolean.FALSE > > in your custom CXF out interceptor. > > This property has to be set on the out message, not on the exchange, you > > can > > do from the cxf interceptor or ResponseHandler filter... > > > > let me know please if it fixes it. > > > > Sergey > > > > On Wed, Mar 9, 2011 at 1:56 PM, Sergey Beryozkin-5 [via CXF] < > > > > > [hidden email]< > http://user/SendEmail.jtp?type=node&node=3423194&i=1&by-user=t>> > > wrote: > > > > > > > Hi > > > > > > > > On Wed, Mar 9, 2011 at 7:56 PM, Dallas007 <[hidden email]< > > > http://user/SendEmail.jtp?type=node&node=3416352&i=0&by-user=t>> > > > > > > wrote: > > > > > > > > > Hi, > > > > > Xml-version missing in REST (XML) message. I have tried using below > > > code > > > > > but > > > > > that did not fix the problem. I can see xml start tag added to soap > > > > message > > > > > but it did not add to REST (XML) response. FYI, I am using cxf > latest > > > > > > > version and JAXB. > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > PhaseInterceptorChain.getCurrentMessage().getExchange().put("org.apache.cxf.stax.force-start-document", > > > > > > > > > > > Boolean.TRUE); > > > > > > > > > > > > > > Do you use JAX-RS or not ? > > > > > > > > Cheers, Sergey > > > > > > > > > ------------------------------ > > If you reply to this email, your message will be added to the discussion > > below: > > > > > http://cxf.547215.n5.nabble.com/xml-version-missing-in-REST-XML-message-tp3416163p3423194.html > > To unsubscribe from xml-version missing in REST (XML) message, click > > here< > http://cxf.547215.n5.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=3416163&code=bmFuZGlnYW1hNHVAZ21haWwuY29tfDM0MTYxNjN8NTQ0NDQwNTcy > >. > > > > > > > -- > View this message in context: > http://cxf.547215.n5.nabble.com/xml-version-missing-in-REST-XML-message-tp3416163p3424207.html > Sent from the cxf-user mailing list archive at Nabble.com. -- Sergey Beryozkin Application Integration Division of Talend <http://www.talend.com> http://sberyozkin.blogspot.com
