[ 
https://issues.apache.org/jira/browse/AXIS2-3007?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12515510
 ] 

Keith Godwin Chapman commented on AXIS2-3007:
---------------------------------------------

Hi jason,

I see the problem now. I'll give you a workaround for the moment but I agree 
that we need to fix something here.

The workaround is to get rid of the Constants.Configuration.ENABLE_REST 
property but instead set the following property.
options.setProperty(org.apache.axis2.Constants.Configuration.MESSAGE_TYPE,"application/x-www-form-urlencoded");
 

With the introduction of messageBuilders and messageFormatters into axis2 we 
depended on using the message_Type property to select the relevant builder and 
formatter. Now you don't have to specifically enable rest on the client code to 
get it working. You just have to set the relevant messageType (Which is more or 
less contentType, the naming here is because messageType is independent of 
transport used) and the HTTPMethod to use. 

I'll fix the code so that it will look at the HTTPMethod before defaulting to 
ApplicationXMLFormatter when rest is enabled. Thanks for pointing this out. You 
may try the nightly or even the 1.3 release to have this fix.

> RESTful services invocation self induces Input Stream Closed error
> ------------------------------------------------------------------
>
>                 Key: AXIS2-3007
>                 URL: https://issues.apache.org/jira/browse/AXIS2-3007
>             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 "java.io.IOException: Stream closed" is generated once the 
> empty stream is read at line 51
> of ApplicationXMLBuilder:
>            if ((b = pushbackInputStream.read()) > 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 now.

-- 
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: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to