/* * To change this template, choose Tools | Templates * and open the template in the editor. */ package gov.hhs.fha.nhinc.hiemnotify; import gov.hhs.fha.nhinc.common.nhinccommoninternalorch.NotifyRequestType; import gov.hhs.fha.nhinc.nhinclib.NullChecker; import gov.hhs.fha.nhinc.nhincsubscription.NhincNotificationConsumerService; import gov.hhs.fha.nhinc.nhincsubscription.NotificationConsumer; import gov.hhs.fha.nhinc.saml.extraction.SamlTokenExtractor; import gov.hhs.fha.nhinc.saml.extraction.SamlTokenExtractorHelper; import javax.xml.ws.WebServiceContext; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.oasis_open.docs.wsn.b_2.Notify; /** * * @author jhoppesc */ public class HiemNotifyImpl { private static Log log = LogFactory.getLog(HiemNotifyImpl.class); public static void notify(Notify notifyRequest, WebServiceContext context) { log.debug("Entering HiemNotifyImpl.notify"); NotifyRequestType request = new NotifyRequestType(); request.setNotify(notifyRequest); request.setAssertion(SamlTokenExtractor.GetAssertion(context)); String homeCommunityId = SamlTokenExtractorHelper.getHomeCommunityId(); if (NullChecker.isNotNullish(homeCommunityId)) { NhincNotificationConsumerService service = new NhincNotificationConsumerService(); NotificationConsumer port = service.getNotificationConsumerPort(); ((javax.xml.ws.BindingProvider) port).getRequestContext().put(javax.xml.ws.BindingProvider.ENDPOINT_ADDRESS_PROPERTY, SamlTokenExtractorHelper.getEndpointURL(homeCommunityId, SamlTokenExtractorHelper.INTERNAL_HIEM_NOTIFY)); try { port.notify(request); } catch (Exception e) { log.error("Received Fault: " + e.getMessage()); } } log.debug("Exiting HiemNotifyImpl.notify"); } }