You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by "Amila Chinthaka Suriarachchi (JIRA)" <ji...@apache.org> on 2010/12/26 17:00:47 UTC

[jira] Resolved: (AXIS2-4124) CLONE -Exception in XML serialization causes malformed/corrupted response

     [ https://issues.apache.org/jira/browse/AXIS2-4124?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Amila Chinthaka Suriarachchi resolved AXIS2-4124.
-------------------------------------------------

    Resolution: Won't Fix

by default axis2 supports streaming i.e it starts writing the response without knowing all the message.

if you want to stop that you can build the envelope using an out handler. Please see this[1] to write a module.

within the handler you can call msgContext.getEnvelope().build(); to build the message. if there is a problem with the message it will cause the exception here.

[1] http://wso2.org/library/articles/extending-axis2

> CLONE -Exception in XML serialization causes malformed/corrupted response
> -------------------------------------------------------------------------
>
>                 Key: AXIS2-4124
>                 URL: https://issues.apache.org/jira/browse/AXIS2-4124
>             Project: Axis2
>          Issue Type: Bug
>          Components: kernel
>    Affects Versions: 1.4.1
>         Environment: Windows Vista, Tomcat 5.5.27, JDK 1.5.0_10
>            Reporter: Peter Storch
>            Assignee: Senaka Fernando
>            Priority: Blocker
>         Attachments: AXIS2-BadCharacter.aar
>
>
> Hi there,
> We have a simple SOAP layer that returns data pulled from the DB using Axis.  Nothing special here.
> In our testing, one of the objects happened to have an invalid XML 1.0 character (0x10) in its description field.  As it's not an application Fault (our application currently doesn't check for it.  It no doubt should, obviously), Axis2 wasn't aware of it until it's notified by the Woodstox BufferingXMLWriter of an invalid character (through IOException).  Axis2 caught the exception (at , and raised an AxisFault.  It then proceeded to send the Fault as its own message (envelope) back to the client.  All is well, except that Axis2 was in the middle of writing out response provided by the business application.  That led to a corrupted byte stream that contained a partial, not well-formed envelope, followed immediately by the Fault envelope.  Something to the effect of a purging (not flushing) to clear the output stream before sending out the Fault message would seem desirable.
> It may not be so bad if the client receives such a corrupted stream, and throws some sort of error.  The Fault message becomes meaningless, obviously, which isn't great either.  But, what's worse is that the Axis2 client (ServiceClient.sendReceive) actually was able to parse the corrupted byte stream, and somehow considered the Fault message be the content of the last XML element that contained the invalid character.  Now, that's really bad.
> This may have been logged in JIRA, but I couldn't seem to find it.
> -Alan
> Stack track of the exception caught by Axis2 during serialization:
>  com.ctc.wstx.exc.WstxIOException: Invalid white space character (0x10) in text to output
> 	at com.ctc.wstx.sw.BaseStreamWriter.writeCharacters(BaseStreamWriter.java:520)
> 	at org.apache.axiom.om.impl.llom.OMTextImpl.writeOutput(OMTextImpl.java:209)
> 	at org.apache.axiom.om.impl.llom.OMTextImpl.internalSerializeLocal(OMTextImpl.java:368)
> 	at org.apache.axiom.om.impl.llom.OMTextImpl.internalSerialize(OMTextImpl.java:197)
> 	at org.apache.axiom.om.impl.llom.OMElementImpl.internalSerialize(OMElementImpl.java:766)
> 	at org.apache.axiom.om.impl.llom.OMElementImpl.internalSerialize(OMElementImpl.java:750)
> 	at org.apache.axiom.om.impl.llom.OMElementImpl.internalSerialize(OMElementImpl.java:766)
> 	at org.apache.axiom.om.impl.llom.OMElementImpl.internalSerialize(OMElementImpl.java:750)
> 	at org.apache.axiom.om.impl.llom.OMElementImpl.internalSerialize(OMElementImpl.java:766)
> 	at org.apache.axiom.om.impl.llom.OMSourcedElementImpl.internalSerialize(OMSourcedElementImpl.java:564)
> 	at org.apache.axiom.om.impl.llom.OMElementImpl.internalSerialize(OMElementImpl.java:750)
> 	at org.apache.axiom.om.impl.llom.OMSourcedElementImpl.internalSerialize(OMSourcedElementImpl.java:551)
> 	at org.apache.axiom.om.impl.llom.OMSourcedElementImpl.serialize(OMSourcedElementImpl.java:592)
> 	at org.apache.axiom.om.impl.llom.OMElementImpl.toString(OMElementImpl.java:907)
> 	... 30 more
> Caused by: java.io.IOException: Invalid white space character (0x10) in text to output
> 	at com.ctc.wstx.sw.XmlWriter.throwInvalidChar(XmlWriter.java:545)
> 	at com.ctc.wstx.sw.BufferingXmlWriter.writeCharacters(BufferingXmlWriter.java:453)
> 	at com.ctc.wstx.sw.BaseStreamWriter.writeCharacters(BaseStreamWriter.java:518)
> 	... 43 more
> This is the call stack from Eclipse debugger:
> CoyoteOutputStream.write(byte[], int, int) line: 88	
> UTF8Writer.flush() line: 96	
> BufferingXmlWriter.flush() line: 214	
> SimpleNsStreamWriter(BaseStreamWriter).flush() line: 311	
> MTOMXMLStreamWriter.flush() line: 115	
> SOAPEnvelopeImpl(OMNodeImpl).serializeAndConsume(OutputStream, OMOutputFormat) line: 419	
> SOAPMessageFormatter.writeTo(MessageContext, OMOutputFormat, OutputStream, boolean) line: 55	
> CommonsHTTPTransportSender.sendUsingOutputStream(MessageContext, OMOutputFormat) line: 275	
> CommonsHTTPTransportSender.invoke(MessageContext) line: 203	
> AxisEngine.sendFault(MessageContext) line: 533	
> AxisServlet.handleFault(MessageContext, OutputStream, AxisFault) line: 393	
> AxisServlet.processAxisFault(MessageContext, HttpServletResponse, OutputStream, AxisFault) line: 355	
> AxisServlet.doPost(HttpServletRequest, HttpServletResponse) line: 152	
> AxisServlet(HttpServlet).service(HttpServletRequest, HttpServletResponse) line: 709	
> AxisServlet(HttpServlet).service(ServletRequest, ServletResponse) line: 802	
> ApplicationFilterChain.internalDoFilter(ServletRequest, ServletResponse) line: 252	
> ApplicationFilterChain.doFilter(ServletRequest, ServletResponse) line: 173	
> HibernateFilter.doFilter(ServletRequest, ServletResponse, FilterChain) line: 95	
> ApplicationFilterChain.internalDoFilter(ServletRequest, ServletResponse) line: 202	
> ApplicationFilterChain.doFilter(ServletRequest, ServletResponse) line: 173	
> StandardWrapperValve.invoke(Request, Response) line: 213	
> StandardContextValve.invoke(Request, Response) line: 178	
> StandardHostValve.invoke(Request, Response) line: 126	
> ErrorReportValve.invoke(Request, Response) line: 105	
> FastCommonAccessLogValve.invoke(Request, Response) line: 495	
> StandardEngineValve.invoke(Request, Response) line: 107	
> CoyoteAdapter.service(Request, Response) line: 148	
> Http11Processor.process(InputStream, OutputStream) line: 869	
> Http11Protocol$JmxHttp11ConnectionHandler(Http11BaseProtocol$Http11ConnectionHandler).processConnection(TcpConnection, Object[]) line: 664	
> PoolTcpEndpoint.processSocket(Socket, TcpConnection, Object[]) line: 527	
> LeaderFollowerWorkerThread.runIt(Object[]) line: 80	
> ThreadPool$ControlRunnable.run() line: 684	
> ThreadWithAttributes(Thread).run() line: 595	
> What got sent over the wire back to the client:
> <soapenv:Body xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"><ns2:getSKUListResponse xmlns:ns2="http://mds.adserver.massive.com/xsd"><ns2:record><s41:createdOn xmlns:s41="http://types.mds.adserver.massive.com/">2005-09-20T19:56:21.000Z</s41:createdOn><s42:description xmlns:s42="http://types.mds.adserver.massive.com/">x</s42:description><s43:id xmlns:s43="http://types.mds.adserver.massive.com/">51</s43:id><s44:modifiedOn xmlns:s44="http://types.mds.adserver.massive.com/">2005-09-23T17:51:37.000Z</s44:modifiedOn><s45:name xmlns:s45="http://types.mds.adserver.massive.com/">EveryoneSKU</s45:name><s46:enabled xmlns:s46="http://types.mds.adserver.massive.com/">true</s46:enabled></ns2:record><ns2:record><s47:createdOn xmlns:s47="http://types.mds.adserver.massive.com/">2005-09-20T19:55:23.000Z</s47:createdOn><s48:description xmlns:s48="http://types.mds.adserver.massive.com/"><xml version='1.0' encoding='UTF-8'?><soapenv:Envelope><soapenv:Body><soapenv:Fault><faultcode>soapenv:Client</faultcode><faultstring>Invalid white space character (0x10) in text to output</faultstring><detail /></soapenv:Fault></soapenv:Body></soapenv:Envelope>
> What the client (Axis2 ServiceClient) thought it was getting:
> <soapenv:Body xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"><ns2:getSKUListResponse xmlns:ns2="http://mds.adserver.massive.com/xsd"><ns2:record><s41:createdOn xmlns:s41="http://types.mds.adserver.massive.com/">2005-09-20T19:56:21.000Z</s41:createdOn><s42:description xmlns:s42="http://types.mds.adserver.massive.com/">x</s42:description><s43:id xmlns:s43="http://types.mds.adserver.massive.com/">51</s43:id><s44:modifiedOn xmlns:s44="http://types.mds.adserver.massive.com/">2005-09-23T17:51:37.000Z</s44:modifiedOn><s45:name xmlns:s45="http://types.mds.adserver.massive.com/">EveryoneSKU</s45:name><s46:enabled xmlns:s46="http://types.mds.adserver.massive.com/">true</s46:enabled></ns2:record><ns2:record><s47:createdOn xmlns:s47="http://types.mds.adserver.massive.com/">2005-09-20T19:55:23.000Z</s47:createdOn><s48:description xmlns:s48="http://types.mds.adserver.massive.com/"> version='1.0' encoding='UTF-8'?><soapenv:Envelope><soapenv:Body><soapenv:Fault><faultcode>soapenv:Client</faultcode><faultstring>Invalid white space character (0x10) in text to output</faultstring><detail /></soapenv:Fault></soapenv:Body></soapenv:Envelope></s48:description></ns2:record></ns2:getSKUListResponse></soapenv:Body>

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


---------------------------------------------------------------------
To unsubscribe, e-mail: java-dev-unsubscribe@axis.apache.org
For additional commands, e-mail: java-dev-help@axis.apache.org