예제 #1
0
  public String retrieveVehiclePrice(String make, String model, String year, int miles) {
    RetrieveVehiclePriceResponse response = new RetrieveVehiclePriceResponse();
    String price = null;
    try {
      CentricService service = new CentricServiceLocator();
      CentricSoapBindingStub serviceStub = new CentricSoapBindingStub(service);
      logger.debug("ICS client web service url: " + CENTRIC_SERVICE_URL);
      serviceStub._setProperty(Stub.ENDPOINT_ADDRESS_PROPERTY, CENTRIC_SERVICE_URL);

      RetrieveVehiclePriceRequest request = new RetrieveVehiclePriceRequest();
      request.setMake(make);
      request.setModel(model);
      request.setYear(year);
      request.setMileage(String.valueOf(miles));
      // request.setUserId(userId);
      // Submit Web Service Call
      long startTime = (new Date()).getTime();
      response = serviceStub.retrieveVehiclePrice(request);
      long elapsedTime = (new Date().getTime()) - startTime;
      logger.warn("****** Centric ws call, elapsedTime: " + elapsedTime + " ******");
      price = response.getPrice();
    } catch (RemoteException re) {
      throw new DLSSystemException(re.getMessage(), re, logger);
    }
    return price;
  }
예제 #2
0
  public void invokeSubmitPaymentRequestWS(Owner app, String userId) {
    SubmitPaymentResponse response = new SubmitPaymentResponse();

    try {
      CentricService service = new CentricServiceLocator();
      CentricSoapBindingStub serviceStub = new CentricSoapBindingStub(service);
      logger.debug("ICS client web service url: " + CENTRIC_SERVICE_URL);
      serviceStub._setProperty(Stub.ENDPOINT_ADDRESS_PROPERTY, CENTRIC_SERVICE_URL);

      SubmitPaymentRequest request = getSubmitPaymentRequest(app);
      request.setUserId(userId);
      // Submit Web Service Call
      long startTime = (new Date()).getTime();
      response = serviceStub.submitPayment(request);
      long elapsedTime = (new Date().getTime()) - startTime;
      logger.warn("****** Centric ws call, elapsedTime: " + elapsedTime + " ******");
      String resultCode = response.getStatus();
      if (resultCode.equals("0")) {
        logger.info(
            "ICS inquiry response contained successful result code: " + response.getStatus());
      } else {
        /* TODO implement non successful code */
      }
    } catch (RemoteException re) {
      throw new DLSSystemException(re.getMessage(), re, logger);
    }
  }
예제 #3
0
  @SuppressWarnings("unchecked")
  public HashMap invokeSubmitProductQueryWS(String[] productIdArray) {
    logger.info("Class ProcessIssuanceUtil...Method invokeSubmitProductQueryWS :line no :63");
    SubmitProductQueryResponse response = new SubmitProductQueryResponse();
    HashMap productFeeMap = new HashMap();
    try {
      CentricService service = new CentricServiceLocator();
      CentricSoapBindingStub serviceStub = new CentricSoapBindingStub(service);
      logger.debug("ICS client web service url: " + CENTRIC_SERVICE_URL);
      serviceStub._setProperty(Stub.ENDPOINT_ADDRESS_PROPERTY, CENTRIC_SERVICE_URL);

      SubmitProductQueryRequest request = new SubmitProductQueryRequest();
      request.setProductIds(productIdArray);
      long startTime = (new Date()).getTime();
      /*
       * Commented the submit product query becuase we are not getting the
       * product list from drools cache loader
       */
      logger.info("Class ProcessIssuanceUtil...Method invokeSubmitProductQueryWS :line no :79");
      response = serviceStub.submitProductQuery(request);
      long elapsedTime = (new Date().getTime()) - startTime;
      logger.warn("****** Centric ws call, elapsedTime: " + elapsedTime + " ******");
    } catch (RemoteException re) {
      throw new DLSSystemException(re.getMessage(), re, logger);
    }
    float totalAmount = 0;
    if (response.getProducts() != null) {
      Product[] productArray = response.getProducts();
      for (int i = 0; i < productArray.length; i++) {
        Product product = productArray[i];
        productFeeMap.put(product.getProductId(), product);
        totalAmount = totalAmount + (new Float(product.getAmount()).floatValue());
      }
      logger.info(
          "Class ProcessIssuanceUtil...Method invokeSubmitProductQueryWS :line no :94 with total amount "
              + totalAmount);
    }
    productFeeMap.put("TOTAL_AMOUNT", totalAmount + "");
    return productFeeMap;
  }
예제 #4
0
 public String retrieveNextPlateNumber() {
   InventoryResponse response = new InventoryResponse();
   String plateNumber = null;
   try {
     CentricService service = new CentricServiceLocator();
     CentricSoapBindingStub serviceStub = new CentricSoapBindingStub(service);
     logger.debug("ICS client web service url: " + CENTRIC_SERVICE_URL);
     serviceStub._setProperty(Stub.ENDPOINT_ADDRESS_PROPERTY, CENTRIC_SERVICE_URL);
     InventoryRequest request = new InventoryRequest();
     request.setItemLocation("3");
     request.setItemType("0101");
     long startTime = (new Date()).getTime();
     response = serviceStub.performInventoryOperation(request);
     long elapsedTime = (new Date().getTime()) - startTime;
     logger.warn("****** Centric ws call, elapsedTime: " + elapsedTime + " ******");
     System.out.println(response.getItemCode() + " " + response.getItemNumber());
     if (org.apache.commons.lang.StringUtils.isNotBlank(response.getItemCode())
         && !"ERROR".equalsIgnoreCase(response.getItemCode()))
       plateNumber = response.getItemCode().trim().toUpperCase();
   } catch (RemoteException re) {
     throw new DLSSystemException(re.getMessage(), re, logger);
   }
   return plateNumber;
 }