*
* @return The endpoint that owns the actual service or null.
*/
private WSEndpoint findEndpoint() {
WSEndpoint wsEndpoint = (WSEndpoint) wsContext.getMessageContext().get(JAXWSProperties.WSENDPOINT);
HttpServletRequest servletRequest = (HttpServletRequest)wsContext.getMessageContext().get(MessageContext.SERVLET_REQUEST);
if (servletRequest == null) {
// TODO: better error message
throw new WebServiceException("MEX: no ServletRequest can be found");
}
// Derive the address of the owner endpoint.
// e.g. http://localhost/foo/mex --> http://localhost/foo
WSEndpoint ownerEndpoint = null;
ServletModule module = (ServletModule) wsEndpoint.getContainer().getSPI(ServletModule.class);
String baseAddress = module.getContextPath(servletRequest);
String ownerEndpointAddress = null;
List<BoundEndpoint> boundEndpoints = module.getBoundEndpoints();
for (BoundEndpoint endpoint : boundEndpoints) {