I use servicemix 7.0.0.m2 (which use camel 2.16.3) to route jax-ws web
service call;
Call the webservice directly, the http header in response contains
    Content-Type: text/xml;charset=UTF-8
Call the webservice throw camel-cxf, the http header in response contains
    Content-Type: text/xml
The camel-cxf drop the charset.

In  Jboss Fuse
<https://access.redhat.com/documentation/en-US/Fuse_ESB_Enterprise/7.0/html/Web_Services_and_Routing_with_Camel_CXF/Proxying-Headers.html>
 
, It says: 
All other headers are converted to HTTP headers in the target message, with
the exception of the following headers, which are blocked (based on a
case-insensitive match):

content-length
content-type
cache-control
connection
date
pragma
trailer
transfer-encoding
upgrade
via
warning

How can I setup the consumer's content-type according to the response from
producer?
It doesn't work to add a processor; I add a processor as the  JIRA
<https://issues.apache.org/jira/browse/CAMEL-6188>   says:
    public void process(Exchange exchange) throws Exception {
        String contentTypeHeader = ExchangeHelper.getContentType(exchange);
        if (contentTypeHeader != null) {
            ContentType contentType = ContentType.parse(contentTypeHeader);
            if (contentType != null) {
                Charset charset = contentType.getCharset();
                exchange.setProperty(Exchange.CHARSET_NAME, charset.name());
            }
        }
    }

the response I get is still in bad encoding.

now, my blueprint configuration is this:
<?xml version="1.0" encoding="UTF-8"?>
<blueprint
        xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0";
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
       
xmlns:cm="http://aries.apache.org/blueprint/xmlns/blueprint-cm/v1.1.0";
        xmlns:camelcxf="http://camel.apache.org/schema/blueprint/cxf";
        xmlns:cxf="http://cxf.apache.org/blueprint/core";
        xsi:schemaLocation="
            http://www.osgi.org/xmlns/blueprint/v1.0.0
http://www.osgi.org/xmlns/blueprint/v1.0.0/blueprint.xsd";>

    <cxf:bus>
        <cxf:features>
            <cxf:logging/>
        </cxf:features>
    </cxf:bus>

    <cm:property-placeholder
persistent-id="org.apache.servicemix.examples.cxf.receive"
update-strategy="reload">
        <cm:default-properties>
            <cm:property name="RouteServer" value="http://0.0.0.0:8989"/>
            <cm:property name="UtilManagementServicePath"
value="/com/renwey/core/util/service/UtilManagementService" />
        </cm:default-properties>
    </cm:property-placeholder>

    <camelcxf:cxfEndpoint id="utilManagementService"
                         
address="${RouteServer}${UtilManagementServicePath}"
                         
serviceClass="com.renwey.core.util.service.UtilManagementService"/>

    <camelContext xmlns="http://camel.apache.org/schema/blueprint";>
        <endpoint id="realUtilManagementService"
uri="jetty:http://internal.renwey.core.6ack.com:48086/com/renwey/core/util/service/UtilManagementServiceImpl"/>
        <route id="UtilManagementServiceRoute">
            <from uri="cxf:bean:utilManagementService?dataFormat=MESSAGE" />
            <removeHeaders pattern="CamelHttp*"/>
            <to ref="realUtilManagementService"/>
        </route>
    </camelContext>
</blueprint>

How can I setup the consumer's content-type according to the response from
producer?



--
View this message in context: 
http://camel.465427.n5.nabble.com/camel-cxf-drop-charset-tp5792078.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Reply via email to