ofbiz-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Michael Reichenbach (JIRA)" <j...@apache.org>
Subject [jira] Created: (OFBIZ-4207) Multiple responses send by SOAPEventHandler when ServiceValidationException occurs
Date Tue, 01 Mar 2011 09:19:39 GMT
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


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

        

Mime
View raw message