1 | /*
|
---|
2 | * To change this template, choose Tools | Templates
|
---|
3 | * and open the template in the editor.
|
---|
4 | */
|
---|
5 |
|
---|
6 | package gov.hhs.fha.nhinc.hiemnotify;
|
---|
7 | import gov.hhs.fha.nhinc.common.nhinccommoninternalorch.NotifyRequestType;
|
---|
8 | import gov.hhs.fha.nhinc.nhinclib.NullChecker;
|
---|
9 | import gov.hhs.fha.nhinc.nhincsubscription.NhincNotificationConsumerService;
|
---|
10 | import gov.hhs.fha.nhinc.nhincsubscription.NotificationConsumer;
|
---|
11 | import gov.hhs.fha.nhinc.saml.extraction.SamlTokenExtractor;
|
---|
12 | import gov.hhs.fha.nhinc.saml.extraction.SamlTokenExtractorHelper;
|
---|
13 | import javax.xml.ws.WebServiceContext;
|
---|
14 | import org.apache.commons.logging.Log;
|
---|
15 | import org.apache.commons.logging.LogFactory;
|
---|
16 | import org.oasis_open.docs.wsn.b_2.Notify;
|
---|
17 |
|
---|
18 | /**
|
---|
19 | *
|
---|
20 | * @author jhoppesc
|
---|
21 | */
|
---|
22 | public class HiemNotifyImpl {
|
---|
23 |
|
---|
24 | private static Log log = LogFactory.getLog(HiemNotifyImpl.class);
|
---|
25 |
|
---|
26 | public static void notify(Notify notifyRequest, WebServiceContext context) {
|
---|
27 | log.debug("Entering HiemNotifyImpl.notify");
|
---|
28 |
|
---|
29 | NotifyRequestType request = new NotifyRequestType();
|
---|
30 |
|
---|
31 | request.setNotify(notifyRequest);
|
---|
32 | request.setAssertion(SamlTokenExtractor.GetAssertion(context));
|
---|
33 |
|
---|
34 |
|
---|
35 | String homeCommunityId = SamlTokenExtractorHelper.getHomeCommunityId();
|
---|
36 |
|
---|
37 | if (NullChecker.isNotNullish(homeCommunityId)) {
|
---|
38 | NhincNotificationConsumerService service = new NhincNotificationConsumerService();
|
---|
39 | NotificationConsumer port = service.getNotificationConsumerPort();
|
---|
40 | ((javax.xml.ws.BindingProvider) port).getRequestContext().put(javax.xml.ws.BindingProvider.ENDPOINT_ADDRESS_PROPERTY, SamlTokenExtractorHelper.getEndpointURL(homeCommunityId, SamlTokenExtractorHelper.INTERNAL_HIEM_NOTIFY));
|
---|
41 |
|
---|
42 | try {
|
---|
43 | port.notify(request);
|
---|
44 | } catch (Exception e) {
|
---|
45 | log.error("Received Fault: " + e.getMessage());
|
---|
46 | }
|
---|
47 | }
|
---|
48 |
|
---|
49 | log.debug("Exiting HiemNotifyImpl.notify");
|
---|
50 | }
|
---|
51 |
|
---|
52 | }
|
---|