GetRegisteredInfo getRegistrationInfo = new GetRegisteredInfo();
getRegistrationInfo.setAuthInfo(authToken);
getRegistrationInfo.setInfoSelection(InfoSelection.ALL);
PublicationResponse response = new PublicationResponse();
logger.debug("GetRegistrationInfo " + getRegistrationInfo + " sending get Busineses request..");
List<Business> businesses = new ArrayList<Business>();
try {
Transport transport = WebHelper.getTransport(session.getServletContext());
UDDIPublicationPortType publicationService = transport.getUDDIPublishService();
RegisteredInfo info = publicationService.getRegisteredInfo(getRegistrationInfo);
for (BusinessInfo businessInfo : info.getBusinessInfos().getBusinessInfo()) {
Business business = new Business(
businessInfo.getBusinessKey(),
EntityForLang.getName(businessInfo.getName(),lang).getValue(),
EntityForLang.getDescription(businessInfo.getDescription(),lang).getValue());
List<Service> services = new ArrayList<Service>();
for (ServiceInfo serviceInfo : businessInfo.getServiceInfos().getServiceInfo()) {
Service service = new Service(
serviceInfo.getServiceKey(),
EntityForLang.getName(serviceInfo.getName(), lang).getValue());
services.add(service);
}
business.setServices(services);
businesses.add(business);
}
response.setSuccess(true);
response.setBusinesses(businesses);
} catch (Exception e) {
logger.error("Could not obtain token. " + e.getMessage(), e);
response.setSuccess(false);
response.setMessage(e.getMessage());
response.setErrorCode("102");
} catch (Throwable t) {
logger.error("Could not obtain token. " + t.getMessage(), t);
response.setSuccess(false);
response.setMessage(t.getMessage());
response.setErrorCode("102");
}
return response;
}