[ 
https://issues.apache.org/jira/browse/AXIS2-4398?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12724971#action_12724971
 ] 

Deepal Jayasinghe commented on AXIS2-4398:
------------------------------------------

I tried to apply the patch, but got some build errors. Could you please double 
check and attach the patch.

Thanks,
Deepal

> Poor error handling when a request parameter of the wrong type is sent to a 
> POJO web service
> --------------------------------------------------------------------------------------------
>
>                 Key: AXIS2-4398
>                 URL: https://issues.apache.org/jira/browse/AXIS2-4398
>             Project: Axis 2.0 (Axis2)
>          Issue Type: Improvement
>          Components: adb
>    Affects Versions: 1.5
>            Reporter: Pétur Runólfsson
>            Priority: Minor
>         Attachments: AXIS2-4398.patch, Server.java, Server.wsdl, services.xml
>
>
> If a request parameter in a SOAP or REST request to a POJO web service is not 
> of the expected type, the error messages that are returned to the client and 
> that appear in the logs are often not very good. For example, the faultcode 
> is soapenv:Receiver (should be soapenv:Sender since the error was caused by 
> an invalid request), and the name of the offending parameter or field doesn't 
> appear anywhere.
> Here is a sample request (args0 is declared as xs:int):
> <soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope"; 
> xmlns:axis="http://ws.apache.org/axis2";>
>    <soap:Header/>
>    <soap:Body>
>       <axis:echoInt>
>          <!--Optional:-->
>          <axis:args0>?</axis:args0>
>       </axis:echoInt>
>    </soap:Body>
> </soap:Envelope>
> The response is:
> <soapenv:Envelope xmlns:soapenv="http://www.w3.org/2003/05/soap-envelope";>
>    <soapenv:Body>
>       <soapenv:Fault>
>          <soapenv:Code>
>             <soapenv:Value>soapenv:Receiver</soapenv:Value>
>          </soapenv:Code>
>          <soapenv:Reason>
>             <soapenv:Text xml:lang="en-US">For input string: 
> "?"</soapenv:Text>
>          </soapenv:Reason>
>          <soapenv:Detail/>
>       </soapenv:Fault>
>    </soapenv:Body>
> </soapenv:Envelope>
> The tomcat log contains:
> [ERROR] For input string: "?"                                                 
>                                                                               
>              
> java.lang.NumberFormatException: For input string: "?"                        
>                                                                               
>              
>         at 
> java.lang.NumberFormatException.forInputString(NumberFormatException.java:48) 
>                                                                               
>   
>         at java.lang.Integer.parseInt(Integer.java:447)                       
>                                                                               
>              
>         at java.lang.Integer.<init>(Integer.java:620)                         
>                                                                               
>              
>         at 
> org.apache.axis2.databinding.typemapping.SimpleTypeMapper.getSimpleTypeObject(SimpleTypeMapper.java:80)
>                                                        
>         at 
> org.apache.axis2.databinding.utils.BeanUtil.processObject(BeanUtil.java:675)  
>                                                                               
>   
>         at 
> org.apache.axis2.databinding.utils.BeanUtil.ProcessElement(BeanUtil.java:630) 
>                                                                               
>   
>         at 
> org.apache.axis2.databinding.utils.BeanUtil.deserialize(BeanUtil.java:562)    
>                                                                               
>   
>         at 
> org.apache.axis2.rpc.receivers.RPCUtil.processRequest(RPCUtil.java:153)       
>                                                                               
>   
>         at 
> org.apache.axis2.rpc.receivers.RPCUtil.invokeServiceClass(RPCUtil.java:188)   
>                                                                               
>   
>         at 
> org.apache.axis2.rpc.receivers.RPCMessageReceiver.invokeBusinessLogic(RPCMessageReceiver.java:102)
>                                                             
>         at 
> org.apache.axis2.receivers.AbstractInOutMessageReceiver.invokeBusinessLogic(AbstractInOutMessageReceiver.java:40)
>                                              
>         at 
> org.apache.axis2.receivers.AbstractMessageReceiver.receive(AbstractMessageReceiver.java:114)
>                                                                   
>         at org.apache.axis2.engine.AxisEngine.receive(AxisEngine.java:173)    
>                                                                               
>              
>         at 
> org.apache.axis2.transport.http.HTTPTransportUtils.processHTTPPostRequest(HTTPTransportUtils.java:167)
>                                                         
>         at 
> org.apache.axis2.transport.http.AxisServlet.doPost(AxisServlet.java:142)      
>                                                                               
>   
>         at javax.servlet.http.HttpServlet.service(HttpServlet.java:637)       
>                                                                               
>              
>         at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
>         at 
> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
>         at 
> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
>         at 
> org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
>         at 
> org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
>         at 
> org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
>         at 
> org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
>         at org.josso.tc60.agent.SSOAgentValve.invoke(SSOAgentValve.java:275)
>         at 
> org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
>         at 
> org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:286)
>         at 
> org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:845)
>         at 
> org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
>         at 
> org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
>         at java.lang.Thread.run(Thread.java:619)
> [ERROR] For input string: "?"
> org.apache.axis2.AxisFault: For input string: "?"
>         at org.apache.axis2.AxisFault.makeFault(AxisFault.java:430)
>         at 
> org.apache.axis2.rpc.receivers.RPCMessageReceiver.invokeBusinessLogic(RPCMessageReceiver.java:161)
>         at 
> org.apache.axis2.receivers.AbstractInOutMessageReceiver.invokeBusinessLogic(AbstractInOutMessageReceiver.java:40)
>         at 
> org.apache.axis2.receivers.AbstractMessageReceiver.receive(AbstractMessageReceiver.java:114)
>         at org.apache.axis2.engine.AxisEngine.receive(AxisEngine.java:173)
>         at 
> org.apache.axis2.transport.http.HTTPTransportUtils.processHTTPPostRequest(HTTPTransportUtils.java:167)
>         at 
> org.apache.axis2.transport.http.AxisServlet.doPost(AxisServlet.java:142)
>         at javax.servlet.http.HttpServlet.service(HttpServlet.java:637)
>         at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
>         at 
> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
>         at 
> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
>         at 
> org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
>         at 
> org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
>         at 
> org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
>         at 
> org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
>         at org.josso.tc60.agent.SSOAgentValve.invoke(SSOAgentValve.java:275)
>         at 
> org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
>         at 
> org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:286)
>         at 
> org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:845)
>         at 
> org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
>         at 
> org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
>         at java.lang.Thread.run(Thread.java:619)
> Caused by: java.lang.NumberFormatException: For input string: "?"
>         at 
> java.lang.NumberFormatException.forInputString(NumberFormatException.java:48)
>         at java.lang.Integer.parseInt(Integer.java:447)
>         at java.lang.Integer.<init>(Integer.java:620)
>         at 
> org.apache.axis2.databinding.typemapping.SimpleTypeMapper.getSimpleTypeObject(SimpleTypeMapper.java:80)
>         at 
> org.apache.axis2.databinding.utils.BeanUtil.processObject(BeanUtil.java:675)
>         at 
> org.apache.axis2.databinding.utils.BeanUtil.ProcessElement(BeanUtil.java:630)
>         at 
> org.apache.axis2.databinding.utils.BeanUtil.deserialize(BeanUtil.java:562)
>         at 
> org.apache.axis2.rpc.receivers.RPCUtil.processRequest(RPCUtil.java:153)
>         at 
> org.apache.axis2.rpc.receivers.RPCUtil.invokeServiceClass(RPCUtil.java:188)
>         at 
> org.apache.axis2.rpc.receivers.RPCMessageReceiver.invokeBusinessLogic(RPCMessageReceiver.java:102)
>         ... 20 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