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

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

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

Nicolas Malin (Jira)
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.

Reply | Threaded
Open this post in threaded view
|

[jira] Updated: (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 ]

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.

Reply | Threaded
Open this post in threaded view
|

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

Nicolas Malin (Jira)
In reply to this post by Nicolas Malin (Jira)

    [ 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.