[jira] [Closed] (OFBIZ-745) Empty response send by SOAPEventhandler when Exception occurs

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

[jira] [Closed] (OFBIZ-745) Empty response send by SOAPEventhandler when Exception occurs

Nicolas Malin (Jira)

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

Jacques Le Roux closed OFBIZ-745.
---------------------------------

       Resolution: Won't Fix
    Fix Version/s: SVN trunk
         Assignee: Jacques Le Roux

This has been enhanced recently, see OFBIZ-4207, OFBIZ-4218

> Empty response send by SOAPEventhandler when Exception occurs
> -------------------------------------------------------------
>
>                 Key: OFBIZ-745
>                 URL: https://issues.apache.org/jira/browse/OFBIZ-745
>             Project: OFBiz
>          Issue Type: Bug
>          Components: framework
>    Affects Versions: SVN trunk
>         Environment: SUSE Linux 10.1 & MySQL 5.0.18
>            Reporter: Michael Imhof
>            Assignee: Jacques Le Roux
>             Fix For: SVN trunk
>
>         Attachments: patch745.txt
>
>
> Calling a OfBiz SOAP Service with wrong arguments returns an "empty response"
> instead of a Fault SOAP envelope.
> Class:
> =====
> SOAPEventhandler.java
> Solution
> =======
> New sendError(..) methods:
>     private void sendError(HttpServletResponse res,  String errorMsg) {  
>         sendError(res, new AxisFault(errorMsg));
>     }
>    
>     private void sendError(HttpServletResponse res,  Exception e) {  
>         AxisFault axisFault = null;
>         if (e instanceof AxisFault) {
>             axisFault = (AxisFault)e;
>         } else {
>             axisFault = AxisFault.makeFault(e);
>         }
>        
>         SOAPEnvelope env = new SOAPEnvelope();
>         try  {
>             SOAPBody body = env.getBody();
>             SOAPFault fault = body.addFault();
>             fault.setFaultString(axisFault.getFaultString());
>             fault.setFaultCode(axisFault.getFaultCode().getLocalPart());
>             fault.setFaultActor(axisFault.getFaultActor());
>             env.setEncodingStyle(Constants.URI_LITERAL_ENC);
>             Message msg = new Message(env);
>            
>             msg.writeTo(res.getOutputStream());
>             res.flushBuffer();
>         } catch(SOAPException se) {
>             Debug.logWarning(se, "SOAP response not generated", module);
>         } catch(IOException ie) {
>             Debug.logWarning(ie, "SOAP response not generated", module);
>         }
>     }

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira