You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@cxf.apache.org by "Martijn Brinkers (JIRA)" <ji...@apache.org> on 2008/08/29 10:28:44 UTC

[jira] Created: (CXF-1771) WstxUnexpectedCharException when returning a String from a CXF SOAP service containing specific characters (used with CXF client)

WstxUnexpectedCharException when returning a String from a CXF SOAP service containing specific characters (used with CXF client)
---------------------------------------------------------------------------------------------------------------------------------

                 Key: CXF-1771
                 URL: https://issues.apache.org/jira/browse/CXF-1771
             Project: CXF
          Issue Type: Bug
    Affects Versions: 2.1.2
            Reporter: Martijn Brinkers


If my SOAP service returns a String that contains control characters and the service is consumed by a CXF client a com.ctc.wstx.exc.WstxUnexpectedCharException is being thrown.

It's easy to duplicate (in my setup) by modifying one line of the CXF 2.1.2 sample samples/java_first_jaxws:

    public String sayHiToUser(User user) {
        System.out.println("sayHiToUser called");
        users.put(users.size() + 1, user);
        return "Hello "  + user.getName() + '\27';          <<<===== add '\27' to the String being returned
    }

Now when you start the client sample the following exception is being thrown:

INFO: Interceptor has thrown exception, unwinding now
org.apache.cxf.interceptor.Fault: Unmarshalling Error: Illegal character ((CTRL-CHAR, code 23))
 at [row,col {unknown-source}]: [1,161] 
	at org.apache.cxf.jaxb.JAXBEncoderDecoder.unmarshall(JAXBEncoderDecoder.java:552)
	at org.apache.cxf.jaxb.JAXBEncoderDecoder.unmarshall(JAXBEncoderDecoder.java:465)
	at org.apache.cxf.jaxb.io.DataReaderImpl.read(DataReaderImpl.java:105)
	at org.apache.cxf.interceptor.DocLiteralInInterceptor.handleMessage(DocLiteralInInterceptor.java:102)
	at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:220)
	at org.apache.cxf.endpoint.ClientImpl.onMessage(ClientImpl.java:449)
	at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.handleResponse(HTTPConduit.java:2029)
	at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.close(HTTPConduit.java:1865)
	at org.apache.cxf.transport.AbstractConduit.close(AbstractConduit.java:66)
	at org.apache.cxf.transport.http.HTTPConduit.close(HTTPConduit.java:593)
	at org.apache.cxf.interceptor.MessageSenderInterceptor$MessageSenderEndingInterceptor.handleMessage(MessageSenderInterceptor.java:62)
	at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:220)
	at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:296)
	at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:242)
	at org.apache.cxf.frontend.ClientProxy.invokeSync(ClientProxy.java:73)
	at org.apache.cxf.jaxws.JaxWsClientProxy.invoke(JaxWsClientProxy.java:178)
	at $Proxy42.sayHiToUser(Unknown Source)
	at demo.hw.client.Client.main(Client.java:56)
Caused by: javax.xml.bind.UnmarshalException
 - with linked exception:
[com.ctc.wstx.exc.WstxUnexpectedCharException: Illegal character ((CTRL-CHAR, code 23))
 at [row,col {unknown-source}]: [1,161]]
	at com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallerImpl.handleStreamException(UnmarshallerImpl.java:422)
	at com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallerImpl.unmarshal0(UnmarshallerImpl.java:360)
	at com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallerImpl.unmarshal(UnmarshallerImpl.java:337)
	at org.apache.cxf.jaxb.JAXBEncoderDecoder.unmarshall(JAXBEncoderDecoder.java:537)
	... 17 more
Caused by: com.ctc.wstx.exc.WstxUnexpectedCharException: Illegal character ((CTRL-CHAR, code 23))
 at [row,col {unknown-source}]: [1,161]
	at com.ctc.wstx.sr.StreamScanner.throwInvalidSpace(StreamScanner.java:650)
	at com.ctc.wstx.sr.BasicStreamReader.readTextPrimary(BasicStreamReader.java:4554)
	at com.ctc.wstx.sr.BasicStreamReader.nextFromTree(BasicStreamReader.java:2886)
	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:358)
	... 19 more
