use of javax.xml.ws.WebServiceException in project Payara by payara.
the class ServletWebServiceDelegate method postInit.
@Override
public void postInit(ServletConfig servletConfig) throws ServletException {
String servletName = "unknown";
try {
WebServiceContractImpl wscImpl = WebServiceContractImpl.getInstance();
ComponentEnvManager compEnvManager = wscImpl.getComponentEnvManager();
JndiNameEnvironment jndiNameEnv = compEnvManager.getCurrentJndiNameEnvironment();
WebBundleDescriptor webBundle = null;
if (jndiNameEnv != null && jndiNameEnv instanceof WebBundleDescriptor) {
webBundle = ((WebBundleDescriptor) jndiNameEnv);
} else {
throw new WebServiceException("Cannot intialize the JAXRPCServlet for " + jndiNameEnv);
}
ClassLoader classLoader = Thread.currentThread().getContextClassLoader();
servletName = servletConfig.getServletName();
WebComponentDescriptor webComponent = webBundle.getWebComponentByCanonicalName(servletName);
if (webComponent != null) {
WebServicesDescriptor webServices = webBundle.getWebServices();
Collection endpoints = webServices.getEndpointsImplementedBy(webComponent);
// Only 1 endpoint per servlet is supported, even though
// data structure implies otherwise.
endpoint_ = (WebServiceEndpoint) endpoints.iterator().next();
registerEndpoint(classLoader);
// security
if (secServ != null) {
SystemHandlerDelegate securityHandlerDelegate = secServ.getSecurityHandler(endpoint_);
if (securityHandlerDelegate != null) {
rpcDelegate_.setSystemHandlerDelegate(securityHandlerDelegate);
// need to invoke the endpoint lifecylcle
endpointImpl_ = JAXRPCEndpointImpl.class.cast(wsEngine_.createHandler(securityHandlerDelegate, endpoint_));
rpcDelegate_.setSystemHandlerDelegate(endpointImpl_);
}
}
} else {
throw new ServletException(servletName + " not found");
}
} catch (Throwable t) {
String msg = MessageFormat.format(logger.getResourceBundle().getString(LogUtils.SERVLET_ENDPOINT_FAILURE), servletName);
logger.log(Level.WARNING, msg, t);
throw new ServletException(t);
}
}
use of javax.xml.ws.WebServiceException in project Payara by payara.
the class WSServletContextListener method contextInitialized.
@Override
public void contextInitialized(ServletContextEvent sce) {
WebServiceContractImpl wscImpl = WebServiceContractImpl.getInstance();
ComponentEnvManager compEnvManager = wscImpl.getComponentEnvManager();
JndiNameEnvironment jndiNameEnv = compEnvManager.getCurrentJndiNameEnvironment();
WebBundleDescriptor webBundle = null;
if (jndiNameEnv != null && jndiNameEnv instanceof BundleDescriptor && ((BundleDescriptor) jndiNameEnv).getModuleType().equals(DOLUtils.warType())) {
webBundle = ((WebBundleDescriptor) jndiNameEnv);
} else {
throw new WebServiceException("Cannot intialize the JAXWSServlet for " + jndiNameEnv);
}
contextRoot = webBundle.getContextRoot();
WebServicesDescriptor webServices = webBundle.getWebServices();
try {
for (WebServiceEndpoint endpoint : webServices.getEndpoints()) {
registerEndpoint(endpoint, sce.getServletContext());
}
} catch (Throwable t) {
// TODO Fix Rama
logger.log(Level.WARNING, LogUtils.DEPLOYMENT_FAILED, t);
sce.getServletContext().removeAttribute("ADAPTER_LIST");
throw new RuntimeException("Servlet web service endpoint '" + "' failure", t);
}
}
use of javax.xml.ws.WebServiceException in project Payara by payara.
the class WebServiceEjbEndpointRegistry method registerEndpoint.
@Override
public void registerEndpoint(WebServiceEndpoint webserviceEndpoint, EjbEndpointFacade ejbContainer, Object servant, Class tieClass) {
String uri = null;
EjbRuntimeEndpointInfo endpoint = createEjbEndpointInfo(webserviceEndpoint, ejbContainer, servant, tieClass);
synchronized (webServiceEjbEndpoints) {
String uriRaw = endpoint.getEndpointAddressUri();
if (uriRaw != null) {
uri = (uriRaw.charAt(0) == '/') ? uriRaw.substring(1) : uriRaw;
if (webServiceEjbEndpoints.containsKey(uri)) {
logger.log(Level.SEVERE, LogUtils.ENTERPRISE_WEBSERVICE_DUPLICATE_SERVICE, uri);
}
webServiceEjbEndpoints.put(uri, endpoint);
regenerateEjbContextRoots();
if (adapterListMap.get(uri) == null) {
ServletAdapterList list = new ServletAdapterList();
adapterListMap.put(uri, list);
}
} else
throw new WebServiceException(logger.getResourceBundle().getString(LogUtils.EJB_ENDPOINTURI_ERROR));
}
// notify monitoring layers that a new endpoint is being created.
WebServiceEngineImpl engine = WebServiceEngineImpl.getInstance();
if (hasMappingFileUri(endpoint.getEndpoint())) {
engine.createHandler((com.sun.xml.rpc.spi.runtime.SystemHandlerDelegate) null, endpoint.getEndpoint());
} else {
engine.createHandler(endpoint.getEndpoint());
}
}
use of javax.xml.ws.WebServiceException in project Payara by payara.
the class WebServiceReferenceManagerImpl method getWebServiceFeatureBean.
private WebServiceFeature getWebServiceFeatureBean(Annotation a) {
WebServiceFeatureAnnotation wsfa = a.annotationType().getAnnotation(WebServiceFeatureAnnotation.class);
Class<? extends WebServiceFeature> beanClass = wsfa.bean();
WebServiceFeature bean;
Constructor ftrCtr = null;
String[] paramNames = null;
for (Constructor con : beanClass.getConstructors()) {
FeatureConstructor ftrCtrAnn = (FeatureConstructor) con.getAnnotation(FeatureConstructor.class);
if (ftrCtrAnn != null) {
if (ftrCtr == null) {
ftrCtr = con;
paramNames = ftrCtrAnn.value();
} else {
throw new WebServiceException(ModelerMessages.RUNTIME_MODELER_WSFEATURE_MORETHANONE_FTRCONSTRUCTOR(a, beanClass));
}
}
}
if (ftrCtr == null) {
throw new WebServiceException(ModelerMessages.RUNTIME_MODELER_WSFEATURE_NO_FTRCONSTRUCTOR(a, beanClass));
}
if (ftrCtr.getParameterTypes().length != paramNames.length) {
throw new WebServiceException(ModelerMessages.RUNTIME_MODELER_WSFEATURE_ILLEGAL_FTRCONSTRUCTOR(a, beanClass));
}
try {
Object[] params = new Object[paramNames.length];
for (int i = 0; i < paramNames.length; i++) {
Method m = a.annotationType().getDeclaredMethod(paramNames[i]);
params[i] = m.invoke(a);
}
bean = (WebServiceFeature) ftrCtr.newInstance(params);
} catch (Exception e) {
throw new WebServiceException(e);
}
return bean;
}
use of javax.xml.ws.WebServiceException in project Payara by payara.
the class JAXWSServlet method init.
public void init(ServletConfig servletConfig) throws ServletException {
String servletName = "unknown";
try {
super.init(servletConfig);
wsEngine_ = WebServiceEngineImpl.getInstance();
// Register endpoints here
WebServiceContractImpl wscImpl = WebServiceContractImpl.getInstance();
ComponentEnvManager compEnvManager = wscImpl.getComponentEnvManager();
JndiNameEnvironment jndiNameEnv = compEnvManager.getCurrentJndiNameEnvironment();
WebBundleDescriptor webBundle = null;
if (jndiNameEnv != null && jndiNameEnv instanceof WebBundleDescriptor) {
webBundle = ((WebBundleDescriptor) jndiNameEnv);
} else {
throw new WebServiceException("Cannot intialize the JAXWSServlet for " + jndiNameEnv);
}
servletName = servletConfig.getServletName();
contextRoot = webBundle.getContextRoot();
WebComponentDescriptor webComponent = webBundle.getWebComponentByCanonicalName(servletName);
if (webComponent != null) {
WebServicesDescriptor webServices = webBundle.getWebServices();
Collection<WebServiceEndpoint> endpoints = webServices.getEndpointsImplementedBy(webComponent);
// Only 1 endpoint per servlet is supported, even though
// data structure implies otherwise.
endpoint = endpoints.iterator().next();
} else {
throw new ServletException(servletName + " not found");
}
// need to invoke the endpoint lifecylcle
if (!(HTTPBinding.HTTP_BINDING.equals(endpoint.getProtocolBinding()))) {
// Doing this so that restful service are not monitored
wsEngine_.createHandler(endpoint);
}
if (endpoint.getWsdlExposed() != null) {
wsdlExposed = Boolean.parseBoolean(endpoint.getWsdlExposed());
}
// For web components, this will be relative to the web app
// context root. Make sure there is a leading slash.
String uri = endpoint.getEndpointAddressUri();
urlPattern = uri.startsWith("/") ? uri : "/" + uri;
} catch (Throwable t) {
String msg = MessageFormat.format(logger.getResourceBundle().getString(LogUtils.SERVLET_ENDPOINT_FAILURE), servletName);
logger.log(Level.WARNING, msg, t);
throw new ServletException(t);
}
requestTracing = org.glassfish.internal.api.Globals.getDefaultHabitat().getService(RequestTracingService.class);
}
Aggregations