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/22 09:14:05 UTC

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

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