Exception in thread "main" javax.xml.ws.soap.SOAPFaultException: Unmarshalling Error: Illegal character ((CTRL-CHAR, code 23))
 at [row,col {unknown-source}]: [1,161] 
	at org.apache.cxf.jaxws.JaxWsClientProxy.invoke(JaxWsClientProxy.java:199)
	at $Proxy42.sayHiToUser(Unknown Source)
	at demo.hw.client.Client.main(Client.java:56)
Caused by: org.apache.cxf.interceptor.Fault: Unmarshalling Error: Illegal character ((CTRL-CHAR, code 23))
 at [row,col {unknown-source}]: [1,161] 
	at org.apache.cxf.jaxb.JAXBEncoderDecoder.unmarshall(JAXBEncoderDecoder.java:552)
	at org.apache.cxf.jaxb.JAXBEncoderDecoder.unmarshall(JAXBEncoderDecoder.java:465)
	at org.apache.cxf.jaxb.io.DataReaderImpl.read(DataReaderImpl.java:105)
	at org.apache.cxf.interceptor.DocLiteralInInterceptor.handleMessage(DocLiteralInInterceptor.java:102)
	at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:220)
	at org.apache.cxf.endpoint.ClientImpl.onMessage(ClientImpl.java:449)
	at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.handleResponse(HTTPConduit.java:2029)
	at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.close(HTTPConduit.java:1865)
	at org.apache.cxf.transport.AbstractConduit.close(AbstractConduit.java:66)
	at org.apache.cxf.transport.http.HTTPConduit.close(HTTPConduit.java:593)
	at org.apache.cxf.interceptor.MessageSenderInterceptor$MessageSenderEndingInterceptor.handleMessage(MessageSenderInterceptor.java:62)
	at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:220)
	at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:296)
	at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:242)
	at org.apache.cxf.frontend.ClientProxy.invokeSync(ClientProxy.java:73)
	at org.apache.cxf.jaxws.JaxWsClientProxy.invoke(JaxWsClientProxy.java:178)
	... 2 more
Caused by: javax.xml.bind.UnmarshalException
 - with linked exception:
[com.ctc.wstx.exc.WstxUnexpectedCharException: Illegal character ((CTRL-CHAR, code 23))
 at [row,col {unknown-source}]: [1,161]]
	at com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallerImpl.handleStreamException(UnmarshallerImpl.java:422)
	at com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallerImpl.unmarshal0(UnmarshallerImpl.java:360)
	at com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallerImpl.unmarshal(UnmarshallerImpl.java:337)
	at org.apache.cxf.jaxb.JAXBEncoderDecoder.unmarshall(JAXBEncoderDecoder.java:537)
	... 17 more
Caused by: com.ctc.wstx.exc.WstxUnexpectedCharException: Illegal character ((CTRL-CHAR, code 23))
 at [row,col {unknown-source}]: [1,161]
	at com.ctc.wstx.sr.StreamScanner.throwInvalidSpace(StreamScanner.java:650)
	at com.ctc.wstx.sr.BasicStreamReader.readTextPrimary(BasicStreamReader.java:4554)
	at com.ctc.wstx.sr.BasicStreamReader.nextFromTree(BasicStreamReader.java:2886)
	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:358)
	... 19 more


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


[jira] Commented: (CXF-1771) WstxUnexpectedCharException when returning a String from a CXF SOAP service containing specific characters (used with CXF client)

Posted by "Daniel Kulp (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/CXF-1771?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12627013#action_12627013 ] 

Daniel Kulp commented on CXF-1771:
----------------------------------



Nothing we can do here.   Those control characters are illegal in XML.   See Benson's blog entry about it:

http://dssheep.blogspot.com/2008/01/xml-10-versus-web-services.html



