use of javax.xml.ws.handler.Handler in project cxf by apache.
the class SecondClient method newInstance.
public static SecondServiceAT newInstance() throws Exception {
URL wsdlLocation = new URL("http://localhost:8082/Service/SecondServiceAT?wsdl");
QName serviceName = new QName("http://service.ws.sample", "SecondServiceATService");
QName portName = new QName("http://service.ws.sample", "SecondServiceAT");
Service service = Service.create(wsdlLocation, serviceName);
SecondServiceAT client = service.getPort(portName, SecondServiceAT.class);
List<Handler> handlerChain = new ArrayList<>();
JaxWSTxOutboundBridgeHandler txOutboundBridgeHandler = new JaxWSTxOutboundBridgeHandler();
EnabledWSTXHandler wstxHandler = new EnabledWSTXHandler();
handlerChain.add(txOutboundBridgeHandler);
handlerChain.add(wstxHandler);
((BindingProvider) client).getBinding().setHandlerChain(handlerChain);
return client;
}
use of javax.xml.ws.handler.Handler in project cxf by apache.
the class HandlerInvocationUsingAddNumbersTest method testHandlerPostConstruct.
@Test
public void testHandlerPostConstruct() throws Exception {
URL wsdl = getClass().getResource("/wsdl/addNumbers.wsdl");
AddNumbersServiceWithAnnotation service = new AddNumbersServiceWithAnnotation(wsdl, serviceName);
AddNumbers port = service.getPort(portName, AddNumbers.class);
setAddress(port, addNumbersAddress);
@SuppressWarnings("rawtypes") List<Handler> handlerChain = ((BindingProvider) port).getBinding().getHandlerChain();
SmallNumberHandler h = (SmallNumberHandler) handlerChain.get(0);
assertTrue(h.isPostConstructInvoked());
}
use of javax.xml.ws.handler.Handler in project cxf by apache.
the class HandlerInvocationTest method testAddingUnusedHandlersThroughConfigFile.
@Test
public void testAddingUnusedHandlersThroughConfigFile() {
HandlerTestServiceWithAnnotation service1 = new HandlerTestServiceWithAnnotation(wsdl, serviceName);
HandlerTest handlerTest1 = service1.getPort(portName, HandlerTest.class);
BindingProvider bp1 = (BindingProvider) handlerTest1;
Binding binding1 = bp1.getBinding();
@SuppressWarnings("rawtypes") List<Handler> port1HandlerChain = binding1.getHandlerChain();
assertEquals(1, port1HandlerChain.size());
}
use of javax.xml.ws.handler.Handler in project cxf by apache.
the class WSSecurityClientTest method testTimestampSignEncrypt.
@Test
public void testTimestampSignEncrypt() throws Exception {
Bus b = new SpringBusFactory().createBus("org/apache/cxf/systest/ws/security/client.xml");
BusFactory.setDefaultBus(b);
final javax.xml.ws.Service svc = javax.xml.ws.Service.create(WSDL_LOC, GREETER_SERVICE_QNAME);
final Greeter greeter = svc.getPort(TIMESTAMP_SIGN_ENCRYPT_PORT_QNAME, Greeter.class);
updateAddressPort(greeter, test.getPort());
// Add a No-Op JAX-WS SoapHandler to the dispatch chain to
// verify that the SoapHandlerInterceptor can peacefully co-exist
// with the explicitly configured SAAJOutInterceptor
//
@SuppressWarnings("rawtypes") List<Handler> handlerChain = new ArrayList<>();
Binding binding = ((BindingProvider) greeter).getBinding();
TestOutHandler handler = new TestOutHandler();
handlerChain.add(handler);
binding.setHandlerChain(handlerChain);
greeter.sayHi();
assertTrue("expected Handler.handleMessage() to be called", handler.handleMessageCalledOutbound);
assertFalse("expected Handler.handleFault() not to be called", handler.handleFaultCalledOutbound);
((java.io.Closeable) greeter).close();
b.shutdown(true);
BusFactory.setDefaultBus(getStaticBus());
}
use of javax.xml.ws.handler.Handler in project uavstack by uavorg.
the class JaxWSHookIT method createDispatch.
@SuppressWarnings("rawtypes")
public Dispatch createDispatch(Dispatch d, Service s, Object[] args) {
Binding binding = ((BindingProvider) d).getBinding();
List<Handler> handlerChain = binding.getHandlerChain();
handlerChain.add(this.handler);
binding.setHandlerChain(handlerChain);
final String wsdlLocation = getServiceURL(s);
Dispatch tProxy = JDKProxyInvokeUtil.newProxyInstance(this.getClass().getClassLoader(), new Class[] { Dispatch.class }, new JDKProxyInvokeHandler<Dispatch>(d, new DispatchProcessor(wsdlLocation.toString(), this.handler)));
return tProxy;
}
Aggregations