axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jason Kania (JIRA)" <>
Subject [jira] Updated: (AXIS2-3007) RESTful services invocation self induces Input Stream Closed error
Date Wed, 25 Jul 2007 23:03:31 GMT


Jason Kania updated AXIS2-3007:

I have investigated and two potential issues exist. The source of the incorrect content type
is actually from the ServiceClient because within TransportUtils in method getMessageFormatter,
it defaults content-type to application/xml when REST is enabled. I am not sure whether this
default being set makes sense given your previous comments.

TransportUtils.getMessageFormatter(MessageContext) line: 249	
HTTPSender.populateCommonProperties(MessageContext, URL, HttpMethodBase, HttpClient, String)
line: 254	
HTTPSender.sendViaGet(MessageContext, URL, String) line: 89	
HTTPSender.send(MessageContext, URL, String) line: 59	
CommonsHTTPTransportSender.writeMessageWithCommons(MessageContext, EndpointReference, OMOutputFormat)
line: 305	
CommonsHTTPTransportSender.invoke(MessageContext) line: 201	
AxisEngine.send(MessageContext) line: 452	
OutInAxisOperationClient.send(MessageContext) line: 330	
OutInAxisOperationClient.execute(boolean) line: 294	

Subsequently, I followed the call stack on the servlet side up and the content-type was not
changed. Thus, reproduction of the error should be as simple as setting up the client as follows:

ServiceClient serviceClient = new ServiceClient();
OperationClient client = serviceClient.createClient( ServiceClient.ANON_OUT_IN_OP );
Options options = new Options();
options.setTransportInProtocol( Constants.TRANSPORT_HTTP );

serviceClient.setTargetEPR( targetEPR );

options.setProperty( Constants.Configuration.ENABLE_REST, Constants.VALUE_TRUE ); // Thise
seems to do nothing
options.setProperty( HTTPConstants.AUTHENTICATE, null );
options.setProperty( Constants.Configuration.HTTP_METHOD, Constants.Configuration.HTTP_METHOD_GET

MessageContext messageContext = new MessageContext();
messageContext.setIsSOAP11Explicit( false );
messageContext.setDoingREST( true );
client.addMessageContext( messageContext );


To me, this means that the Axis2 servlet should protect itself earlier on by detecting the
invalid/unsupported content-type in the GET message.

Let me know if you need other information.


> RESTful services invocation self induces Input Stream Closed error
> ------------------------------------------------------------------
>                 Key: AXIS2-3007
>                 URL:
>             Project: Axis 2.0 (Axis2)
>          Issue Type: Bug
>    Affects Versions: 1.2
>         Environment: Windows 2000, Eclipse IDE
>            Reporter: Jason Kania
>            Assignee: Keith Godwin Chapman
> When making REST GET calls to an API, Axis 2 core sets its input stream to null and then
complains later that its stream has been closed. The following partial stack trace demonstrates
the problem.
> ApplicationXMLBuilder.processDocument(InputStream, String, MessageContext) line: 49	
> TransportUtils.createSOAPMessage(MessageContext, InputStream, String) line: 130	
> RESTUtil.processURLRequest(MessageContext, OutputStream, String) line: 98	
> AxisServlet$ProcessRESTRequest.processURLRequest() line: 776	
> AxisServlet.doGet(HttpServletRequest, HttpServletResponse) line: 238	
> AxisServlet(HttpServlet).service(HttpServletRequest, HttpServletResponse) line: 707	
> AxisServlet(HttpServlet).service(ServletRequest, ServletResponse) line: 820	
> ServletHolder.handle(ServletRequest, ServletResponse) line: 487	
> ...
> In RESTUtil, method processURLRequest, the following call is made on line 98
>                 soapEnvelope = TransportUtils
>                         .createSOAPMessage(msgContext, null, contentType);
> where the null is supposed to be the input stream
> Thus, when line 49 of ApplicationXMLBuilder in method processDocument is encountered,
>             PushbackInputStream pushbackInputStream = new PushbackInputStream(inputStream);
> where inputStream is null,
> the exception " Stream closed" is generated once the empty stream
is read at line 51
> of ApplicationXMLBuilder:
>            if ((b = > 0) {
> For straight Axis use, this issue is a blocker, but I have worked around the problem
by filtering empty get methods at the servlet level and am populating them with content for

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:
For additional commands, e-mail:

View raw message