> WstxUnexpectedCharException when returning a String from a CXF SOAP service containing specific characters (used with CXF client)
> ---------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: CXF-1771
>                 URL: https://issues.apache.org/jira/browse/CXF-1771
>             Project: CXF
>          Issue Type: Bug
>    Affects Versions: 2.1.2
>            Reporter: Martijn Brinkers
>
> If my SOAP service returns a String that contains control characters and the service is consumed by a CXF client a com.ctc.wstx.exc.WstxUnexpectedCharException is being thrown.
> It's easy to duplicate (in my setup) by modifying one line of the CXF 2.1.2 sample samples/java_first_jaxws:
>     public String sayHiToUser(User user) {
>         System.out.println("sayHiToUser called");
>         users.put(users.size() + 1, user);
>         return "Hello "  + user.getName() + '\27';          <<<===== add '\27' to the String being returned
>     }
> Now when you start the client sample the following exception is being thrown:
> INFO: Interceptor has thrown exception, unwinding now
> org.apache.cxf.interceptor.Fault: Unmarshalling Error: Illegal character ((CTRL-CHAR, code 23))
>  at [row,col {unknown-source}]: [1,161] 
> 	at org.apache.cxf.jaxb.JAXBEncoderDecoder.unmarshall(JAXBEncoderDecoder.java:552)
> 	at org.apache.cxf.jaxb.JAXBEncoderDecoder.unmarshall(JAXBEncoderDecoder.java:465)
> 	at org.apache.cxf.jaxb.io.DataReaderImpl.read(DataReaderImpl.java:105)
> 	at org.apache.cxf.interceptor.DocLiteralInInterceptor.handleMessage(DocLiteralInInterceptor.java:102)
> 	at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:220)
> 	at org.apache.cxf.endpoint.ClientImpl.onMessage(ClientImpl.java:449)
> 	at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.handleResponse(HTTPConduit.java:2029)
> 	at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.close(HTTPConduit.java:1865)
> 	at org.apache.cxf.transport.AbstractConduit.close(AbstractConduit.java:66)
> 	at org.apache.cxf.transport.http.HTTPConduit.close(HTTPConduit.java:593)
> 	at org.apache.cxf.interceptor.MessageSenderInterceptor$MessageSenderEndingInterceptor.handleMessage(MessageSenderInterceptor.java:62)
> 	at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:220)
> 	at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:296)
> 	at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:242)
> 	at org.apache.cxf.frontend.ClientProxy.invokeSync(ClientProxy.java:73)
> 	at org.apache.cxf.jaxws.JaxWsClientProxy.invoke(JaxWsClientProxy.java:178)
> 	at $Proxy42.sayHiToUser(Unknown Source)
> 	at demo.hw.client.Client.main(Client.java:56)
> Caused by: javax.xml.bind.UnmarshalException
>  - with linked exception:
> [com.ctc.wstx.exc.WstxUnexpectedCharException: Illegal character ((CTRL-CHAR, code 23))
>  at [row,col {unknown-source}]: [1,161]]
> 	at com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallerImpl.handleStreamException(UnmarshallerImpl.java:422)
> 	at com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallerImpl.unmarshal0(UnmarshallerImpl.java:360)
> 	at com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallerImpl.unmarshal(UnmarshallerImpl.java:337)
> 	at org.apache.cxf.jaxb.JAXBEncoderDecoder.unmarshall(JAXBEncoderDecoder.java:537)
> 	... 17 more
> Caused by: com.ctc.wstx.exc.WstxUnexpectedCharException: Illegal character ((CTRL-CHAR, code 23))
>  at [row,col {unknown-source}]: [1,161]
> 	at com.ctc.wstx.sr.StreamScanner.throwInvalidSpace(StreamScanner.java:650)
> 	at com.ctc.wstx.sr.BasicStreamReader.readTextPrimary(BasicStreamReader.java:4554)
> 	at com.ctc.wstx.sr.BasicStreamReader.nextFromTree(BasicStreamReader.java:2886)
> 	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:358)
> 	... 19 more
> Exception in thread "main" javax.xml.ws.soap.SOAPFaultException: Unmarshalling Error: Illegal character ((CTRL-CHAR, code 23))
>  at [row,col {unknown-source}]: [1,161] 
> 	at org.apache.cxf.jaxws.JaxWsClientProxy.invoke(JaxWsClientProxy.java:199)
> 	at $Proxy42.sayHiToUser(Unknown Source)
> 	at demo.hw.client.Client.main(Client.java:56)
> Caused by: org.apache.cxf.interceptor.Fault: Unmarshalling Error: Illegal character ((CTRL-CHAR, code 23))
>  at [row,col {unknown-source}]: [1,161] 
> 	at org.apache.cxf.jaxb.JAXBEncoderDecoder.unmarshall(JAXBEncoderDecoder.java:552)
> 	at org.apache.cxf.jaxb.JAXBEncoderDecoder.unmarshall(JAXBEncoderDecoder.java:465)
> 	at org.apache.cxf.jaxb.io.DataReaderImpl.read(DataReaderImpl.java:105)
> 	at org.apache.cxf.interceptor.DocLiteralInInterceptor.handleMessage(DocLiteralInInterceptor.java:102)
> 	at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:220)
> 	at org.apache.cxf.endpoint.ClientImpl.onMessage(ClientImpl.java:449)
> 	at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.handleResponse(HTTPConduit.java:2029)
> 	at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.close(HTTPConduit.java:1865)
> 	at org.apache.cxf.transport.AbstractConduit.close(AbstractConduit.java:66)
> 	at org.apache.cxf.transport.http.HTTPConduit.close(HTTPConduit.java:593)
> 	at org.apache.cxf.interceptor.MessageSenderInterceptor$MessageSenderEndingInterceptor.handleMessage(MessageSenderInterceptor.java:62)
> 	at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:220)
> 	at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:296)
> 	at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:242)
> 	at org.apache.cxf.frontend.ClientProxy.invokeSync(ClientProxy.java:73)
> 	at org.apache.cxf.jaxws.JaxWsClientProxy.invoke(JaxWsClientProxy.java:178)
> 	... 2 more
> Caused by: javax.xml.bind.UnmarshalException
>  - with linked exception:
> [com.ctc.wstx.exc.WstxUnexpectedCharException: Illegal character ((CTRL-CHAR, code 23))
>  at [row,col {unknown-source}]: [1,161]]
> 	at com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallerImpl.handleStreamException(UnmarshallerImpl.java:422)
> 	at com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallerImpl.unmarshal0(UnmarshallerImpl.java:360)
> 	at com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallerImpl.unmarshal(UnmarshallerImpl.java:337)
> 	at org.apache.cxf.jaxb.JAXBEncoderDecoder.unmarshall(JAXBEncoderDecoder.java:537)
> 	... 17 more
> Caused by: com.ctc.wstx.exc.WstxUnexpectedCharException: Illegal character ((CTRL-CHAR, code 23))
>  at [row,col {unknown-source}]: [1,161]
> 	at com.ctc.wstx.sr.StreamScanner.throwInvalidSpace(StreamScanner.java:650)
> 	at com.ctc.wstx.sr.BasicStreamReader.readTextPrimary(BasicStreamReader.java:4554)
> 	at com.ctc.wstx.sr.BasicStreamReader.nextFromTree(BasicStreamReader.java:2886)
> 	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:358)
> 	... 19 more

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


