You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ofbiz.apache.org by "Jacques Le Roux (JIRA)" <ji...@apache.org> on 2011/03/01 19:18:36 UTC

[jira] Closed: (OFBIZ-4207) Multiple responses send by SOAPEventHandler when ServiceValidationException occurs

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

Jacques Le Roux closed OFBIZ-4207.
----------------------------------

       Resolution: Fixed
    Fix Version/s: SVN trunk
                   Release Branch 10.04
         Assignee: Jacques Le Roux

Thanks Michael,

I have commented out the line, it's in trunk at r1075952,R10.04 at r1075957.

> Multiple responses send by SOAPEventHandler when ServiceValidationException occurs
> ----------------------------------------------------------------------------------
>
>                 Key: OFBIZ-4207
>                 URL: https://issues.apache.org/jira/browse/OFBIZ-4207
>             Project: OFBiz
>          Issue Type: Bug
>          Components: framework
>    Affects Versions: SVN trunk
>         Environment: Windows 7 x64, Java 1.6.0_16, OOTB Derby DB
>            Reporter: Michael Reichenbach
>            Assignee: Jacques Le Roux
>              Labels: SOAP, webservice
>             Fix For: Release Branch 10.04, SVN trunk
>
>         Attachments: SOAPEventHandler.diff
>
>   Original Estimate: 0.25h
>  Remaining Estimate: 0.25h
>
> When calling a service that was defined as "export=true" and a non-optional parameter is missing, then the SOAP-Response will look like this:
> {code:xml}
> <?xml version="1.0" encoding="utf-8"?><soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"><soapenv:Body><Response><map-Map>
>         <map-Entry>
>             <map-Key>
>                 <std-String value="errorMessage"></std-String>
>             </map-Key>
>             <map-Value>
>                 <std-String value="Problem processing the service"></std-String>
>             </map-Value>
>         </map-Entry>
>     </map-Map></Response></soapenv:Body></soapenv:Envelope><?xml version="1.0" encoding="utf-8"?><soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"><soapenv:Body><Response><map-Map>
>         <map-Entry>
>             <map-Key>
>                 <std-String value="errorMessage"></std-String>
>             </map-Key>
>             <map-Value>
>                 <std-String value="The following required parameter is missing: ..."></std-String>
>             </map-Value>
>         </map-Entry>
>     </map-Map></Response></soapenv:Body></soapenv:Envelope>
> {code}
> Problem
> =======
> The problem is, that this response is not a valid XML.
> Cause
> =====
> The cause is, that in {{SOAPEventHandler.invoke()}} the {{dispatcher.runSync()}} throws a {{ServiceValidationException}} ("The following required parameter is missing..."). This will be catched by the {{GenericServiceException}}-block, a error response will be written to the output stream (via {{sendError()}}) and an {{EventHandlerException}} will be thrown. This exception will again be catched (this time by the {{Exception}}-block and another error response will be written to the output stream.
> Solution
> ========
> I think the best solution is simply not to call {{sendError}} in the {{GenericServiceException}}-block. Then the response will look like this:
> {code:xml}
> <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
>    <soapenv:Body>
>       <Response>
>          <map-Map>
>             <map-Entry>
>                <map-Key>
>                   <std-String value="errorMessage"/>
>                </map-Key>
>                <map-Value>
>                   <std-String value="The following required parameter is missing: ..."/>
>                </map-Value>
>             </map-Entry>
>          </map-Map>
>       </Response>
>    </soapenv:Body>
> </soapenv:Envelope>
> {code}

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