nealcs
Jun 24th, 2010, 09:20 AM
Hi all. I'm developing a SOAP web service using Spring-WS (1.5.9). I've been trying to figure out how to convert server-side exceptions to SOAP faults, and have had limited success.
Here's my exception resolver definition:
<bean class="org.springframework.ws.soap.server.endpoint.SoapFa ultMappingExceptionResolver">
<property name="defaultFault" value="SERVER" />
<property name="exceptionMappings">
<props>
<prop key="Exception">SERVER,Internal server error</prop>
</props>
</property>
</bean>
If any exception occurs after the request has been handed off to the annotated endpoint, then this exception resolver works as expected. What I'm trying to figure out is how to handle exceptions that occur before the request is handed off to the endpoint.
For example, if the XML is malformed the declared exception resolver doesn't get invoked. Instead the following is output in the response:
Error 500: Request processing failed - nested exception is org.springframework.ws.soap.saaj.SaajSoapMessageEx ception: Could not access envelope....
Similarly, if I make a request for an endpoint that doesn't exist I get an HTTP 404 status (with an empty response), but no SOAP fault.
I've debugged MessageDispatcher but am still struggling with how to tell Spring to handle these cases. Any help is greatly appreciated. :)
Thanks,
--Neal
Here's my exception resolver definition:
<bean class="org.springframework.ws.soap.server.endpoint.SoapFa ultMappingExceptionResolver">
<property name="defaultFault" value="SERVER" />
<property name="exceptionMappings">
<props>
<prop key="Exception">SERVER,Internal server error</prop>
</props>
</property>
</bean>
If any exception occurs after the request has been handed off to the annotated endpoint, then this exception resolver works as expected. What I'm trying to figure out is how to handle exceptions that occur before the request is handed off to the endpoint.
For example, if the XML is malformed the declared exception resolver doesn't get invoked. Instead the following is output in the response:
Error 500: Request processing failed - nested exception is org.springframework.ws.soap.saaj.SaajSoapMessageEx ception: Could not access envelope....
Similarly, if I make a request for an endpoint that doesn't exist I get an HTTP 404 status (with an empty response), but no SOAP fault.
I've debugged MessageDispatcher but am still struggling with how to tell Spring to handle these cases. Any help is greatly appreciated. :)
Thanks,
--Neal