Timur Akanaev
Timur Akanaev

Reputation: 43

Catch EndpointNotFound in Spring WS

How catch NoEndpointFoundException in Spring WS?

By default MessageDispatcher.dispath() throws NoEndpointFoundException in case of absence appropriate Endpoint but then WebServiceMessageReceiverObjectSupport.handleConnection() just hides the exception. In my point I should catch it by myself.

Is it good idea to add custom EndpointMapping via MessageDispatcher.getEndpointMappings().add() and throws exception in that?

Upvotes: 1

Views: 249

Answers (1)

Timur Akanaev
Timur Akanaev

Reputation: 43

I find out following solution:

@Component
@Order(Ordered.LOWEST_PRECEDENCE)
public class NoEndpointFoundEndpointMapping implements EndpointMapping {

    @Override
    public EndpointInvocationChain getEndpoint(MessageContext messageContext) throws Exception {

        throw new MyCustomException(...);
    }
}

Upvotes: 1

Related Questions