class MessageDispatcher implements WebServiceMessageReceiver, BeanNameAware, ApplicationContextAware {

	protected EndpointInvocationChain getEndpoint(MessageContext messageContext) throws Exception {
		for (EndpointMapping endpointMapping : getEndpointMappings()) {
			EndpointInvocationChain endpoint = endpointMapping.getEndpoint(messageContext);
			if (endpoint != null) {
				if (logger.isDebugEnabled()) {
					logger.debug(
							"Endpoint mapping [" + endpointMapping + "] maps request to endpoint [" + endpoint.getEndpoint() + "]");
				}
				return endpoint;
			} else if (logger.isDebugEnabled()) {
				logger.debug("Endpoint mapping [" + endpointMapping + "] has no mapping for request");
			}
		}
		return null;
	}

	public  MessageDispatcher();

}