use of de.vitero.ViteroSecurityHandler in project openolat by klemens.
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 de.vitero.ViteroSecurityHandler 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;
}
}
Aggregations