[jira] Resolved: (CXF-1771) WstxUnexpectedCharException when returning a String from a CXF SOAP service containing specific characters (used with CXF client)

Posted by "Daniel Kulp (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/CXF-1771?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Daniel Kulp resolved CXF-1771.
------------------------------

       Resolution: Invalid
    Fix Version/s: Invalid


Resolving as Invalid as this kind of matches the normal "JAXB" behavior.   JAXB allows creation of XML/SOAP messages that are not valid per the schema.  (like lists of not correct length, nillables or missing elements when they are required, etc....)     If you need strict compliance, it does allow validation to be turned on.

> WstxUnexpectedCharException when returning a String from a CXF SOAP service containing specific characters (used with CXF client)
> ---------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: CXF-1771
>                 URL: https://issues.apache.org/jira/browse/CXF-1771
>             Project: CXF
>          Issue Type: Bug
>    Affects Versions: 2.1.2
>            Reporter: Martijn Brinkers
>             Fix For: Invalid
>
>
> If my SOAP service returns a String that contains control characters and the service is consumed by a CXF client a com.ctc.wstx.exc.WstxUnexpectedCharException is being thrown.
> It's easy to duplicate (in my setup) by modifying one line of the CXF 2.1.2 sample samples/java_first_jaxws:
>     public String sayHiToUser(User user) {
>         System.out.println("sayHiToUser called");
>         users.put(users.size() + 1, user);
>         return "Hello "  + user.getName() + '\27';          <<<===== add '\27' to the String being returned
>     }
> Now when you start the client sample the following exception is being thrown:
> INFO: Interceptor has thrown exception, unwinding now
> org.apache.cxf.interceptor.Fault: Unmarshalling Error: Illegal character ((CTRL-CHAR, code 23))
>  at [row,col {unknown-source}]: [1,161] 
> 	at org.apache.cxf.jaxb.JAXBEncoderDecoder.unmarshall(JAXBEncoderDecoder.java:552)
> 	at org.apache.cxf.jaxb.JAXBEncoderDecoder.unmarshall(JAXBEncoderDecoder.java:465)
> 	at org.apache.cxf.jaxb.io.DataReaderImpl.read(DataReaderImpl.java:105)
> 	at org.apache.cxf.interceptor.DocLiteralInInterceptor.handleMessage(DocLiteralInInterceptor.java:102)
> 	at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:220)
> 	at org.apache.cxf.endpoint.ClientImpl.onMessage(ClientImpl.java:449)
> 	at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.handleResponse(HTTPConduit.java:2029)
> 	at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.close(HTTPConduit.java:1865)
> 	at org.apache.cxf.transport.AbstractConduit.close(AbstractConduit.java:66)
> 	at org.apache.cxf.transport.http.HTTPConduit.close(HTTPConduit.java:593)
> 	at org.apache.cxf.interceptor.MessageSenderInterceptor$MessageSenderEndingInterceptor.handleMessage(MessageSenderInterceptor.java:62)
> 	at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:220)
> 	at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:296)
> 	at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:242)
> 	at org.apache.cxf.frontend.ClientProxy.invokeSync(ClientProxy.java:73)
> 	at org.apache.cxf.jaxws.JaxWsClientProxy.invoke(JaxWsClientProxy.java:178)
> 	at $Proxy42.sayHiToUser(Unknown Source)
> 	at demo.hw.client.Client.main(Client.java:56)
> Caused by: javax.xml.bind.UnmarshalException
>  - with linked exception:
> [com.ctc.wstx.exc.WstxUnexpectedCharException: Illegal character ((CTRL-CHAR, code 23))
>  at [row,col {unknown-source}]: [1,161]]
> 	at com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallerImpl.handleStreamException(UnmarshallerImpl.java:422)
> 	at com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallerImpl.unmarshal0(UnmarshallerImpl.java:360)
> 	at com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallerImpl.unmarshal(UnmarshallerImpl.java:337)
> 	at org.apache.cxf.jaxb.JAXBEncoderDecoder.unmarshall(JAXBEncoderDecoder.java:537)
> 	... 17 more
> Caused by: com.ctc.wstx.exc.WstxUnexpectedCharException: Illegal character ((CTRL-CHAR, code 23))
>  at [row,col {unknown-source}]: [1,161]
> 	at com.ctc.wstx.sr.StreamScanner.throwInvalidSpace(StreamScanner.java:650)
> 	at com.ctc.wstx.sr.BasicStreamReader.readTextPrimary(BasicStreamReader.java:4554)
> 	at com.ctc.wstx.sr.BasicStreamReader.nextFromTree(BasicStreamReader.java:2886)
> 	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:358)
> 	... 19 more
> Exception in thread "main" javax.xml.ws.soap.SOAPFaultException: Unmarshalling Error: Illegal character ((CTRL-CHAR, code 23))
>  at [row,col {unknown-source}]: [1,161] 
> 	at org.apache.cxf.jaxws.JaxWsClientProxy.invoke(JaxWsClientProxy.java:199)
> 	at $Proxy42.sayHiToUser(Unknown Source)
> 	at demo.hw.client.Client.main(Client.java:56)
> Caused by: org.apache.cxf.interceptor.Fault: Unmarshalling Error: Illegal character ((CTRL-CHAR, code 23))
>  at [row,col {unknown-source}]: [1,161] 
> 	at org.apache.cxf.jaxb.JAXBEncoderDecoder.unmarshall(JAXBEncoderDecoder.java:552)
> 	at org.apache.cxf.jaxb.JAXBEncoderDecoder.unmarshall(JAXBEncoderDecoder.java:465)
> 	at org.apache.cxf.jaxb.io.DataReaderImpl.read(DataReaderImpl.java:105)
> 	at org.apache.cxf.interceptor.DocLiteralInInterceptor.handleMessage(DocLiteralInInterceptor.java:102)
> 	at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:220)
> 	at org.apache.cxf.endpoint.ClientImpl.onMessage(ClientImpl.java:449)
> 	at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.handleResponse(HTTPConduit.java:2029)
> 	at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.close(HTTPConduit.java:1865)
> 	at org.apache.cxf.transport.AbstractConduit.close(AbstractConduit.java:66)
> 	at org.apache.cxf.transport.http.HTTPConduit.close(HTTPConduit.java:593)
> 	at org.apache.cxf.interceptor.MessageSenderInterceptor$MessageSenderEndingInterceptor.handleMessage(MessageSenderInterceptor.java:62)
> 	at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:220)
> 	at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:296)
> 	at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:242)
> 	at org.apache.cxf.frontend.ClientProxy.invokeSync(ClientProxy.java:73)
> 	at org.apache.cxf.jaxws.JaxWsClientProxy.invoke(JaxWsClientProxy.java:178)
> 	... 2 more
> Caused by: javax.xml.bind.UnmarshalException
>  - with linked exception:
> [com.ctc.wstx.exc.WstxUnexpectedCharException: Illegal character ((CTRL-CHAR, code 23))
>  at [row,col {unknown-source}]: [1,161]]
> 	at com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallerImpl.handleStreamException(UnmarshallerImpl.java:422)
> 	at com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallerImpl.unmarshal0(UnmarshallerImpl.java:360)
> 	at com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallerImpl.unmarshal(UnmarshallerImpl.java:337)
> 	at org.apache.cxf.jaxb.JAXBEncoderDecoder.unmarshall(JAXBEncoderDecoder.java:537)
> 	... 17 more
> Caused by: com.ctc.wstx.exc.WstxUnexpectedCharException: Illegal character ((CTRL-CHAR, code 23))
>  at [row,col {unknown-source}]: [1,161]
> 	at com.ctc.wstx.sr.StreamScanner.throwInvalidSpace(StreamScanner.java:650)
> 	at com.ctc.wstx.sr.BasicStreamReader.readTextPrimary(BasicStreamReader.java:4554)
> 	at com.ctc.wstx.sr.BasicStreamReader.nextFromTree(BasicStreamReader.java:2886)
> 	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:358)
> 	... 19 more

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


