public static org.uddi.api_v3.BusinessService MapService(org.uddi.api_v2.BusinessService be) { if (be == null) { return null; } BusinessService item = new org.uddi.api_v3.BusinessService(); item.setBusinessKey(be.getBusinessKey()); item.setServiceKey(be.getServiceKey()); item.getName().addAll(MapName(be.getName())); if (be.getBindingTemplates() != null && !be.getBindingTemplates().getBindingTemplate().isEmpty()) { item.setBindingTemplates(new BindingTemplates()); item.getBindingTemplates().getBindingTemplate().addAll(MapBinding(be.getBindingTemplates().getBindingTemplate())); } item.setCategoryBag(MapCategoryBag(be.getCategoryBag())); item.getDescription().addAll(MapDescription(be.getDescription())); return item; }
public static org.uddi.api_v2.BusinessService MapService(org.uddi.api_v3.BusinessService be) { if (be == null) { return null; } BusinessService item = new org.uddi.api_v2.BusinessService(); item.setCategoryBag(MapCategoryBag(be.getCategoryBag())); item.getDescription().addAll(MapDescription(be.getDescription())); item.setBusinessKey(be.getBusinessKey()); item.setServiceKey(be.getServiceKey()); item.getName().addAll(MapName(be.getName())); if (be.getBindingTemplates() != null && !be.getBindingTemplates().getBindingTemplate().isEmpty()) { item.setBindingTemplates(new BindingTemplates()); item.getBindingTemplates().getBindingTemplate().addAll(MapBinding(be.getBindingTemplates().getBindingTemplate())); } return item; }
@Override public void validateValuesBusinessService(List<BusinessService> items, String xpath) throws DispositionReportFaultMessage { if (items == null) { return; } for (int i = 0; i < items.size(); i++) { if (items.get(i).getCategoryBag() != null) { //No specific rules for business services } if (items.get(i).getBindingTemplates() != null) { validateValuesBindingTemplate(items.get(i).getBindingTemplates().getBindingTemplate(), xpath + "businessService(" + i + ").bindingTemplates."); } } }
public static void mapBusinessService(org.apache.juddi.model.BusinessService modelBusinessService, org.uddi.api_v3.BusinessService apiBusinessService) throws DispositionReportFaultMessage { apiBusinessService.setBusinessKey(modelBusinessService.getBusinessEntity().getEntityKey()); apiBusinessService.setServiceKey(modelBusinessService.getEntityKey()); mapServiceNames(modelBusinessService.getServiceNames(), apiBusinessService.getName()); mapServiceDescriptions(modelBusinessService.getServiceDescrs(), apiBusinessService.getDescription()); mapBindingTemplates(modelBusinessService.getBindingTemplates(), apiBusinessService.getBindingTemplates(), apiBusinessService); apiBusinessService.setCategoryBag(mapCategoryBag(modelBusinessService.getCategoryBag(), apiBusinessService.getCategoryBag())); mapSignature(modelBusinessService.getSignatures(), apiBusinessService.getSignature()); }
private void validateSignaturesService(BusinessService businessService, Configuration config) throws FatalErrorException { boolean shouldcheck = config.getBoolean(Property.JUDDI_REJECT_ENTITIES_WITH_INVALID_SIG_ENABLE, false); initDigSig(config); if (shouldcheck && !businessService.getSignature().isEmpty() && ds != null) { AtomicReference<String> outmsg = new AtomicReference<String>(); boolean ok = ds.verifySignedUddiEntity(businessService, outmsg); if (!ok) { throw new FatalErrorException(new ErrorMessage("errors.digitalsignature.validationfailure", businessService.getServiceKey() + " " + outmsg.get())); } } }
String entityKey = businessService.getServiceKey(); if (entityKey != null && entityKey.length() > 0) { businessService.setServiceKey(entityKey); String parentKey = businessService.getBusinessKey(); if (parentKey != null && parentKey.length() > 0) { businessService.setBusinessKey(parentKey); if (!businessService.getBusinessKey().equalsIgnoreCase(bs.getBusinessEntity().getEntityKey())) { throw new InvalidProjectionException(new ErrorMessage("errors.invalidprojection.ParentMismatch", businessService.getBusinessKey() + ", " + bs.getBusinessEntity().getEntityKey())); KeyGenerator keyGen = KeyGeneratorFactory.getKeyGenerator(); entityKey = keyGen.generate(publisher); businessService.setServiceKey(entityKey); } else { businessService.setBusinessKey(parentKey); } else { if (log.isDebugEnabled()) { log.debug("Services moved from business " + bs.getBusinessEntity() + " to " + businessService.getBusinessKey()); validateNames(businessService.getName()); validateCategoryBag(businessService.getCategoryBag(), config, false); validateDescriptions(businessService.getDescription()); validateBindingTemplates(em, businessService.getBindingTemplates(), businessService, config, publisher); validateSignaturesService(businessService, config);
InternationalString iname = service.getName(); addNames(bs.getName(), iname); addDescriptions(bs.getDescription(), idesc); bs.setBusinessKey(k.getId()); bs.setServiceKey(service.getKey().getId()); } else { bs.setServiceKey(""); bs.setCategoryBag(catBag); bs.setBindingTemplates(bt);
BusinessService service = new BusinessService(); service.setBusinessKey(businessKey); service.setServiceKey(UDDIKeyConvention.getServiceKey(properties, serviceName.getLocalPart())); service.getDescription().addAll(Common2UDDI.mapDescription(serviceDescription, lang)); service.getName().add(sName); log.debug("Adding KeyedReferences '" + serviceCategoryBag + "' to service " + serviceName.getLocalPart()); CategoryBag categoryBag = parseCategoryBag(serviceCategoryBag); service.setCategoryBag(categoryBag);
BusinessService businessService = new BusinessService(); businessService.setBusinessKey(businessKey); ServiceImpl service = businessServiceInfo.getService(); serviceDesc.setLang(UDDIConstants.ENGLISH); serviceDesc.setValue(businessServiceInfo.getServiceDescription()); businessService.getDescription().add(serviceDesc); businessService.getName().add(name); Map<String, PortImpl> ports = service.getPorts(); businessService.setBindingTemplates(bindingTemplates); serviceName); businessService.setCategoryBag(categoryBag); return businessService;
String parentKey = businessService.getBusinessKey(); if (parentKey != null && parentKey.length() > 0) { if (!parentKey.equalsIgnoreCase(parent.getBusinessKey())) { throw new InvalidKeyPassedException(new ErrorMessage("errors.invalidkey.ParentBusinessNotFound", parentKey + " " + businessService.getBusinessKey() + " " + businessService.getBusinessKey().length() + " " + parentKey.length())); String entityKey = businessService.getServiceKey(); if (entityKey == null || entityKey.length() == 0) { entityKey = rootPartition + KeyGenerator.PARTITION_SEPARATOR + UUID.randomUUID(); businessService.setServiceKey(entityKey); } else { businessService.setServiceKey(entityKey); validatePublish.validateNames(businessService.getName()); validatePublish.validateCategoryBag(businessService.getCategoryBag(), config, true); org.uddi.api_v3.BindingTemplates bindingTemplates = businessService.getBindingTemplates(); if (bindingTemplates != null) { List<org.uddi.api_v3.BindingTemplate> bindingTemplateList = bindingTemplates.getBindingTemplate();
BusinessService svc = new BusinessService(); svc.setBusinessKey(bizkey); Name n = new Name(); n.setLang(PublicationConstants.lang); n.setValue(servicePolicy.getPolicy().getURL()); svc.getName().add(n); Description d = new Description(); d.setLang(PublicationConstants.lang); d.setValue(servicePolicy.getPolicy().getDescription()); svc.getDescription().add(d); if (!Utility.stringIsNullOrEmpty(servicePolicy.getPolicy().getPOC())) { d = new Description(); d.setLang(PublicationConstants.lang); d.setValue("POC: " + servicePolicy.getPolicy().getPOC()); svc.getDescription().add(d); svc.setBindingTemplates(bts); add.getBusinessService().add(svc); ServiceDetail saveService = config.publish.saveService(add); bindingkey = saveService.getBusinessService().get(0).getBindingTemplates().getBindingTemplate().get(0).getBindingKey(); worked = true; ret += "Successfully Registered " + StringEscapeUtils.escapeHtml4(urls[i]) + "<br>";
try { org.uddi.api_v3.BusinessService bsIn = (org.uddi.api_v3.BusinessService)EntityCreator.buildFromDoc(serviceXML, "org.uddi.api_v3"); String serviceName = bsIn.getName().get(0).getValue(); String bindingKey = bsIn.getBindingTemplates().getBindingTemplate().get(0).getBindingKey(); for (int i=0; i<numberOfCopies; i++) { bsIn.getName().get(0).setValue(serviceName + "-" + i); bsIn.setBusinessKey(parentBusinessKey +"-" + businessInt); bsIn.setServiceKey(serviceKey + "-" + businessInt + "-" + i); bsIn.getBindingTemplates().getBindingTemplate().get(0).setBindingKey(bindingKey + "-" + businessInt + "-" + i); bsIn.getBindingTemplates().getBindingTemplate().get(0).setServiceKey(serviceKey + "-" + businessInt + "-" + i); ss.getBusinessService().add(bsIn); BindingTemplate bt = bsIn.getBindingTemplates().getBindingTemplate().get(0); if (! bt.getServiceKey().equals(serviceKey + "-" + businessInt + "-" + i)) { System.out.println("not the same"); logger.info("Add service with key " + bsIn.getServiceKey());
protected boolean publishTestService() { try { SaveService sb1 = new SaveService(); BusinessService s = new BusinessService(); s.setBusinessKey("uddi:org:miloss:fgsms:test"); Name n = new Name(); n.setLang(PublicationConstants.lang); n.setValue("Test Service fgsms DAS"); s.getName().add(n); s.setServiceKey("uddi:org:miloss:fgsms:test:service1"); BindingTemplates l = new BindingTemplates(); BindingTemplate bt = new BindingTemplate(); bt.setAccessPoint(ap); l.getBindingTemplate().add(bt); s.setBindingTemplates(l); sb1.getBusinessService().add(s);
if (apiBusinessService.getBusinessKey() != null && apiBusinessService.getBusinessKey().length() > 0 && !modelBusinessEntity.getEntityKey().equalsIgnoreCase(apiBusinessService.getBusinessKey())) { modelBusinessService.setEntityKey(apiBusinessService.getServiceKey()); org.apache.juddi.model.ServiceProjection modelServiceProjection = new org.apache.juddi.model.ServiceProjection(modelBusinessEntity, modelBusinessService);
for (BindingTemplate btIn : bsIn.getBindingTemplates().getBindingTemplate()) { String value = btIn.getAccessPoint().getValue(); value = value.replace("{randomPort}", port.toString()); value = value.replace("{hostname}", hostname); btIn.getAccessPoint().setValue(value); logger.info("service " + bsIn.getServiceKey() + " access point " + btIn.getAccessPoint().getValue() + " key:" + btIn.getBindingKey()); ServiceDetail bsOut = publication.saveService(ss); Assert.assertNotNull(bsOut); Assert.assertEquals(bsOut.getBusinessService().get(0).getBusinessKey(), bsIn.getBusinessKey()); if (bsIn.getBindingTemplates() != null) { Assert.assertNotNull(bsOut.getBusinessService().get(0).getBindingTemplates()); Assert.assertEquals(bsOut.getBusinessService().get(0).getBindingTemplates().getBindingTemplate().size(), bsIn.getBindingTemplates().getBindingTemplate().size()); for (int i = 0; i < bsIn.getBindingTemplates().getBindingTemplate().size(); i++) { Assert.assertEquals(bsIn.getBindingTemplates().getBindingTemplate().get(i).getAccessPoint().getValue(), bsOut.getBusinessService().get(0).getBindingTemplates().getBindingTemplate().get(i).getAccessPoint().getValue()); Assert.assertEquals(bsOut.getBusinessService().get(0).getServiceKey(), bsIn.getServiceKey()); logger.info("service " + bsIn.getServiceKey() + " saved"); if (bsOut.getBusinessService().get(0).getBindingTemplates() != null && !bsOut.getBusinessService().get(0).getBindingTemplates().getBindingTemplate().isEmpty()) { return bsOut.getBusinessService().get(0).getBindingTemplates().getBindingTemplate().get(0).getBindingKey();
void validateNotSigned(org.uddi.api_v3.BusinessService item) throws ValueNotAllowedException { if (item == null) { return; } if (item.getBusinessKey() == null && !item.getSignature().isEmpty()) { throw new ValueNotAllowedException(new ErrorMessage("errors.entity.SignedButNoKey", "businessKey")); } if (item.getServiceKey() == null && !item.getSignature().isEmpty()) { throw new ValueNotAllowedException(new ErrorMessage("errors.entity.SignedButNoKey", "serviceKey")); } //if i'm signed and a key isn't defined in a bt if (item.getBindingTemplates() != null && !item.getSignature().isEmpty()) { for (int i = 0; i < item.getBindingTemplates().getBindingTemplate().size(); i++) { if (item.getBindingTemplates().getBindingTemplate().get(i).getBindingKey() == null || item.getBindingTemplates().getBindingTemplate().get(i).getBindingKey().length() == 0) { throw new ValueNotAllowedException(new ErrorMessage("errors.entity.SignedButNoKey", "businessService/bindingTemplate(" + i + ")/bindingKey")); } } } }
if (service.getName().isEmpty()){ log.error("Unable to register service, a 'name' element is required"); return null; log.info("Registering service " + service.getName().get(0).getValue() + " with key " + service.getServiceKey()); try { SaveService saveService = new SaveService(); businessService = serviceDetail.getBusinessService().get(0); if (log.isDebugEnabled()) { log.debug("Registering service " + service.getName().get(0).getValue() + " completed."); log.error("Unable to register service " + service.getName().get(0).getValue() + " ." + e.getMessage(), e); } catch (Throwable t) { log.error("Unable to register service " + service.getName().get(0).getValue() + " ." + t.getMessage(), t);
/** * Copies the Service from one UDDI to another UDDI. */ public void xRegisterService() { BusinessService businessService; try { businessService = fromClerk.getServiceDetail(entityKey,fromClerk.getUDDINode().getApiNode()); log.info("xregister service " + businessService.getName().get(0).getValue() + " + from " + fromClerk.getName() + " to " + toClerk.getName()); businessService.setBindingTemplates(null); toClerk.register(businessService,toClerk.getUDDINode().getApiNode()); } catch (Exception e) { log.error("Could not " + toString() + ". " + e.getMessage() + " " + e.getCause(),e); } } /**
businessService.setBindingTemplates(new BindingTemplates()); for (Object portName : service.getPorts().keySet()) { BindingTemplate bindingTemplate = createWSDLBinding(serviceQName, (String) portName, serviceUrl, wsdlDefinition); businessService.getBindingTemplates().getBindingTemplate().add(bindingTemplate);
if (service!=null && service.getBindingTemplates()!=null && service.getBindingTemplates().getBindingTemplate() != null) { ArrayList<String> eprs = new ArrayList<String>(); BindingTemplates bindingTemplates = service.getBindingTemplates(); if (bindingTemplates==null) { log.warn("Found service " + service.getName().get(0).getValue() + " with serviceKey '" + serviceKey + "'" + " but no EPRs"); } else { log.debug("Found service " + service.getName().get(0).getValue() + " with serviceKey '" + serviceKey + "'" + " and " + bindingTemplates.getBindingTemplate().size() + " EPRs");