On 18/09/12 17:55, skousouris wrote:
My Issue is 2-fold and it has to do with the encoding. I have a REST web
application deployed on JBoss 7.1.1. This has adapters to an external web
service for which I have created stubs with CXF java2wsdl from the provided
WSDLs. During the request/responses to this external web service requests&
responses can contain Bulgarian encoded content.

The issue is that this encoded content is not correctly sent/consumed by my
REST services nor by my SOAP adapters whilst it is from SOAPUI. Below is an
example

REST CALL passes the parameter "Тест Тест" as @PathParam("receiverName")
String receiverName
Headers contain charset=UTF-8


Content-Type charset parameter affects the body representation, not the way URI is encoded.

I think what you need to do is to add @Encoded annotation:

@GET
public Response get(@Encoded @PathParam("receiverName") String receiver) {
  // pass the encoded value to the SOAP client...
}

Can you try it please ?

Cheers, Sergey

Server Logs<cxf:logging />  logs the following
--------------------------------------
2012-09-18 19:20:10,246 INFO
[org.apache.cxf.interceptor.LoggingInInterceptor] (http-/127.0.0.1:8080-1)
Inbound Message
----------------------------
ID: 32
Address:
http://127.0.0.1:8080/rest/request/card/10122083/%D0%A2%D0%B5%D1%81%D1%82%20%D0%A2%D0%B5%D1%81%D1%82/1234124143312
Encoding: UTF-8
Http-Method: POST
Content-Type: application/json; charset=UTF-8
Headers: {Accept=[application/json], accept-encoding=[gzip, deflate],
accept-language=[en-gb,en;q=0.5], cache-control=[no-cache],
connection=[keep-alive], Content-Length=[313],
content-type=[application/json; charset=UTF-8], host=[127.0.0.1:8080],
pragma=[no-cache], user-agent=[Mozilla/5.0 (Windows NT 6.1; WOW64; rv:15.0)
Gecko/20100101 Firefox/15.0.1]}
----------------------------

The parameter now printed in a log by my code has the value "???? ????"

On the backend when I receive content in bulgarian again I have the issue,
below is the example of such a response
The request was sent with Headers
Encoding: UTF-8
Content-Type: text/xml
Headers: {Accept=[*/*],
-----------------------------------------------------------------
ID: 2
Response-Code: 200
Encoding: ISO-8859-1
Content-Type: text/xml
Headers: {Content-Length=[1011], content-type=[text/xml],
Server=[IRS/1.0.18.0 guz]}
Payload:<?xml version="1.0" encoding="UTF-8"?>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/";
xmlns:loy="http://www.location.bg/Loyalty/";>
<soapenv:Header/>
<soapenv:Body>
<loy:CustLoyaltyResponse>
                 <OutputRequestID>SCR0000000394</OutputRequestID>
                 <OutputTimeStamp>20120918095649992</OutputTimeStamp>
                 <StatusCode>0</StatusCode>
                 <StatusMessage>Loyal Customer</StatusMessage>
                 <CustomerCode>10122083</CustomerCode>
                 <CustomerLoyalStatus>1</CustomerLoyalStatus>
                 <LoyalLevel>Special</LoyalLevel>
                 <CardObject>
                                 <CardStatus>0</CardStatus>
                                 <CardCustCode>10122083</CardCustCode>
                                 <CardNo>100012624110122083</CardNo>
                                 <CardState>4</CardState>
                                 <Level>Special</Level>
                                 <City>Р?Р°С?РЅР°</City>
                                 <Postcode>9000</Postcode>
                                 <Address>жк. Чайка</Address>
                                 <NameOfRecipient>РўРµС?С?
РўРµС?С?</NameOfRecipient>

<NumberOfRecipient>12345678</NumberOfRecipient>

<LastStatusChangeDate></LastStatusChangeDate>
                 </CardObject>
</loy:CustLoyaltyResponse>
</soapenv:Body>
</soapenv:Envelope>
-----------------------------------------------------------------

The issue can be seen in the

                                 <City>Р?Р°С?РЅР°</City>
                                 <Address>жк. Чайка</Address>

whilst in SOAPUI the result is correct
                                 <City>Варна</City>
                                <Address>жк. Чайка</Address>

Any thoughts how to handle this?



--
View this message in context: 
http://cxf.547215.n5.nabble.com/CXF-Client-Problem-with-Encodings-tp5714097.html
Sent from the cxf-user mailing list archive at Nabble.com.


--
Sergey Beryozkin

Talend Community Coders
http://coders.talend.com/

Blog: http://sberyozkin.blogspot.com

Reply via email to