source: ccr/trunk/nhin-vista/projects/NHINC/Current/Product/Production/Gateway/SubscriptionDteEjb/src/java/gov/hhs/fha/nhinc/subscription/dte/ConsumerReferenceHelper.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: 1.5 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.subscription.dte;
6
7import javax.xml.parsers.DocumentBuilderFactory;
8import javax.xml.parsers.ParserConfigurationException;
9import javax.xml.ws.wsaddressing.W3CEndpointReference;
10import javax.xml.ws.wsaddressing.W3CEndpointReferenceBuilder;
11
12/**
13 *
14 * @author rayj
15 */
16public class ConsumerReferenceHelper {
17
18 public static W3CEndpointReference CreateConsumerReference(String notificationConsumerEndpointAddress, String userAddress) {
19 W3CEndpointReferenceBuilder endpointReferenceBuilder = new W3CEndpointReferenceBuilder();
20
21 //notify address
22 endpointReferenceBuilder.address(notificationConsumerEndpointAddress);
23
24 //user address
25 DocumentBuilderFactory docBuilderFactory = DocumentBuilderFactory.newInstance();
26
27 org.w3c.dom.Document doc;
28 try {
29 doc = docBuilderFactory.newDocumentBuilder().newDocument();
30 } catch (ParserConfigurationException ex) {
31 throw new RuntimeException("failed to parse document", ex);
32 }
33 org.w3c.dom.Element referenceParameter = doc.createElementNS("http://www.hhs.gov/healthit/nhin", "nhin:UserAddress");
34 referenceParameter.setTextContent(userAddress);
35 endpointReferenceBuilder.referenceParameter(referenceParameter);
36
37 W3CEndpointReference ref = endpointReferenceBuilder.build();
38 return ref;
39 }
40}
Note: See TracBrowser for help on using the repository browser.