我的问题是 2 倍的,它与编码有关。我在 JBoss 7.1.1 上部署了一个 REST Web 应用程序。这具有外部 Web 服务的适配器,我已使用 CXF java2wsdl 从提供的 WSDL 创建存根。在对此外部 Web 服务的请求/响应期间,请求和响应可以包含保加利亚语编码的内容。
问题是我的 REST 服务和我的 SOAP 适配器都没有正确发送/使用这个编码的内容,而它来自 SOAPUI。下面是一个例子
REST CALL 将参数“Тест Тест”传递为
@PathParam("receiverName") 字符串接收者名称
标头包含charset=UTF-8
使用 cxf 日志拦截器的服务器日志记录以下内容
--------------------------------------
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]}
----------------------------
我的代码现在在日志中打印的参数值为“?????? ????”
在后端,当我再次收到保加利亚语内容时,我遇到了问题,以下是此类响应的示例
Encoding: UTF-8
Content-Type: text/xml
Headers: {Accept=[*/*],
根据日志和wireshark,请求是用上面的Headers发送的,响应是:
-----------------------------------------------------------------
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>
-----------------------------------------------------------------
这个问题可以在
<City>Р?Р°С?РЅР°</City>
<Address>жк. Чайка</Address>
而在 SOAPUI 中,结果是正确的
<City>Варна</City>
<Address>жк. Чайка</Address>
有什么想法是什么问题以及如何解决?