예제 #1
0
  /**
   * @param options
   * @throws DatatypeConfigurationException
   * @throws SoapFault
   * @throws IOException
   * @throws JAXBException
   * @throws ClassNotFoundException
   */
  public static CreateReservationResponseType createReservation(CreateReservationType request)
      throws SoapFault, IOException, ClassNotFoundException {

    String[] parameters = {"xml"};
    CreateReservation resv = new CreateReservation();
    resv.setCreateReservation(request);

    String value = "";
    try {
      value = JaxbSerializer.getInstance().objectToXml(resv);
      // added for test 09-22-9
      logger.info("sent out xml is::: " + value);
      // end add
    } catch (JAXBException e) {
      e.printStackTrace();
    }
    String[] values = {value};

    Object res = sendRequestToServlet("create", parameters, values);
    try {
      CreateReservationResponseType result = (CreateReservationResponseType) res;
      return result;
    } catch (ClassCastException e) {
      return null;
    }
  }
예제 #2
0
  @Override
  public void run() {
    this.logger.info("Starting sender thread...");

    if (this.op.equalsIgnoreCase("createReservation")) {
      Element response;
      try {

        // this.logger.info("SENDER: sending CreateReservation
        // request");

        final CreateReservation create = new CreateReservation();
        create.setCreateReservation((CreateReservationType) this.msg);

        response =
            this.proxyRSV.createReservation(JaxbSerializer.getInstance().objectToElement(create));

        final CreateReservationResponse res =
            (CreateReservationResponse) JaxbSerializer.getInstance().elementToObject(response);

        // logger.info("SENDER: received CreateReservation response");

        this.result = res.getCreateReservationResponse();

      } catch (final SoapFault e) {
        this.rollback = true;
        this.exception = e;
        e.printStackTrace();
      }
    } else if (this.op.equalsIgnoreCase("activateReservation")) {
      Element response;
      try {
        final Activate act = new Activate();
        act.setActivate((ActivateType) this.msg);

        response = this.proxyRSV.activate(JaxbSerializer.getInstance().objectToElement(act));

        final ActivateResponse res =
            (ActivateResponse) JaxbSerializer.getInstance().elementToObject(response);

        this.result = res.getActivateResponse();

      } catch (final SoapFault e) {
        this.exception = e;
        e.printStackTrace();
      }
    } else if (this.op.equalsIgnoreCase("cancelReservation")) {
      Element response;
      try {

        final CancelReservation cancel = new CancelReservation();

        cancel.setCancelReservation((CancelReservationType) this.msg);

        response =
            this.proxyRSV.cancelReservation(JaxbSerializer.getInstance().objectToElement(cancel));

        final CancelReservationResponse res =
            (CancelReservationResponse) JaxbSerializer.getInstance().elementToObject(response);

        this.result = res.getCancelReservationResponse();

      } catch (final SoapFault e) {
        this.exception = e;
        e.printStackTrace();
      }
    } else if (this.op.equalsIgnoreCase("getStatus")) {
      Element response;
      try {
        final GetStatus get = new GetStatus();
        get.setGetStatus((GetStatusType) this.msg);

        response = this.proxyRSV.getStatus(JaxbSerializer.getInstance().objectToElement(get));

        final GetStatusResponse res =
            (GetStatusResponse) JaxbSerializer.getInstance().elementToObject(response);

        this.result = res.getGetStatusResponse();

      } catch (final SoapFault e) {
        this.exception = e;
        e.printStackTrace();
      }
    } else if (this.op.equalsIgnoreCase("isAvailable")) {
      Element response;
      try {

        final IsAvailable avail = new IsAvailable();
        avail.setIsAvailable((IsAvailableType) this.msg);

        response = this.proxyRSV.isAvailable(JaxbSerializer.getInstance().objectToElement(avail));

        // logger.info("Request Sender: received IsAvailable response");

        final IsAvailableResponse res =
            (IsAvailableResponse) JaxbSerializer.getInstance().elementToObject(response);

        this.result = res.getIsAvailableResponse();

      } catch (final SoapFault e) {
        this.exception = e;
        e.printStackTrace();
      }
    } else if (this.op.equalsIgnoreCase("getReservations")) {
      Element response;
      try {

        final GetReservations getRsvs = new GetReservations();
        getRsvs.setGetReservations((GetReservationsType) this.msg);

        response =
            this.proxyRSV.getReservations(JaxbSerializer.getInstance().objectToElement(getRsvs));

        final GetReservationsResponse res =
            (GetReservationsResponse) JaxbSerializer.getInstance().elementToObject(response);

        this.result = res.getGetReservationsResponse();

      } catch (final SoapFault e) {
        this.exception = e;
        e.printStackTrace();
      }
    }

    this.logger.info("finished");
    this.performanceLogger.log(
        PerformanceLogLevel.PERFORMANCE_LOG,
        "NRPS_response_time "
            + this.domain.getName()
            + " "
            + this.proxyRSV.getLastCallDuration()
            + "ms");
  }