use of javax.xml.ws.handler.Handler in project narayana by jbosstm.
the class TestClient method init.
/**
* Initialise the servlet.
*
* @param config The servlet configuration.
*/
public void init(final ServletConfig config) throws ServletException {
try {
URL wsdlLocation = new URL("http://" + getLocalHost() + ":8080/txbridge-inbound-tests-service/TestServiceImpl?wsdl");
QName serviceName = new QName("http://client.inbound.tests.txbridge.jbossts.jboss.org/", "TestServiceImplService");
Service service = Service.create(wsdlLocation, serviceName);
testService = service.getPort(TestService.class);
BindingProvider bindingProvider = (BindingProvider) testService;
List<Handler> handlers = new ArrayList<Handler>(1);
handlers.add(new JaxWSHeaderContextProcessor());
bindingProvider.getBinding().setHandlerChain(handlers);
context = config.getServletContext();
} catch (Exception e) {
throw new ServletException(e);
}
}
use of javax.xml.ws.handler.Handler in project narayana by jbosstm.
the class InteropClient method getParticipantPort.
// don't think we ever need this as we get a registration port from the endpoint ref returned by
// the activation port request
public static ParticipantPortType getParticipantPort(MAP map, String action) {
Sc007Service service = getSc007Service();
ParticipantPortType port = service.getPort(ParticipantPortType.class, new AddressingFeature(true, true));
BindingProvider bindingProvider = (BindingProvider) port;
String to = map.getTo();
List<Handler> customHandlerChain = new ArrayList<Handler>();
/*
* we need to add the coordination context handler in the case where we are passing a
* coordination context via a header element
*/
customHandlerChain.add(new CoordinationContextHandler());
/*
* we no longer have to add the JaxWS WSAddressingClientHandler because we can specify the WSAddressing feature
customHandlerChain.add(new WSAddressingClientHandler());
*/
bindingProvider.getBinding().setHandlerChain(customHandlerChain);
Map<String, Object> requestContext = bindingProvider.getRequestContext();
map.setAction(action);
map.setFrom(getInitiator());
AddressingHelper.configureRequestContext(requestContext, map, to, action);
return port;
}
use of javax.xml.ws.handler.Handler in project nimbus by nimbus-org.
the class WsPortFactoryService method startService.
public void startService() throws Exception {
if (wsServiceFactoryName == null) {
throw new IllegalArgumentException("WsServiceFactoryName must be specified.");
}
if (portAliasProp == null) {
throw new IllegalArgumentException("portAliasProp must be specified.");
}
if (handlerServiceNames != null) {
for (int i = 0; i < handlerServiceNames.length; i++) {
try {
Handler handler = (Handler) ServiceManagerFactory.getServiceObject(handlerServiceNames[i]);
handlerList.add(handler);
} catch (ClassCastException e) {
throw new IllegalArgumentException(handlerServiceNames[i] + " is not instanceof Handler." + e);
}
}
}
WsServiceFactory wsServiceFactory = (WsServiceFactory) ServiceManagerFactory.getServiceObject(wsServiceFactoryName);
nameSpace = wsServiceFactory.getNameSpace();
wsService = wsServiceFactory.getService();
}
use of javax.xml.ws.handler.Handler in project scout.rt by eclipse.
the class PortProducer method proxyHandler.
/**
* Proxies the given {@link Handler} to run on behalf of a {@link RunContext}, if the handler is annotated with
* {@link RunWithRunContext}.
*/
protected Handler<? extends MessageContext> proxyHandler(final Handler<? extends MessageContext> handler) {
final RunWithRunContext handleWithRunContext = handler.getClass().getAnnotation(RunWithRunContext.class);
if (handleWithRunContext == null) {
return handler;
}
final RunContextProducer runContextProducer = BEANS.get(handleWithRunContext.value());
return (Handler<?>) Proxy.newProxyInstance(handler.getClass().getClassLoader(), handler.getClass().getInterfaces(), new InvocationHandler() {
@Override
public Object invoke(final Object proxy, final Method method, final Object[] args) throws Throwable {
if (PROXIED_HANDLER_METHODS.contains(method)) {
return runContextProducer.produce(Subject.getSubject(AccessController.getContext())).call(new Callable<Object>() {
@Override
public Object call() throws Exception {
return method.invoke(handler, args);
}
}, DefaultExceptionTranslator.class);
} else {
return method.invoke(handler, args);
}
}
});
}
use of javax.xml.ws.handler.Handler in project scout.rt by eclipse.
the class ServicePool method proxyHandler.
/**
* Proxies the given {@link Handler} to run on behalf of a {@link RunContext}, if the handler is annotated with
* {@link RunWithRunContext}.
*/
protected Handler<? extends MessageContext> proxyHandler(final Handler<? extends MessageContext> handler) {
final RunWithRunContext handleWithRunContext = handler.getClass().getAnnotation(RunWithRunContext.class);
if (handleWithRunContext == null) {
return handler;
}
final RunContextProducer runContextProducer = BEANS.get(handleWithRunContext.value());
return (Handler<?>) Proxy.newProxyInstance(handler.getClass().getClassLoader(), handler.getClass().getInterfaces(), new InvocationHandler() {
@Override
public Object invoke(final Object proxy, final Method method, final Object[] args) throws Throwable {
if (PROXIED_HANDLER_METHODS.contains(method)) {
return runContextProducer.produce(Subject.getSubject(AccessController.getContext())).call(new Callable<Object>() {
@Override
public Object call() throws Exception {
return method.invoke(handler, args);
}
}, DefaultExceptionTranslator.class);
} else {
return method.invoke(handler, args);
}
}
});
}
Aggregations