Package org.uddi.api_v3

Examples of org.uddi.api_v3.BusinessService


      // Now get the entity and check the values
      GetServiceDetail gs = new GetServiceDetail();
      gs.getServiceKey().add(serviceKey);
      ServiceDetail sd = inquiry.getServiceDetail(gs);
      List<BusinessService> bsOutList = sd.getBusinessService();
      BusinessService bsOut = bsOutList.get(0);

      assertEquals(bsIn.getServiceKey().toLowerCase(), bsOut.getServiceKey());
     
      TckValidator.checkNames(bsIn.getName(), bsOut.getName());
      TckValidator.checkDescriptions(bsIn.getDescription(), bsOut.getDescription());
      TckValidator.checkBindingTemplates(bsIn.getBindingTemplates(), bsOut.getBindingTemplates());
      TckValidator.checkCategories(bsIn.getCategoryBag(), bsOut.getCategoryBag());
     
    }
    catch(Exception e) {
      logger.error(e.getMessage(), e);
      Assert.fail("No exception should be thrown.");
View Full Code Here


  }
  /**
   * Copies the Service from one UDDI to another UDDI.
   */
  public void xRegisterService() {
    BusinessService businessService;
    try {
      businessService = fromClerk.findService(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);
    }
  }
View Full Code Here

  }
  /**
   * Copies the Service from one UDDI to another UDDI along with all the bindingTemplates.
   */
  public void xRegisterServiceAndBindings() {
    BusinessService businessService;
    try {
      businessService = fromClerk.findService(entityKey,fromClerk.getUDDINode().getApiNode());
      log.info("xregister service " + businessService.getName().get(0).getValue() + " + from "
          + fromClerk.getName() + " to " + toClerk.getName());
      toClerk.register(businessService,toClerk.getUDDINode().getApiNode());
    } catch (Exception e) {
      log.error("Could not " + toString() + ". " + e.getMessage() + " " + e.getCause(),e);
    }
View Full Code Here

 
  private Topology lookupEndpointInUDDI(String serviceKey) {
    Topology topology = null;
    try {
     
      BusinessService service = clerk.findService(serviceKey);
      if (service==null) {
        log.debug("No Service with key " + serviceKey + " was found in the registry.");
        //TODO find service by tModel
      }
      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");
          //Loop over all bindingTemplates found and get the endpoints.
          for (BindingTemplate bindingTemplate : bindingTemplates.getBindingTemplate()) {
            AccessPoint accessPoint = bindingTemplate.getAccessPoint();
View Full Code Here

        BusinessServices businessServices = new BusinessServices();

        for (Object serviceName : wsdlDefinition.getAllServices().keySet()) {
            QName serviceQName = (QName) serviceName;
            Service service = wsdlDefinition.getService(serviceQName);
            BusinessService businessService = null;
            //add service
            URL serviceUrl = null;
            if (service.getPorts() != null && service.getPorts().size() > 0) {
                for (Object portName : service.getPorts().keySet()) {
                    businessService = registerBusinessService(serviceQName, (String) portName, serviceUrl, wsdlDefinition).getBusinessService();
View Full Code Here

    public ServiceRegistrationResponse registerBusinessService(QName serviceQName, String portName, URL serviceUrl, Definition wsdlDefinition) throws RemoteException, ConfigurationException, TransportException, WSDLException {

        String genericWSDLURL = wsdlDefinition.getDocumentBaseURI();   //TODO maybe point to repository version
        ServiceRegistrationResponse response = new ServiceRegistrationResponse();
        String serviceKey = UDDIKeyConvention.getServiceKey(properties, serviceQName.getLocalPart());
        BusinessService businessService = lookupService(serviceKey);
        if (businessService == null) {
            List<TModel> tModels = new ArrayList<TModel>();
            // Create the PortType tModels
            Map<QName, PortType> portTypes = (Map<QName, PortType>) wsdlDefinition.getAllPortTypes();
            tModels.addAll(createWSDLPortTypeTModels(genericWSDLURL, portTypes));
            // Create the Binding tModels
            Map<QName, Binding> bindings = (Map<QName, Binding>) wsdlDefinition.getAllBindings();
            tModels.addAll(createWSDLBindingTModels(genericWSDLURL, bindings));
            // Register these tModels
            for (TModel tModel : tModels) {
                clerk.register(tModel);
            }
            // Service
            businessService = createBusinessService(serviceQName, wsdlDefinition);
            // Register this Service
            clerk.register(businessService);
        }
        //Add the BindingTemplate to this Service
        BindingTemplate binding = createWSDLBinding(serviceQName, portName, serviceUrl, wsdlDefinition);
        // Register BindingTemplate
        if (binding.getAccessPoint()!=null) {
          clerk.register(binding);
          if (businessService.getBindingTemplates() == null) {
              businessService.setBindingTemplates(new BindingTemplates());
          }
          businessService.getBindingTemplates().getBindingTemplate().add(binding);
          response.setBindingKey(binding.getBindingKey());
        }
        response.setBusinessService(businessService);
        return response;
    }
View Full Code Here

    }

    public String unRegisterBusinessService(QName serviceName, String portName, URL serviceUrl) throws RemoteException, ConfigurationException, TransportException {

        String serviceKey = UDDIKeyConvention.getServiceKey(properties, serviceName.getLocalPart());
        BusinessService service = lookupService(serviceKey);
        boolean isRemoveServiceIfNoTemplates = true;
        String bindingKey = UDDIKeyConvention.getBindingKey(properties, serviceName, portName, serviceUrl);
        //check if this bindingKey is in the service's binding templates
        for (BindingTemplate bindingTemplate : service.getBindingTemplates().getBindingTemplate()) {
            if (bindingKey.equals(bindingTemplate.getBindingKey())) {
                clerk.unRegisterBinding(bindingKey);
                //if this is the last binding for this service, and
                if (service.getBindingTemplates().getBindingTemplate().size() == 1 && isRemoveServiceIfNoTemplates) {
                    clerk.unRegisterService(serviceKey);
                    if (bindingTemplate.getTModelInstanceDetails() != null
                            && bindingTemplate.getTModelInstanceDetails().getTModelInstanceInfo() != null) {
                        for (TModelInstanceInfo tModelInstanceInfo : bindingTemplate.getTModelInstanceDetails().getTModelInstanceInfo()) {
                            String tModelKey = tModelInstanceInfo.getTModelKey();
View Full Code Here

     * @throws TransportException
     */
    private BusinessService lookupService(String serviceKey) throws RemoteException, ConfigurationException, TransportException {

        //Checking if this serviceKey already exist
        BusinessService service = clerk.findService(serviceKey);
        return service;
    }
View Full Code Here

        }
        BusinessServices businessServices = new BusinessServices();
        for (Object serviceName : wsdlDefinition.getAllServices().keySet()) {
            QName serviceQName = (QName) serviceName;
            Service service = wsdlDefinition.getService(serviceQName);
            BusinessService businessService = createBusinessService(serviceQName, wsdlDefinition);
            //service.getExtensibilityElements().
            //add the bindingTemplates
            URL serviceUrl = null;
            if (service.getPorts() != null && service.getPorts().size() > 0) {
                businessService.setBindingTemplates(new BindingTemplates());
                for (Object portName : service.getPorts().keySet()) {
                    BindingTemplate bindingTemplate = createWSDLBinding(serviceQName, (String) portName, serviceUrl, wsdlDefinition);
                    businessService.getBindingTemplates().getBindingTemplate().add(bindingTemplate);
                }
            }
            businessServices.getBusinessService().add(businessService);
        }
View Full Code Here

     * @return
     */
    protected BusinessService createBusinessService(QName serviceQName, Definition wsdlDefinition) {

        log.debug("Constructing Service UDDI Information for " + serviceQName);
        BusinessService service = new BusinessService();
        // BusinessKey
        service.setBusinessKey(businessKey);
        // ServiceKey
        service.setServiceKey(UDDIKeyConvention.getServiceKey(properties, serviceQName.getLocalPart()));
        // Description
        String serviceDescription = properties.getProperty(Property.SERVICE_DESCRIPTION, Property.DEFAULT_SERVICE_DESCRIPTION);
        // Override with the service description from the WSDL if present
        if (wsdlDefinition.getService(serviceQName) != null) {
            Element docElement = wsdlDefinition.getService(serviceQName).getDocumentationElement();
            if (docElement != null && docElement.getTextContent() != null) {
                serviceDescription = docElement.getTextContent();
            }
        }
        Description description = new Description();
        description.setLang(lang);
        description.setValue(serviceDescription);
        service.getDescription().add(description);
        // Service name
        Name sName = new Name();
        sName.setLang(lang);
        sName.setValue(serviceQName.getLocalPart());
        service.getName().add(sName);

        CategoryBag categoryBag = new CategoryBag();

        String namespace = serviceQName.getNamespaceURI();
        if (namespace != null && namespace != "") {
            KeyedReference namespaceReference = newKeyedReference(
                    "uddi:uddi.org:xml:namespace", "uddi-org:xml:namespace", namespace);
            categoryBag.getKeyedReference().add(namespaceReference);
        }

        KeyedReference serviceReference = newKeyedReference(
                "uddi:uddi.org:wsdl:types", "uddi-org:wsdl:types", "service");
        categoryBag.getKeyedReference().add(serviceReference);

        KeyedReference localNameReference = newKeyedReference(
                "uddi:uddi.org:xml:localname", "uddi-org:xml:localName", serviceQName.getLocalPart());
        categoryBag.getKeyedReference().add(localNameReference);

        service.setCategoryBag(categoryBag);

        return service;
    }
View Full Code Here

TOP

Related Classes of org.uddi.api_v3.BusinessService

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.