You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ofbiz.apache.org by "Michael Imhof (JIRA)" <ji...@apache.org> on 2007/02/21 13:33:10 UTC

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

Empty response send by SOAPEventhandler when Exception occurs
-------------------------------------------------------------

                 Key: OFBIZ-745
                 URL: https://issues.apache.org/jira/browse/OFBIZ-745
             Project: OFBiz (The Open for Business Project)
          Issue Type: Bug
          Components: framework
    Affects Versions: SVN trunk
         Environment: SUSE Linux 10.1 & MySQL 5.0.18
            Reporter: Michael Imhof


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.
-
You can reply to this email to add a comment to the issue online.


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

Posted by "Jacopo Cappellato (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/OFBIZ-745?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12527696 ] 

Jacopo Cappellato commented on OFBIZ-745:
-----------------------------------------

Is there anyone interested in this patch and willing to use it / test it and review it?


> 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
>         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.
-
You can reply to this email to add a comment to the issue online.


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

Posted by "Michael Imhof (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/OFBIZ-745?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Michael Imhof updated OFBIZ-745:
--------------------------------

    Attachment: patch745.txt

> Empty response send by SOAPEventhandler when Exception occurs
> -------------------------------------------------------------
>
>                 Key: OFBIZ-745
>                 URL: https://issues.apache.org/jira/browse/OFBIZ-745
>             Project: OFBiz (The Open for Business Project)
>          Issue Type: Bug
>          Components: framework
>    Affects Versions: SVN trunk
>         Environment: SUSE Linux 10.1 & MySQL 5.0.18
>            Reporter: Michael Imhof
>         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.
-
You can reply to this email to add a comment to the issue online.