4

I do a request against an Apache Camel. It is used as a pass-through to a WS.

The request:

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:urn="...">
   <soapenv:Header/>
   <soapenv:Body>
      <urn:AddCompanyRequest>
         <urn:Company>
            <urn:Name>Ascii test ¢¢</urn:Name>
         </urn:Company>
      </urn:AddCompanyRequest>
   </soapenv:Body>
</soapenv:Envelope>

Unfortunately, the non ASCII chars appear as "??" in the WS facade.

WS Facade:

@Path("/company")
public interface CompanyFacade {

    @POST
    @Consumes("text/xml") // Already tried "text/xml; charset=utf-8"
    @Produces("text/xml")
    JAXBElement<StandardResponseType> add(AddCompanyRequestType addCompanyRequestType);

}

Camel configuration :

<cxf:cxfEndpoint id="companyEndpoint" address="/company"
    wsdlURL="service.wsdl"
    loggingFeatureEnabled="false">
    <cxf:properties>
        <entry key="dataFormat" value="PAYLOAD" />
    </cxf:properties>
    <cxf:outInterceptors>
        <bean class="org.apache.camel.component.cxf.WriteXmlDeclarationInterceptor" />
    </cxf:outInterceptors>
</cxf:cxfEndpoint>
(...)
<route>
    <from uri="cxf:bean:companyEndpoint" />
    <policy ref="customProvider">
        <to
            uri="validator:service.xsd?useDom=true" />
        <choice>
            <when>
                <simple>${in.header.operationName} contains 'remove'</simple>
                <setHeader headerName="restSlip">
                    <constant>removeCompanyURL</constant>
                </setHeader>
            </when>
            <otherwise>
                <setHeader headerName="restSlip">
                    <constant>companyURL</constant>
                </setHeader>
            </otherwise>
        </choice>
        <to uri="direct:dispatcher" />
    </policy>
</route>

I tried to debug Camel by adding interceptor at different phase (RECEIVE, POST_MARSHAL, PRE_INVOKE) but the characters always appears correctly.

Also, I verified the encoding / mime-type / charset everywhere and everything seems as expected.

Does anyone know why it is still failing and what I could do to fix this ?

Note: I use Camel v2.12.2 and Spring v3.2.4.RELEASE in this project.

tony
  • 41
  • 2

0 Answers0