Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Fixed
-
Trunk
-
Windows 7 x64, Java 1.6.0_16, OOTB Derby DB
Description
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:
<?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>
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:
<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>