public static void main(String[] args) {

    try {
      String fileName = "/log4j.properties";
      DataHandler dh =
          new DataHandler(
              new FileDataSource(FileSenderClient.class.getResource(fileName).getPath()));
      String url = "http://127.0.0.1:8080/axis1/services/FileReceiverServer";
      Service serv = new Service();
      Call call = (Call) serv.createCall();
      call.setTargetEndpointAddress(url);
      call.setOperationName(new QName(url, "receive"));
      QName qn = new QName("DataHandler", "myNs:DataHandler");
      call.registerTypeMapping(
          DataHandler.class,
          qn,
          JAFDataHandlerSerializerFactory.class,
          JAFDataHandlerDeserializerFactory.class);
      call.addParameter("s1", qn, ParameterMode.IN);
      call.addParameter("s2", XMLType.XSD_STRING, ParameterMode.IN);
      call.setReturnClass(String.class);
      String returnStr = (String) call.invoke(new Object[] {dh, "server.txt"});
      System.out.println("Server response: " + returnStr);
    } catch (ServiceException e) {
      e.printStackTrace();
    } catch (RemoteException e) {
      e.printStackTrace();
    }
  }
  public JobHistoryInfo getScheduledReportHistoryInfo(
      String scheduledJobID,
      String viewByFilter,
      boolean downloadReport,
      String userID,
      String userPassword)
      throws ReportException {

    try {
      initOperation();

      call.setOperationName(new QName(BIP_NAMESPACE, "getScheduledReportHistoryInfo"));

      call.addParameter("scheduledJobID", XMLType.XSD_STRING, ParameterMode.IN);
      call.addParameter("userID", XMLType.XSD_STRING, ParameterMode.IN);
      call.addParameter("password", XMLType.XSD_STRING, ParameterMode.IN);
      call.addParameter("viewByFilter", XMLType.XSD_STRING, ParameterMode.IN);
      call.addParameter("downloadReport", XMLType.XSD_BOOLEAN, ParameterMode.IN);

      call.setReturnClass(JobHistoryInfo.class);

      // issue the request
      JobHistoryInfo result =
          (JobHistoryInfo)
              call.invoke(
                  new Object[] {
                    scheduledJobID, userID, userPassword, viewByFilter, downloadReport
                  });

      return result;
    } catch (RemoteException e) {
      ReportException reportException = new ReportException(e);
      throw reportException;
    }
  }
  public ItemData[] getFolderContents(String folderAbsolutePath, String userID, String userPassword)
      throws ReportException {

    try {

      initOperation();

      call.setOperationName(new QName(BIP_NAMESPACE, "getFolderContents"));
      call.addParameter("reportAbsolutePath", XMLType.XSD_STRING, ParameterMode.IN);
      call.addParameter("userID", XMLType.XSD_STRING, ParameterMode.IN);
      call.addParameter("password", XMLType.XSD_STRING, ParameterMode.IN);
      call.setReturnClass(ItemData[].class);
      // issue the request
      ItemData[] descFolderData =
          (ItemData[]) call.invoke(new Object[] {folderAbsolutePath, userID, userPassword});

      if (descFolderData != null) {
        for (int i = 0; i < descFolderData.length; i++) {
          log.debug(descFolderData[i].getDisplayName());
        }
      }

      log.debug("Success for GetFolderContent");

      return descFolderData;
    } catch (RemoteException e) {
      ReportException reportException = new ReportException(e);
      throw reportException;
    }
  }
  public ParamNameValue[] getReportParameters(
      ReportRequest reportRequest, String userID, String userPassword) throws ReportException {

    try {
      initOperation();

      QName reportReq = new QName(BIP_NAMESPACE, "ReportRequest");

      call.setOperationName(new QName(BIP_NAMESPACE, "getReportParameters"));
      call.addParameter("ReportRequest", reportReq, ParameterMode.IN);
      call.addParameter("userID", XMLType.XSD_STRING, ParameterMode.IN);
      call.addParameter("password", XMLType.XSD_STRING, ParameterMode.IN);
      call.setReturnClass(ParamNameValue[].class);
      // issue the request
      ParamNameValue params[] =
          (ParamNameValue[]) call.invoke(new Object[] {reportRequest, userID, userPassword});
      return params;
    } catch (RemoteException e) {
      ReportException reportException = new ReportException(e);
      throw reportException;
    }
  }
  public ReportDefinition getReportDefinition(
      String reportAbsolutePath, String userID, String userPassword) throws ReportException {

    try {
      initOperation();
      log.debug("BEGIN TESTING getReportDefinition");

      call.setOperationName(new QName(BIP_NAMESPACE, "getReportDefinition"));
      call.addParameter("reportAbsolutePath", XMLType.XSD_STRING, ParameterMode.IN);
      call.addParameter("userID", XMLType.XSD_STRING, ParameterMode.IN);
      call.addParameter("password", XMLType.XSD_STRING, ParameterMode.IN);
      call.setReturnClass(ReportDefinition.class);
      // issue the request
      ReportDefinition reportDefn =
          (ReportDefinition) call.invoke(new Object[] {reportAbsolutePath, userID, userPassword});

      return reportDefn;
    } catch (RemoteException e) {
      ReportException reportException = new ReportException(e);
      throw reportException;
    }
  }
  public ReportResponse runReport(ReportRequest reportRequest, String userID, String userPassword)
      throws ReportException {

    try {
      initOperation();

      QName reportReq = new QName(BIP_NAMESPACE, "ReportRequest");

      // Default return type based on what we expect
      call.setOperationName(new QName(BIP_NAMESPACE, "runReport"));
      call.addParameter("ReportRequest", reportReq, ParameterMode.IN);
      call.addParameter("userID", XMLType.XSD_STRING, ParameterMode.IN);
      call.addParameter("password", XMLType.XSD_STRING, ParameterMode.IN);
      call.setReturnClass(ReportResponse.class);
      // issue the reques
      ReportResponse reportResponse =
          (ReportResponse) call.invoke(new Object[] {reportRequest, userID, userPassword});

      return reportResponse;
    } catch (RemoteException e) {
      ReportException reportException = new ReportException(e);
      throw reportException;
    }
  }