[jira] Commented: (CXF-1771) WstxUnexpectedCharException when returning a String from a CXF SOAP service containing specific characters (used with CXF client)

Posted by "Martijn Brinkers (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/CXF-1771?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12627017#action_12627017 ] 

Martijn Brinkers commented on CXF-1771:
---------------------------------------

True but my CXF soap service just returns a String. So does that mean that when you return a String from your CXF soap service you (the one implementing the CXF service) must be sure that the String does not contain illegal characters? In other words I need to filter all the Strings that I return from the CXF soap service?

> WstxUnexpectedCharException when returning a String from a CXF SOAP service containing specific characters (used with CXF client)
> ---------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: CXF-1771
>                 URL: https://issues.apache.org/jira/browse/CXF-1771
>             Project: CXF
>          Issue Type: Bug
>    Affects Versions: 2.1.2
>            Reporter: Martijn Brinkers
>
> If my SOAP service returns a String that contains control characters and the service is consumed by a CXF client a com.ctc.wstx.exc.WstxUnexpectedCharException is being thrown.
> It's easy to duplicate (in my setup) by modifying one line of the CXF 2.1.2 sample samples/java_first_jaxws:
>     public String sayHiToUser(User user) {
>         System.out.println("sayHiToUser called");
>         users.put(users.size() + 1, user);
>         return "Hello "  + user.getName() + '\27';          <<<===== add '\27' to the String being returned
>     }
> Now when you start the client sample the following exception is being thrown:
> INFO: Interceptor has thrown exception, unwinding now
> org.apache.cxf.interceptor.Fault: Unmarshalling Error: Illegal character ((CTRL-CHAR, code 23))
>  at [row,col {unknown-source}]: [1,161] 
> 	at org.apache.cxf.jaxb.JAXBEncoderDecoder.unmarshall(JAXBEncoderDecoder.java:552)
> 	at org.apache.cxf.jaxb.JAXBEncoderDecoder.unmarshall(JAXBEncoderDecoder.java:465)
> 	at org.apache.cxf.jaxb.io.DataReaderImpl.read(DataReaderImpl.java:105)
> 	at org.apache.cxf.interceptor.DocLiteralInInterceptor.handleMessage(DocLiteralInInterceptor.java:102)
> 	at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:220)
> 	at org.apache.cxf.endpoint.ClientImpl.onMessage(ClientImpl.java:449)
> 	at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.handleResponse(HTTPConduit.java:2029)
> 	at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.close(HTTPConduit.java:1865)
> 	at org.apache.cxf.transport.AbstractConduit.close(AbstractConduit.java:66)
> 	at org.apache.cxf.transport.http.HTTPConduit.close(HTTPConduit.java:593)
> 	at org.apache.cxf.interceptor.MessageSenderInterceptor$MessageSenderEndingInterceptor.handleMessage(MessageSenderInterceptor.java:62)
> 	at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:220)
> 	at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:296)
> 	at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:242)
> 	at org.apache.cxf.frontend.ClientProxy.invokeSync(ClientProxy.java:73)
> 	at org.apache.cxf.jaxws.JaxWsClientProxy.invoke(JaxWsClientProxy.java:178)
> 	at $Proxy42.sayHiToUser(Unknown Source)
> 	at demo.hw.client.Client.main(Client.java:56)
> Caused by: javax.xml.bind.UnmarshalException
>  - with linked exception:
> [com.ctc.wstx.exc.WstxUnexpectedCharException: Illegal character ((CTRL-CHAR, code 23))
>  at [row,col {unknown-source}]: [1,161]]
> 	at com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallerImpl.handleStreamException(UnmarshallerImpl.java:422)
> 	at com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallerImpl.unmarshal0(UnmarshallerImpl.java:360)
> 	at com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallerImpl.unmarshal(UnmarshallerImpl.java:337)
> 	at org.apache.cxf.jaxb.JAXBEncoderDecoder.unmarshall(JAXBEncoderDecoder.java:537)
> 	... 17 more
> Caused by: com.ctc.wstx.exc.WstxUnexpectedCharException: Illegal character ((CTRL-CHAR, code 23))
>  at [row,col {unknown-source}]: [1,161]
> 	at com.ctc.wstx.sr.StreamScanner.throwInvalidSpace(StreamScanner.java:650)
> 	at com.ctc.wstx.sr.BasicStreamReader.readTextPrimary(BasicStreamReader.java:4554)
> 	at com.ctc.wstx.sr.BasicStreamReader.nextFromTree(BasicStreamReader.java:2886)
> 	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:358)
> 	... 19 more
> Exception in thread "main" javax.xml.ws.soap.SOAPFaultException: Unmarshalling Error: Illegal character ((CTRL-CHAR, code 23))
>  at [row,col {unknown-source}]: [1,161] 
> 	at org.apache.cxf.jaxws.JaxWsClientProxy.invoke(JaxWsClientProxy.java:199)
> 	at $Proxy42.sayHiToUser(Unknown Source)
> 	at demo.hw.client.Client.main(Client.java:56)
> Caused by: org.apache.cxf.interceptor.Fault: Unmarshalling Error: Illegal character ((CTRL-CHAR, code 23))
>  at [row,col {unknown-source}]: [1,161] 
> 	at org.apache.cxf.jaxb.JAXBEncoderDecoder.unmarshall(JAXBEncoderDecoder.java:552)
> 	at org.apache.cxf.jaxb.JAXBEncoderDecoder.unmarshall(JAXBEncoderDecoder.java:465)
> 	at org.apache.cxf.jaxb.io.DataReaderImpl.read(DataReaderImpl.java:105)
> 	at org.apache.cxf.interceptor.DocLiteralInInterceptor.handleMessage(DocLiteralInInterceptor.java:102)
> 	at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:220)
> 	at org.apache.cxf.endpoint.ClientImpl.onMessage(ClientImpl.java:449)
> 	at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.handleResponse(HTTPConduit.java:2029)
> 	at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.close(HTTPConduit.java:1865)
> 	at org.apache.cxf.transport.AbstractConduit.close(AbstractConduit.java:66)
> 	at org.apache.cxf.transport.http.HTTPConduit.close(HTTPConduit.java:593)
> 	at org.apache.cxf.interceptor.MessageSenderInterceptor$MessageSenderEndingInterceptor.handleMessage(MessageSenderInterceptor.java:62)
> 	at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:220)
> 	at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:296)
> 	at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:242)
> 	at org.apache.cxf.frontend.ClientProxy.invokeSync(ClientProxy.java:73)
> 	at org.apache.cxf.jaxws.JaxWsClientProxy.invoke(JaxWsClientProxy.java:178)
> 	... 2 more
> Caused by: javax.xml.bind.UnmarshalException
>  - with linked exception:
> [com.ctc.wstx.exc.WstxUnexpectedCharException: Illegal character ((CTRL-CHAR, code 23))
>  at [row,col {unknown-source}]: [1,161]]
> 	at com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallerImpl.handleStreamException(UnmarshallerImpl.java:422)
> 	at com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallerImpl.unmarshal0(UnmarshallerImpl.java:360)
> 	at com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallerImpl.unmarshal(UnmarshallerImpl.java:337)
> 	at org.apache.cxf.jaxb.JAXBEncoderDecoder.unmarshall(JAXBEncoderDecoder.java:537)
> 	... 17 more
> Caused by: com.ctc.wstx.exc.WstxUnexpectedCharException: Illegal character ((CTRL-CHAR, code 23))
>  at [row,col {unknown-source}]: [1,161]
> 	at com.ctc.wstx.sr.StreamScanner.throwInvalidSpace(StreamScanner.java:650)
> 	at com.ctc.wstx.sr.BasicStreamReader.readTextPrimary(BasicStreamReader.java:4554)
> 	at com.ctc.wstx.sr.BasicStreamReader.nextFromTree(BasicStreamReader.java:2886)
> 	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:358)
> 	... 19 more

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