コード例 #1
0
  private String getUrl(NhinTargetSystemType target) {
    String url = null;

    if (target != null) {
      try {
        url =
            ConnectionManagerCache.getEndpontURLFromNhinTarget(
                target, NhincConstants.SUBJECT_DISCOVERY_SERVICE_NAME);
      } catch (ConnectionManagerException ex) {
        log.error(
            "Error: Failed to retrieve url for service: "
                + NhincConstants.SUBJECT_DISCOVERY_SERVICE_NAME);
        log.error(ex.getMessage());
      }
    } else {
      log.error("Target system passed into the proxy is null");
    }

    return url;
  }
 private String getUrl(NhinTargetSystemType target, String serviceName) {
   String url = null;
   try {
     url = ConnectionManagerCache.getEndpontURLFromNhinTarget(target, serviceName);
   } catch (ConnectionManagerException ex) {
     log.warn(
         "exception occurred accessing url from connection manager (getEndpontURLFromNhinTarget)",
         ex);
   }
   if (NullChecker.isNullish(url)) {
     try {
       url = ConnectionManagerCache.getLocalEndpointURLByServiceName(serviceName);
     } catch (ConnectionManagerException ex) {
       log.warn(
           "exception occurred accessing url from connection manager (getLocalEndpointURLByServiceName)",
           ex);
     }
   }
   return url;
 }
コード例 #3
0
  public void notify(
      Element notifyElement,
      ReferenceParametersElements referenceParametersElements,
      AssertionType assertion,
      NhinTargetSystemType target) {
    String url = null;

    log.debug(
        "Notify element received in NhinHiemNotifyWebServiceProxy: "
            + XmlUtility.serializeElementIgnoreFaults(notifyElement));

    if (target != null) {
      try {
        url =
            ConnectionManagerCache.getEndpontURLFromNhinTarget(
                target, NhincConstants.HIEM_NOTIFY_SERVICE_NAME);
      } catch (ConnectionManagerException ex) {
        log.error(
            "Error: Failed to retrieve url for service: "
                + NhincConstants.HIEM_NOTIFY_SERVICE_NAME);
        log.error(ex.getMessage());
      }
    } else {
      log.error("Target system passed into the proxy is null");
    }

    try {
      if (NullChecker.isNotNullish(url)) {
        NotificationConsumer port = getPort(url);

        log.debug("unmarshaling notify message");
        WsntSubscribeMarshaller notifyMarshaller = new WsntSubscribeMarshaller();
        Notify notify = notifyMarshaller.unmarshalNotifyRequest(notifyElement);

        //                Element reMarshalled = notifyMarshaller.marshalNotifyRequest(notify);
        //                log.debug("REMARSHALLED: " +
        // XmlUtility.serializeElementIgnoreFaults(reMarshalled));

        // Policy check
        log.debug("Calling checkPolicy");
        if (checkPolicy(notify, assertion)) {
          log.debug("attaching reference parameter headers");
          SoapUtil soapUtil = new SoapUtil();
          soapUtil.attachReferenceParameterElements(
              (WSBindingProvider) port, referenceParametersElements);

          auditInputMessage(notify, assertion);

          log.debug("Calling token creator");
          SamlTokenCreator tokenCreator = new SamlTokenCreator();
          Map requestContext =
              tokenCreator.CreateRequestContext(assertion, url, NhincConstants.SUBSCRIBE_ACTION);
          ((BindingProvider) port).getRequestContext().putAll(requestContext);

          try {
            log.debug("Calling notification consumer port in NhinHiemWebServiceProxy.");
            port.notify(notify);
          } catch (Exception ex) {
            log.error("Error occurred while trying to invoke notify", ex);
          }

          ((Closeable) port).close();
        } else {
          log.error("Failed policy check on send NHIN notify message");
        }
      } else {
        log.error("The URL for service: " + NhincConstants.HIEM_NOTIFY_SERVICE_NAME + " is null");
      }
    } catch (Throwable t) {
      // TODO: Figure out what to do with the exception
      log.error("Error sending notify to remote gateway: " + t.getMessage(), t);
    }
  }