Examples of BusinessService


Examples of org.uddi.api_v3.BusinessService

      List<ServiceInfo> siList = sInfos.getServiceInfo();
      if (siList == null || siList.size() == 0)
        Assert.fail("No result from find service operation");
      ServiceInfo siOut = siList.get(0);
     
      BusinessService bsIn = (BusinessService)EntityCreator.buildFromDoc(TckBusinessService.JOE_SERVICE_XML, "org.uddi.api_v3");
     
      assertEquals(bsIn.getServiceKey(), siOut.getServiceKey());
     
      TckValidator.checkNames(bsIn.getName(), siOut.getName());
      serviceKey = siOut.getServiceKey();
    }
    catch(Exception e) {
      logger.error(e.getMessage(), e);
      Assert.fail("No exception should be thrown.");
View Full Code Here

Examples of org.uddi.api_v3.BusinessService

 
  public Collection<BusinessService> readServiceAnnotations(String[] classesWithAnnotations, Properties properties) {
    Collection<BusinessService> services = new ArrayList<BusinessService>();
    for (String className : classesWithAnnotations) {
      try {   
        BusinessService service = readServiceAnnotations(className, properties);
        services.add(service);
      } catch (Exception e) {
        e.printStackTrace();
      }
    }
View Full Code Here

Examples of org.uddi.api_v3.BusinessService

    return services;
  }
 
  public BusinessService readServiceAnnotations(String classWithAnnotations, Properties properties) throws ClassNotFoundException {
   
    BusinessService service = new BusinessService();
    Class<?> clazz = ClassUtil.forName(classWithAnnotations, this.getClass());
    UDDIService uddiService= (UDDIService) clazz.getAnnotation(UDDIService.class);
    WebService webServiceAnnotation = (WebService) clazz.getAnnotation(WebService.class);
   
    if (uddiService!=null) {
      //service
      String lang = "en"; //default to english
      if (uddiService.lang()!=null) {
        lang = uddiService.lang();
      }
      Name name = new Name();
      name.setLang(lang);
      service.setBusinessKey(TokenResolver.replaceTokens(uddiService.businessKey(),properties));
      service.setServiceKey(TokenResolver.replaceTokens(uddiService.serviceKey(),properties));
      if (!"".equals(uddiService.serviceName())) {
        name.setValue(TokenResolver.replaceTokens(uddiService.serviceName(),properties));
      } else if (webServiceAnnotation!=null && !"".equals(webServiceAnnotation.serviceName())) {
        name.setValue(webServiceAnnotation.serviceName());
      } else {
        name.setValue(clazz.getSimpleName());
      }
      service.getName().add(name);
      Description description = new Description();
      description.setLang(lang);
      description.setValue(TokenResolver.replaceTokens(uddiService.description(),properties));
      service.getDescription().add(description);
     
      //categoryBag on the service
      if (!"".equals(uddiService.categoryBag())) {
        CategoryBag categoryBag = parseCategoryBag(uddiService.categoryBag());
            service.setCategoryBag(categoryBag);
      }
     
      //bindingTemplate on service
      BindingTemplate bindingTemplate = parseServiceBinding(clazz, lang, webServiceAnnotation, properties);
      if (bindingTemplate!=null) {
        bindingTemplate.setServiceKey(service.getServiceKey());
        if (service.getBindingTemplates()==null) {
          service.setBindingTemplates(new BindingTemplates());
        }
        service.getBindingTemplates().getBindingTemplate().add(bindingTemplate);
      }
     
     
    } else {
      log.error("Missing UDDIService annotation in class " + classWithAnnotations);
View Full Code Here

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());
                        if (bsOut.getBindingTemplates()!=null && !bsOut.getBindingTemplates().getBindingTemplate().isEmpty())
                            return bsOut.getBindingTemplates().getBindingTemplate().get(0).getBindingKey();
    }
    catch(Exception e) {
      logger.error(e.getMessage(), e);
      Assert.fail("No exception should be thrown.");
    }
View Full Code Here

Examples of org.uddi4j.datatype.service.BusinessService

  public static BusinessService getBusinessServiceByKey(
    UDDIProxy proxy,
    String key)
    throws TransportException, UDDIException
  {
    BusinessService result = null;

    ServiceDetail sd = proxy.get_serviceDetail(key);

    if (sd != null)
    {
View Full Code Here

Examples of org.uddi4j.datatype.service.BusinessService

    String serviceKey = null;
    String businessKey = null;
    try
    {
      serviceKey = bindingTemplate.getServiceKey();
      BusinessService service =
        UDDIUtils.getBusinessServiceByKey(this.validator.uddiProxy, serviceKey);

      businessKey = service.getBusinessKey();
      BusinessEntity business =
        UDDIUtils.getBusinessByKey(this.validator.uddiProxy, businessKey);

      validService = checkCategoryBag(this.validator.uddiProxy, service.getCategoryBag());
      validBusiness = checkCategoryBag(this.validator.uddiProxy, business.getCategoryBag());

      if (!validBusiness || !validService)
      {
        result = AssertionResult.RESULT_FAILED;
View Full Code Here

Examples of service.BusinessService

  }

  private void performAction(HttpServletRequest request,
      HttpServletResponse response) throws ServletException, IOException {
    String action = request.getParameter("action");
    BusinessService service = new DefaultBusinessServiceImpl();
    response.setContentType("text/plain");
    if ("send".equals(action)) {
      String credentials = request.getParameter("credentials");
      StringTokenizer tokenizer = new StringTokenizer(credentials, ":");
      if (tokenizer.countTokens() == 2) {
        String user = tokenizer.nextToken();
        String pass = tokenizer.nextToken();
        if (config.getInitParameter("sysuser").equals(user) && config.getInitParameter("syspass").equals(pass)) {
          String messageKey = request.getParameter("messageKey");
          String fromMail = request.getParameter("senderId");
          if (fromMail == null) fromMail="empty.server";
          String toMail = request.getParameter("recepientId");
          if (toMail == null) toMail="empty.server";
          String question =  request.getParameter("question");
          String answer = request.getParameter("answer");
          String versionS = request.getParameter("version");
          if (versionS == null) versionS="0";
          float version = Util.convertToFloat(versionS, 0.0F);
          version = version < 0.4 ? 0.0F : version;
          int TTL = Util.convertToInteger(request.getParameter("TTL"), -1);
          if (TTL == -1) {TTL = 120;} // 5 days expiration by default
          Timestamp timeToLive = null;
          Calendar today = GregorianCalendar.getInstance();
          today.add(Calendar.HOUR_OF_DAY, TTL);
          timeToLive = new Timestamp(today.getTime().getTime());
          String messageId = service.send(messageKey, fromMail, toMail, question, answer, timeToLive, version);
          response.getWriter().write(messageId);
          return;
        }
      }
      throw new ServletException("Access Denied");
    }
    else if ("getQuestion".equals(action)) {
      String messageId = request.getParameter("messageId");
      request.getSession().setAttribute("messageId", messageId);
     
      if (service.isMessageExpired(messageId)) {
        response.sendRedirect("jsp/ExpiredMessage.jsp");
        return;
      }
     
      request.getSession().setAttribute("messageId", messageId);
      request.setAttribute("messageQuestion", service.getQuestion(messageId));
      request.getSession().setAttribute("answerTries", 0);
      request.getRequestDispatcher("jsp/MessageQuestion.jsp").forward(request, response);
    }
    else if ("receive".equals(action)) {
      String userAnswer = request.getParameter("userAnswer");
      String messageId = (String) request.getSession().getAttribute("messageId"); // (String) to access it in each .jsp page
      boolean validAnswer = service.isValidAnswer(userAnswer, messageId,false);

      if (validAnswer) {
        request.setAttribute("messageKey", service.receive(userAnswer, messageId, false));
        //request.setAttribute("DecodeURIComponent", service.isver1(messageId));
        request.getRequestDispatcher("jsp/MailContent.jsp").forward(request, response);
      } else {
        String nonCanonicalUserAnswer = null;
        // Try for the non-canonized answer. This can be the case of the
        // message encrypted with the older non-canonized version.
        if (!validAnswer) {
          nonCanonicalUserAnswer = request.getParameter("userAnswer1");
          validAnswer = service.isValidAnswer(nonCanonicalUserAnswer, messageId, true);
        }

        if (validAnswer) {
          request.setAttribute("messageKey", service.receive(nonCanonicalUserAnswer, messageId, true));
          //request.setAttribute("DecodeURIComponent", service.isver1(messageId));
          request.getRequestDispatcher("jsp/MailContent.jsp").forward(request, response);
        } else {
          request.setAttribute("messageQuestion", service.getQuestion(messageId));
          int ansTries = (Integer) request.getSession().getAttribute("answerTries");
          request.getSession().setAttribute("answerTries", ++ansTries);
          request.getRequestDispatcher("jsp/MessageQuestion.jsp").forward(request, response);
        }
      } 
    }
    else if ("requestMessageRevival".equals(action)) {
      String messageId = (String) request.getSession().getAttribute("messageId");

      if (service.isMessageExpired(messageId)) {
       
        String requestorName = request.getParameter("requestorName");
        String requestfromMailR = request.getParameter("fromMailR");
        String requestorEmail = request.getParameter("requestorEmail");       
        String requestReason = request.getParameter("requestReason");         
        service.createRevivalRequest(messageId, requestorName, requestfromMailR, requestorEmail, requestReason);
        response.sendRedirect("html/RevivalRequestSuccess.html");
      }

    } else {
      throw new UnsupportedOperationException("Operation not supported");
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.