/**
   * Sends a given PCC10 request to a given PCC10 end point and returns the acknowledge (the
   * response for the request). The message send contains in its SOAP header the response URI.
   *
   * @param query the PCC10 request. It can not be null.
   * @param endpointURI the URI where the PCC10 end point runs. It can not be null.
   * @param responseEndpointURI the URI where the response to the PCC10 request will be send. It can
   *     not be null.
   * @return the acknowledge (the response for the request)for the given request.
   * @throws MalformedURLException if the specified PCC10 end point URI is malformed.
   */
  static MCCIIN000002UV01 sendMessage(QUPCIN043200UV01 query, String endpointURI)
      throws MalformedURLException {
    // SSL must be setup enabled if needed from the MedicationTask, etc
    // TODO change the enabling security methods in MediationTask, VitalSign Task, etc
    // to use a common solution with this override to trust all certificates
    // the sendSecureMessage is not used by MedicationTask, etc...but message receiver did not care
    // on salk machine or?

    try {
      // trust all certificates
      com.sun.net.ssl.HostnameVerifier myHv =
          new com.sun.net.ssl.HostnameVerifier() {

            public boolean verify(String hostName, String a) {
              return true;
            }
          };
      com.sun.net.ssl.internal.www.protocol.https.HttpsURLConnectionOldImpl
          .setDefaultHostnameVerifier(myHv);
    } catch (Exception e) {
      LOGGER.error(" trust all certificates");
    }
    if (query == null) {
      final NullPointerException exception =
          new NullPointerException("The query argument can not be null.");
      LOGGER.error(exception.getMessage(), exception);
    }

    if (endpointURI == null || endpointURI.isEmpty()) {
      final NullPointerException exception =
          new NullPointerException("The endpointURI argument can not be null or empty string.");
      LOGGER.error(exception.getMessage(), exception);
    }

    final QUPCAR004030UVPortType portType = getQUPCAR004030UVService();

    // I set the end point for the PCC10 end point
    setEndPointURI(portType, endpointURI);

    final MCCIIN000002UV01 ack = portType.qupcAR004030UVQUPCIN043200UV(query);
    LOGGER.info("Acknowledge : {} ", ack);

    return ack;
  }
  /**
   * This is never used...
   *
   * <p>Sends secure (SSL) a given PCC10 request to a given PCC10 end point and returns the
   * acknowledge (the response for the request). The message send contains in its SOAP header the
   * response URI.
   *
   * @param query the PCC9 request. It can not be null.
   * @param endpointURI the URI where the PCC10 end point runs. It can not be null.
   * @param responseEndpointURI the URI where the response to the PCC9 request will be send. It can
   *     not be null.
   * @param keystoreFilePath the path for the SSL certificate file, it can not be null.
   * @param keystoreFilePassword the password for the SSL certificate file, it can not be null.
   * @return the acknowledge (the response for the request)for the given request.
   * @throws MalformedURLException if the specified PCC10 end point URI is malformed.
   */
  static MCCIIN000002UV01 sendSecureMessage(
      QUPCIN043200UV01 query,
      String endpointURI,
      String keystoreFilePath,
      String keystoreFilePassword)
      throws MalformedURLException {

    if (keystoreFilePath == null) {
      final NullPointerException exception =
          new NullPointerException("The certPath argument can not be null.");
      LOGGER.error(exception.getMessage(), exception);
      throw exception;
    }

    if (keystoreFilePassword == null) {
      final NullPointerException exception =
          new NullPointerException("The certPassword argument can not be null.");
      LOGGER.error(exception.getMessage(), exception);
      throw exception;
    }
    com.sun.net.ssl.HostnameVerifier myHv =
        new com.sun.net.ssl.HostnameVerifier() {
          public boolean verify(String hostName, String a) {
            return true;
          }
        };
    com.sun.net.ssl.internal.www.protocol.https.HttpsURLConnectionOldImpl
        .setDefaultHostnameVerifier(myHv);
    // or this...
    //	com.sun.net.ssl.HostnameVerifier myHv = new com.sun.net.ssl.HostnameVerifier() {
    //		public boolean verify(String hostName, String a) {
    //			return true;
    //		}
    //	};

    SSLClient.sslSetup(keystoreFilePath, keystoreFilePassword);

    final MCCIIN000002UV01 ack = sendMessage(query, endpointURI);
    return ack;
  }