[SWS-777] SoapFaultMappingExceptionResolver not handling exception Created: 22/May/12  Updated: 28/Aug/12  Resolved: 29/May/12

Status: Resolved
Project: Spring Web Services
Component/s: Core
Affects Version/s: 2.1 RC1
Fix Version/s: 2.1 GA

Type: Bug Priority: Major
Reporter: Gordon Dickens Assignee: Arjen Poutsma
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: 2h 1m
Original Estimate: Not Specified

Issue Links:
Duplicate
is duplicated by SWS-793 Extending SoapFaultAnnotationExceptio... Resolved
Relate
relates to SWS-772 <sws:annotation-driven/> should regis... Resolved

 Description   

Given the following configuration:

    <bean class="org.springframework.ws.soap.server.endpoint.SoapFaultMappingExceptionResolver">
        <property name="exceptionMappings">
            <value>
                org.springframework.dao.EmptyResultDataAccessException=CLIENT,Entity not found
            </value>
        </property>
        <property name="defaultFault" value="SERVER"/>
    </bean>

The result in 2.0.5 is correct:

<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
        <SOAP-ENV:Header/>
        <SOAP-ENV:Body>
            <SOAP-ENV:Fault>
                <faultcode>SOAP-ENV:Client</faultcode>
                <faultstring xml:lang="en">Entity not found</faultstring>
            </SOAP-ENV:Fault>
        </SOAP-ENV:Body>
    </SOAP-ENV:Envelope>

The result in 2.1.0.RC1 is INCORRECT:

<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
    <SOAP-ENV:Header/>
    <SOAP-ENV:Body>
        <SOAP-ENV:Fault>
            <faultcode>SOAP-ENV:Server</faultcode>
            <faultstring xml:lang="en">Incorrect result size: expected 1, actual 0</faultstring>
        </SOAP-ENV:Fault>
    </SOAP-ENV:Body>
</SOAP-ENV:Envelope>



 Comments   
Comment by Arjen Poutsma [ 23/May/12 ]

Hmm, that's strange. Do you also use <sws:annotation-driven>, by any chance? There were some changes to that in 2.1.

Also: does the EmptyResultDataAccessException have a @SoapFault annotation, perhaps?

Comment by Arjen Poutsma [ 23/May/12 ]

Added formatting.

Comment by Gordon Dickens [ 23/May/12 ]

Arjen,

Yes, I have configured <ws:annotation-driven/>

I am using the examples from the Enterprise Integration with Spring course that I am teaching this week. I use those to run through the upcoming versions of SWS, SI & SB to determine any api changes to share with the students.

Thanks,
Gordon Dickens

@gdickens
linkedin.com/in/gordondickens
Blog: technophile.gordondickens.com

Comment by Arjen Poutsma [ 29/May/12 ]

Gordon,

Can you elaborate which example(s) of the EI course show this problem? That makes it a bit easier to duplicate.

EDIT: never mind, I found it myself in the ws-2 lab of the course.

Thanks,

Arjen

Comment by Arjen Poutsma [ 29/May/12 ]

It seems like SWS-772 was the culprit here. See my last comment on that issue for the reason.

For the ws-2 lab, it seems like adding an ordered property will fix it, like so:

 
<bean class="org.springframework.ws.soap.server.endpoint.SoapFaultMappingExceptionResolver">
    <property name="order" value="0"/>
    <property name="exceptionMappings">
        <value>
            org.springframework.dao.EmptyResultDataAccessException=CLIENT,Entity not found
        </value>
    </property>
    <property name="defaultFault" value="SERVER"/>
</bean>

Generated at Mon Dec 11 18:59:19 UTC 2017 using JIRA 6.4.14#64029-sha1:ae256fe0fbb912241490ff1cecfb323ea0905ca5.