[ 
https://issues.apache.org/jira/browse/CXF-2215?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12709668#action_12709668
 ] 

Daniel Kulp commented on CXF-2215:
----------------------------------


I THINK I may have fixed this.   My "gut feeling" is that the version of tomcat 
you are using is returning the wrong value from request.getCharacterEncoding(). 
   I've flipped the code over to using the charset found in the Content-Type 
header (which is what getCharacterEncoding should do, but in your case 
obviously isn't).   That SHOULD fix this as your initial logs shows that the 
charset=UTF-8 which is what should work for this case.

> can't use  non-English character parameter, soap encoding are not consistent
> ----------------------------------------------------------------------------
>
>                 Key: CXF-2215
>                 URL: https://issues.apache.org/jira/browse/CXF-2215
>             Project: CXF
>          Issue Type: Bug
>    Affects Versions: 2.2
>         Environment: windows xp, tomcat 6.0.18
>            Reporter: DingWeilong
>            Priority: Critical
>
> I have use cxf 2.2 to publish a web service in tomcat 6, the only operation 
> in which is 
> public java.lang.String greetMe( String name);
> when invoke with a parameter in Chinese value, i couldn't get my result. 
> I use log interceptor to get the log below, you see the encoding and the 
> charset is not consistent
> I track the source code, and see the error when unmarshall invoked.
> you can see the inbound message is parsed allright, but the outbound message 
> is not, error  occurs.
> I have test there're no problem when i use English parameter.
> who can tell me the reason and fix the problem, thanks!
> Inbound Message 
> ---------------------------- 
> Encoding: GB2312 
> Content-Type: text/xml; charset=UTF-8 
> Headers: {cache-control=[no-cache], content-type=[text/xml; 
> charset=UTF-8], connection=[keep-alive], host=[10.61.0.90:8080], 
> content-length=[182], SOAPAction=[""], user-agent=[Apache CXF 2.2], 
> Accept=[*/*], pragma=[no-cache]} 
> Payload: <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/ 
> envelope/"> <soap:Body> <ns2:greetMe xmlns:ns2="http://cxf/";> <arg0>测试 </ 
> arg0> </ns2:greetMe> </soap:Body> </soap:Envelope> 
> Outbound Message 
> --------------------------- 
> Encoding: GB2312 
> Content-Type: text/xml 
> Headers: {} 
> Payload: <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/ 
> envelope/"> <soap:Body> <soap:Fault> <faultcode>soap:Client </ 
> faultcode> <faultstring>Unmarshalling Error: Unexpected close tag &lt;/ 
> ns2:greetMe>; expected &lt;/arg0>.&#xd; 
> at [row,col {unknown-source}]: [1,148] </faultstring> </soap:Fault> </ 
> soap:Body> </soap:Envelope> 
> and the exception is below:
> Interceptor has thrown exception, unwinding now 
> org.apache.cxf.interceptor.Fault: Unmarshalling Error: Unexpected 
> close tag </ns2:greetMe>; expected </arg0>. 
> at [row,col {unknown-source}]: [1,148] 
>         at org.apache.cxf.jaxb.JAXBEncoderDecoder.unmarshall 
> (JAXBEncoderDecoder.java:622) 
>         at org.apache.cxf.jaxb.JAXBEncoderDecoder.unmarshall 
> (JAXBEncoderDecoder.java:527) 
>         at org.apache.cxf.jaxb.io.DataReaderImpl.read(DataReaderImpl.java: 
> 108) 
>         at org.apache.cxf.interceptor.DocLiteralInInterceptor.handleMessage 
> (DocLiteralInInterceptor.java:102) 
>         at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept 
> (PhaseInterceptorChain.java:236) 
>         at org.apache.cxf.transport.ChainInitiationObserver.onMessage 
> (ChainInitiationObserver.java:89) 
>         at org.apache.cxf.transport.servlet.ServletDestination.invoke 
> (ServletDestination.java:99) 
>         at 
> org.apache.cxf.transport.servlet.ServletController.invokeDestination 
> (ServletController.java:337) 
>         at org.apache.cxf.transport.servlet.ServletController.invoke 
> (ServletController.java:182) 
>         at org.apache.cxf.transport.servlet.AbstractCXFServlet.invoke 
> (AbstractCXFServlet.java:163) 
>         at org.apache.cxf.transport.servlet.AbstractCXFServlet.doPost 
> (AbstractCXFServlet.java:141) 
>         at javax.servlet.http.HttpServlet.service(HttpServlet.java:710) 
>         at javax.servlet.http.HttpServlet.service(HttpServlet.java:803) 
>         at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter 
> (ApplicationFilterChain.java:269) 
>         at org.apache.catalina.core.ApplicationFilterChain.doFilter 
> (ApplicationFilterChain.java:188) 
>         at org.apache.struts2.dispatcher.FilterDispatcher.doFilter 
> (FilterDispatcher.java:413) 
>         at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter 
> (ApplicationFilterChain.java:215) 
>         at org.apache.catalina.core.ApplicationFilterChain.doFilter 
> (ApplicationFilterChain.java:188) 
>         at org.apache.catalina.core.StandardWrapperValve.invoke 
> (StandardWrapperValve.java:210) 
>         at org.apache.catalina.core.StandardContextValve.invoke 
> (StandardContextValve.java:174) 
>         at org.apache.catalina.core.StandardHostValve.invoke 
> (StandardHostValve.java:127) 
>         at org.apache.catalina.valves.ErrorReportValve.invoke 
> (ErrorReportValve.java:117) 
>         at org.apache.catalina.core.StandardEngineValve.invoke 
> (StandardEngineValve.java:108) 
>         at org.apache.catalina.connector.CoyoteAdapter.service 
> (CoyoteAdapter.java:151) 
>         at org.apache.coyote.http11.Http11Processor.process 
> (Http11Processor.java:870) 
>         at org.apache.coyote.http11.Http11BaseProtocol 
> $Http11ConnectionHandler.processConnection(Http11BaseProtocol.java: 
> 665) 
>         at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket 
> (PoolTcpEndpoint.java:528) 
>         at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt 
> (LeaderFollowerWorkerThread.java:81) 
>         at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run 
> (ThreadPool.java:685) 
>         at java.lang.Thread.run(Thread.java:619) 
> Caused by: javax.xml.bind.UnmarshalException 
> - with linked exception: 
> [com.ctc.wstx.exc.WstxParsingException: Unexpected close tag </ 
> ns2:greetMe>; expected </arg0>. 
> at [row,col {unknown-source}]: [1,148]] 
>         at 
> com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallerImpl.handleStreamExcep­tion
>  
> (UnmarshallerImpl.java:426) 
>         at 
> com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallerImpl.unmarshal0 
> (UnmarshallerImpl.java:362) 
>         at 
> com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallerImpl.unmarshal 
> (UnmarshallerImpl.java:339) 
>         at org.apache.cxf.jaxb.JAXBEncoderDecoder.unmarshall 
> (JAXBEncoderDecoder.java:607) 
>         ... 29 more 
> Caused by: com.ctc.wstx.exc.WstxParsingException: Unexpected close tag 
> </ns2:greetMe>; expected </arg0>. 
> at [row,col {unknown-source}]: [1,148] 
>         at com.ctc.wstx.sr.StreamScanner.constructWfcException 
> (StreamScanner.java:630) 
>         at com.ctc.wstx.sr.StreamScanner.throwParseError(StreamScanner.java: 
> 461) 
>         at com.ctc.wstx.sr.BasicStreamReader.reportWrongEndElem 
> (BasicStreamReader.java:3256) 
>         at com.ctc.wstx.sr.BasicStreamReader.readEndElem 
> (BasicStreamReader.java:3198) 
>         at com.ctc.wstx.sr.BasicStreamReader.nextFromTree 
> (BasicStreamReader.java:2830) 
>         at com.ctc.wstx.sr.BasicStreamReader.next(BasicStreamReader.java: 
> 1019) 
>         at org.apache.cxf.staxutils.DepthXMLStreamReader.next 
> (DepthXMLStreamReader.java:220) 
>         at 
> com.sun.xml.bind.v2.runtime.unmarshaller.StAXStreamConnector.bridge 
> (StAXStreamConnector.java:225) 
>         at 
> com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallerImpl.unmarshal0 
> (UnmarshallerImpl.java:360) 
>         ... 31 more 

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to