source: ccr/trunk/nhin-vista/projects/NHINC/Current/Product/Production/Gateway/NhincHiemSubscriptionEJB/src/java/gov/hhs/fha/nhinc/hiemsubscription/HiemSubscriptionImpl.java@ 507

Last change on this file since 507 was 507, checked in by George Lilly, 15 years ago

NHIN gateway and adaptor for use on linux with VistA EHR and RPMS

File size: 2.2 KB
Line 
1/*
2 * To change this template, choose Tools | Templates
3 * and open the template in the editor.
4 */
5package gov.hhs.fha.nhinc.hiemsubscription;
6
7import gov.hhs.fha.nhinc.nhinclib.NullChecker;
8import gov.hhs.fha.nhinc.nhincsubscription.NhincNotificationProducerService;
9import gov.hhs.fha.nhinc.nhincsubscription.NotificationProducer;
10import gov.hhs.fha.nhinc.saml.extraction.SamlTokenExtractorHelper;
11import gov.hhs.fha.nhinc.common.nhinccommoninternalorch.SubscribeRequestType;
12import gov.hhs.fha.nhinc.saml.extraction.SamlTokenExtractor;
13import javax.xml.ws.WebServiceContext;
14import org.apache.commons.logging.Log;
15import org.apache.commons.logging.LogFactory;
16import org.oasis_open.docs.wsn.b_2.Subscribe;
17import org.oasis_open.docs.wsn.b_2.SubscribeResponse;
18
19/**
20 *
21 * @author jhoppesc
22 */
23public class HiemSubscriptionImpl {
24
25 private static Log log = LogFactory.getLog(HiemSubscriptionImpl.class);
26
27 public static SubscribeResponse subscribe(Subscribe subscribeRequest, WebServiceContext context) {
28 log.debug("Entering HiemSubscriptionImpl.subscribe");
29
30 SubscribeResponse resp = new SubscribeResponse();
31 SubscribeRequestType request = new SubscribeRequestType();
32
33 request.setSubscribe(subscribeRequest);
34 request.setAssertion(SamlTokenExtractor.GetAssertion(context));
35
36
37 String homeCommunityId = SamlTokenExtractorHelper.getHomeCommunityId();
38
39 if (NullChecker.isNotNullish(homeCommunityId)) {
40 NhincNotificationProducerService service = new NhincNotificationProducerService();
41 NotificationProducer port = service.getNotificationProducerPort();
42 ((javax.xml.ws.BindingProvider) port).getRequestContext().put(javax.xml.ws.BindingProvider.ENDPOINT_ADDRESS_PROPERTY, SamlTokenExtractorHelper.getEndpointURL(homeCommunityId, SamlTokenExtractorHelper.INTERNAL_HIEM_SUBSCRIBE));
43
44 try {
45 resp = port.subscribe(request);
46 } catch (Exception e) {
47 log.error("Received Fault: " + e.getMessage());
48 resp = null;
49 }
50 }
51 else {
52 resp = null;
53 }
54
55 log.debug("Exiting HiemSubscriptionImpl.subscribe");
56 return resp;
57 }
58}
Note: See TracBrowser for help on using the repository browser.