use of javax.xml.ws.handler.Handler in project cxf by apache.
the class AnnotationHandlerChainBuilderTest method testFindHandlerChainAnnotationPerPortServiceBinding.
@Test
public void testFindHandlerChainAnnotationPerPortServiceBinding() {
HandlerTestImpl handlerTestImpl = new HandlerTestImpl();
AnnotationHandlerChainBuilder chainBuilder = new AnnotationHandlerChainBuilder();
QName portQName = new QName("namespacedoesntsupportyet", "SoapPort1");
QName serviceQName = new QName("namespacedoesntsupportyet", "SoapService1");
String bindingID = "http://schemas.xmlsoap.org/wsdl/soap/http";
@SuppressWarnings("rawtypes") List<Handler> handlers = chainBuilder.buildHandlerChainFromClass(handlerTestImpl.getClass(), portQName, serviceQName, bindingID);
assertNotNull(handlers);
assertEquals(5, handlers.size());
}
use of javax.xml.ws.handler.Handler in project OpenOLAT by OpenOLAT.
the class ViteroManager method checkConnection.
public boolean checkConnection(final String url, final String login, final String password, final int customerId) throws VmsNotAvailableException {
try {
LicenceService ss = new LicenceService();
ss.setHandlerResolver(new HandlerResolver() {
@SuppressWarnings("rawtypes")
@Override
public List<Handler> getHandlerChain(PortInfo portInfo) {
List<Handler> handlerList = new ArrayList<Handler>();
handlerList.add(new ViteroSecurityHandler(login, password));
return handlerList;
}
});
Licence port = ss.getLicenceSoap11();
String endPoint = UriBuilder.fromUri(url).path("services").path("LicenseService").build().toString();
((BindingProvider) port).getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, endPoint);
GetModulesForCustomerRequest request = new GetModulesForCustomerRequest();
request.setCustomerid(customerId);
Modulestype modulesType = port.getModulesForCustomer(request);
return modulesType != null;
} catch (SOAPFaultException f) {
ErrorCode code = handleAxisFault(f);
switch(code) {
case unsufficientRights:
log.error("Unsufficient rights", f);
break;
default:
logAxisError("Cannot check connection", f);
}
return false;
} catch (WebServiceException e) {
if (e.getCause() instanceof ConnectException) {
throw new VmsNotAvailableException();
}
log.warn("Error checking connection", e);
return false;
}
}
use of javax.xml.ws.handler.Handler in project narayana by jbosstm.
the class ATInteropClient 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) {
ParticipantService service = getParticipantService();
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 narayana by jbosstm.
the class BAInteropClient 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) {
ParticipantService service = getParticipantService();
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 no longer have to add the JaxWS WSAddressingClientHandler because we can specify the WSAddressing feature
customHandlerChain.add(new WSAddressingClientHandler());
*/
/*
* 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());
bindingProvider.getBinding().setHandlerChain(customHandlerChain);
Map<String, Object> requestContext = bindingProvider.getRequestContext();
map.setAction(action);
AddressingHelper.configureRequestContext(requestContext, map, to, action);
return port;
}
use of javax.xml.ws.handler.Handler in project narayana by jbosstm.
the class TestServiceBAClient method getClientWithManuallyAddedHandler.
public static TestServiceBA getClientWithManuallyAddedHandler() throws MalformedURLException {
TestServiceBAClient client = new TestServiceBAClient();
Service service = Service.create(new URL(WSDL_URL), SERVICE_NAME);
client.testService = service.getPort(PORT_NAME, TestServiceBA.class);
BindingProvider bindingProvider = (BindingProvider) client.testService;
@SuppressWarnings("rawtypes") List<Handler> handlers = new ArrayList<Handler>(1);
handlers.add(new JaxWSHeaderContextProcessor());
bindingProvider.getBinding().setHandlerChain(handlers);
return client;
}
Aggregations