use of javax.xml.ws.handler.Handler in project nhin-d by DirectProject.
the class DirectSOAPHandlerResolverTest method testGetHandlerChain.
/**
* Test the getHandlerChain method.
*/
public void testGetHandlerChain() {
PortInfo portInfo = null;
List<Handler> output = null;
DirectSOAPHandlerResolver handler = new DirectSOAPHandlerResolver();
output = handler.getHandlerChain(portInfo);
assertNotNull("List is null", output);
assertTrue("List contains 0 elements", !output.isEmpty());
assertEquals("List contains more than expected elements", 1, output.size());
assertTrue("List does not contain expected element", output.get(0) instanceof DirectSOAPHandler);
}
use of javax.xml.ws.handler.Handler in project camel by apache.
the class CxfEndpoint method setupHandlers.
protected void setupHandlers(ClientFactoryBean factoryBean, Client client) throws Exception {
if (factoryBean instanceof JaxWsClientFactoryBean && handlers != null) {
AnnotationHandlerChainBuilder builder = new AnnotationHandlerChainBuilder();
Method m = factoryBean.getClass().getMethod("getServiceFactory");
JaxWsServiceFactoryBean sf = (JaxWsServiceFactoryBean) m.invoke(factoryBean);
@SuppressWarnings("rawtypes") List<Handler> chain = new ArrayList<Handler>(handlers);
chain.addAll(builder.buildHandlerChainFromClass(sf.getServiceClass(), sf.getEndpointInfo().getName(), sf.getServiceQName(), factoryBean.getBindingId()));
if (!chain.isEmpty()) {
ResourceManager resourceManager = getBus().getExtension(ResourceManager.class);
List<ResourceResolver> resolvers = resourceManager.getResourceResolvers();
resourceManager = new DefaultResourceManager(resolvers);
resourceManager.addResourceResolver(new WebServiceContextResourceResolver());
ResourceInjector injector = new ResourceInjector(resourceManager);
for (Handler<?> h : chain) {
if (Proxy.isProxyClass(h.getClass()) && getServiceClass() != null) {
injector.inject(h, getServiceClass());
injector.construct(h, getServiceClass());
} else {
injector.inject(h);
injector.construct(h);
}
}
}
((JaxWsEndpointImpl) client.getEndpoint()).getJaxwsBinding().setHandlerChain(chain);
}
}
use of javax.xml.ws.handler.Handler in project uavstack by uavorg.
the class JaxWSHookIT method getPort.
/**
* this is for Client Stub Programming
*
* @param t
* @param s
* @param args
* @return
*/
@SuppressWarnings({ "unchecked", "rawtypes" })
public <T> T getPort(T t, Service s, Object[] args) {
Class<T> clz = null;
if (Class.class.isAssignableFrom(args[0].getClass())) {
clz = (Class<T>) args[0];
} else if (Class.class.isAssignableFrom(args[1].getClass())) {
clz = (Class<T>) args[1];
}
if (clz == null) {
return t;
}
Binding binding = ((BindingProvider) t).getBinding();
List<Handler> handlerChain = binding.getHandlerChain();
handlerChain.add(this.handler);
binding.setHandlerChain(handlerChain);
final String wsdlLocation = getServiceURL(s);
T tProxy = JDKProxyInvokeUtil.newProxyInstance(clz.getClassLoader(), new Class[] { clz }, new JDKProxyInvokeHandler<T>(t, new ClientStubProcessor(wsdlLocation.toString(), this.handler)));
return tProxy;
}
use of javax.xml.ws.handler.Handler in project cxf by apache.
the class AnnotationHandlerChainBuilderTest method testFindHandlerChainAnnotationPerPortServiceBindingNegative.
@Test
public void testFindHandlerChainAnnotationPerPortServiceBindingNegative() {
HandlerTestImpl handlerTestImpl = new HandlerTestImpl();
AnnotationHandlerChainBuilder chainBuilder = new AnnotationHandlerChainBuilder();
QName portQName = new QName("namespacedoesntsupportyet", "SoapPortUnknown");
QName serviceQName = new QName("namespacedoesntsupportyet", "SoapServiceUnknown");
String bindingID = "BindingUnknow";
@SuppressWarnings("rawtypes") List<Handler> handlers = chainBuilder.buildHandlerChainFromClass(handlerTestImpl.getClass(), portQName, serviceQName, bindingID);
assertNotNull(handlers);
assertEquals(3, handlers.size());
}
use of javax.xml.ws.handler.Handler in project cxf by apache.
the class AnnotationHandlerChainBuilderTest method testFindHandlerChainAnnotationPerPortServiceBindingWildcard.
@Test
public void testFindHandlerChainAnnotationPerPortServiceBindingWildcard() {
HandlerTestImpl handlerTestImpl = new HandlerTestImpl();
AnnotationHandlerChainBuilder chainBuilder = new AnnotationHandlerChainBuilder();
QName portQName = new QName("http://apache.org/handler_test", "SoapPortWildcard");
QName serviceQName = new QName("http://apache.org/handler_test", "SoapServiceWildcard");
String bindingID = "BindingUnknow";
@SuppressWarnings("rawtypes") List<Handler> handlers = chainBuilder.buildHandlerChainFromClass(handlerTestImpl.getClass(), portQName, serviceQName, bindingID);
assertNotNull(handlers);
assertEquals(7, handlers.size());
}
Aggregations