You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by Valerio Angelini <an...@imaa.cnr.it> on 2010/03/01 12:21:19 UTC

Fine control of XML encoding

Dear all,

do anyone know how could be possible to control the encoding of the XML response for a jax-ws service?

In particular I need these :
- The response is now created without the XML prolog. How can I force its creation?
- The response http header declares a content-encoding like "text/xml;  charset=ISO-8859-1", but I would like to specify a "UTF-8" charset.

I'm currently using cxf-2.2.4 and jax-ws with the @WebServiceProvider() interface. 

Thanks a lot in advance

Valerio

--
Valerio Angelini
Institute of Methodologies for Environmental Analysis
Italian National Research Council
phone: +39 0574 602535
e-mail: angelini@imaa.cnr.it




RE: Fine control of XML encoding

Posted by "Purohit, Manoj R " <ma...@citi.com>.
Hi ,

What about custom interceptor which can set the content type ..
In certain esb scenario I had implemented for other version of cxf it worked for me.

Regards,
Manoj

-----Original Message-----
From: Valerio Angelini [mailto:angelini@imaa.cnr.it]
Sent: Monday, March 01, 2010 6:21 AM
To: users@cxf.apache.org
Subject: Fine control of XML encoding

Dear all,

do anyone know how could be possible to control the encoding of the XML response for a jax-ws service?

In particular I need these :
- The response is now created without the XML prolog. How can I force its creation?
- The response http header declares a content-encoding like "text/xml;  charset=ISO-8859-1", but I would like to specify a "UTF-8" charset.

I'm currently using cxf-2.2.4 and jax-ws with the @WebServiceProvider() interface.

Thanks a lot in advance

Valerio

--
Valerio Angelini
Institute of Methodologies for Environmental Analysis
Italian National Research Council
phone: +39 0574 602535
e-mail: angelini@imaa.cnr.it




Re: Fine control of XML encoding

Posted by Daniel Kulp <dk...@apache.org>.
On Mon March 1 2010 6:21:19 am Valerio Angelini wrote:
> Dear all,
> 
> do anyone know how could be possible to control the encoding of the XML
> response for a jax-ws service?
> 
> In particular I need these :
> - The response is now created without the XML prolog. How can I force its
> creation?
> - The response http header declares a content-encoding like
> "text/xml;  charset=ISO-8859-1", but I would like to specify a "UTF-8"
> charset.
> 
> I'm currently using cxf-2.2.4 and jax-ws with the @WebServiceProvider()
> interface.

Within your implementation, you should be able to do something like:
Message m = PhaseInterceptorChain.getCurrentMessage();
m.put(Message.ENCODING, "UTF-8");
m.getExchange().put("org.apache.cxf.stax.force-start-document", Boolean.TRUE);

That should handle both situations.  

Dan



> 
> Thanks a lot in advance
> 
> Valerio
> 
> --
> Valerio Angelini
> Institute of Methodologies for Environmental Analysis
> Italian National Research Council
> phone: +39 0574 602535
> e-mail: angelini@imaa.cnr.it

-- 
Daniel Kulp
dkulp@apache.org
http://www.dankulp.com/blog