String lang = request.getLocale().getLanguage();
GetBusinessDetail getBusinessDetail = new GetBusinessDetail();
getBusinessDetail.setAuthInfo(authToken);
getBusinessDetail.getBusinessKey().add(businessKey);
InquiryResponse response = new InquiryResponse();
logger.debug("BusinessDetail " + getBusinessDetail + " sending businessDetail request..");
try {
Transport transport = WebHelper.getTransport(session.getServletContext());
UDDIInquiryPortType inquiryService = transport.getUDDIInquiryService();
BusinessDetail businessDetail = inquiryService.getBusinessDetail(getBusinessDetail);
for (BusinessEntity businessEntity : businessDetail.getBusinessEntity()) {
Business business = new Business(
businessEntity.getBusinessKey(),
EntityForLang.getName(businessEntity.getName(),lang).getValue(),
EntityForLang.getDescription(businessEntity.getDescription(),lang).getValue());
if (businessEntity.getBusinessServices()!=null) {
for (BusinessService businessService : businessEntity.getBusinessServices().getBusinessService()) {
Service service = new Service(
businessService.getServiceKey(),
EntityForLang.getName(businessService.getName(),lang).getValue(),
EntityForLang.getDescription(businessService.getDescription(),lang).getValue());
business.getServices().add(service);
}
}
//for (Contact contact : businessEntity.getContacts().getContact()) {
//contact.get
//}
response.setBusiness(business);
}
response.setSuccess(true);
} 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;
}