public PRPAIN201310UV02 pixConsumerPRPAIN201309UV(
      PRPAIN201309UV02 request, AssertionType assertion, NhinTargetSystemType target) {
    String url = null;
    PRPAIN201310UV02 resp = new PRPAIN201310UV02();

    // Get the URL to the Nhin Subject Discovery Service
    url = getUrl(target);

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

      SamlTokenCreator tokenCreator = new SamlTokenCreator();
      Map requestContext =
          tokenCreator.CreateRequestContext(
              assertion, url, NhincConstants.SUBJECT_DISCOVERY_ACTION);

      ((BindingProvider) port).getRequestContext().putAll(requestContext);

      resp = port.pixConsumerPRPAIN201309UV(request);

    } else {
      log.error(
          "The URL for service: " + NhincConstants.SUBJECT_DISCOVERY_SERVICE_NAME + " is null");
    }

    return resp;
  }
  public SubscribeResponse subscribe(
      gov.hhs.fha.nhinc.common.nhinccommonentity.SubscribeRequestType subscribeRequest,
      WebServiceContext context)
      throws InvalidFilterFault, InvalidMessageContentExpressionFault,
          InvalidProducerPropertiesExpressionFault, InvalidTopicExpressionFault,
          NotifyMessageNotSupportedFault, ResourceUnknownFault, SubscribeCreationFailedFault,
          TopicExpressionDialectUnknownFault, TopicNotSupportedFault,
          UnacceptableInitialTerminationTimeFault, UnrecognizedPolicyRequestFault,
          UnsupportedPolicyRequestFault {
    log.debug("begin subscribe");
    SubscribeResponse result = null;

    String url = getURL();
    EntityNotificationProducerSecuredPortType port = getPort(url);

    AssertionType assertIn = subscribeRequest.getAssertion();

    SamlTokenCreator tokenCreator = new SamlTokenCreator();
    Map requestContext =
        tokenCreator.CreateRequestContext(
            assertIn, url, NhincConstants.HIEM_NOTIFY_ENTITY_SERVICE_NAME_SECURED);
    ((BindingProvider) port).getRequestContext().putAll(requestContext);

    SubscribeRequestSecuredType securedRequest = new SubscribeRequestSecuredType();

    securedRequest.setSubscribe(subscribeRequest.getSubscribe());
    securedRequest.setNhinTargetCommunities(subscribeRequest.getNhinTargetCommunities());
    try {
      result = port.subscribe(securedRequest);
    } catch (gov.hhs.fha.nhinc.entitysubscriptionmanagementsecured.InvalidFilterFault ex) {
      throw new InvalidFilterFault(ex.getMessage(), ex.getFaultInfo(), ex);
    } catch (
        gov.hhs.fha.nhinc.entitysubscriptionmanagementsecured.InvalidMessageContentExpressionFault
            ex) {
      throw new InvalidMessageContentExpressionFault(ex.getMessage(), ex.getFaultInfo(), ex);
    } catch (
        gov.hhs.fha.nhinc.entitysubscriptionmanagementsecured
                .InvalidProducerPropertiesExpressionFault
            ex) {
      throw new InvalidProducerPropertiesExpressionFault(ex.getMessage(), ex.getFaultInfo(), ex);
    } catch (gov.hhs.fha.nhinc.entitysubscriptionmanagementsecured.InvalidTopicExpressionFault ex) {
      throw new InvalidTopicExpressionFault(ex.getMessage(), ex.getFaultInfo(), ex);
    } catch (
        gov.hhs.fha.nhinc.entitysubscriptionmanagementsecured.NotifyMessageNotSupportedFault ex) {
      throw new NotifyMessageNotSupportedFault(ex.getMessage(), ex.getFaultInfo(), ex);
    } catch (gov.hhs.fha.nhinc.entitysubscriptionmanagementsecured.ResourceUnknownFault ex) {
      throw new ResourceUnknownFault(ex.getMessage(), ex.getFaultInfo(), ex);
    } catch (
        gov.hhs.fha.nhinc.entitysubscriptionmanagementsecured.SubscribeCreationFailedFault ex) {
      throw new SubscribeCreationFailedFault(ex.getMessage(), ex.getFaultInfo(), ex);
    } catch (
        gov.hhs.fha.nhinc.entitysubscriptionmanagementsecured.TopicExpressionDialectUnknownFault
            ex) {
      throw new TopicExpressionDialectUnknownFault(ex.getMessage(), ex.getFaultInfo(), ex);
    } catch (gov.hhs.fha.nhinc.entitysubscriptionmanagementsecured.TopicNotSupportedFault ex) {
      throw new TopicNotSupportedFault(ex.getMessage(), ex.getFaultInfo(), ex);
    } catch (
        gov.hhs.fha.nhinc.entitysubscriptionmanagementsecured
                .UnacceptableInitialTerminationTimeFault
            ex) {
      throw new UnacceptableInitialTerminationTimeFault(ex.getMessage(), ex.getFaultInfo(), ex);
    } catch (
        gov.hhs.fha.nhinc.entitysubscriptionmanagementsecured.UnrecognizedPolicyRequestFault ex) {
      throw new UnrecognizedPolicyRequestFault(ex.getMessage(), ex.getFaultInfo(), ex);
    } catch (
        gov.hhs.fha.nhinc.entitysubscriptionmanagementsecured.UnsupportedPolicyRequestFault ex) {
      throw new UnsupportedPolicyRequestFault(ex.getMessage(), ex.getFaultInfo(), ex);
    }

    return result;
  }
  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);
    }
  }