/* * To change this template, choose Tools | Templates * and open the template in the editor. */ package gov.hhs.fha.nhinc.subscription.dte; import javax.xml.parsers.DocumentBuilderFactory; import javax.xml.parsers.ParserConfigurationException; import javax.xml.ws.wsaddressing.W3CEndpointReference; import javax.xml.ws.wsaddressing.W3CEndpointReferenceBuilder; /** * * @author rayj */ public class ConsumerReferenceHelper { public static W3CEndpointReference CreateConsumerReference(String notificationConsumerEndpointAddress, String userAddress) { W3CEndpointReferenceBuilder endpointReferenceBuilder = new W3CEndpointReferenceBuilder(); //notify address endpointReferenceBuilder.address(notificationConsumerEndpointAddress); //user address DocumentBuilderFactory docBuilderFactory = DocumentBuilderFactory.newInstance(); org.w3c.dom.Document doc; try { doc = docBuilderFactory.newDocumentBuilder().newDocument(); } catch (ParserConfigurationException ex) { throw new RuntimeException("failed to parse document", ex); } org.w3c.dom.Element referenceParameter = doc.createElementNS("http://www.hhs.gov/healthit/nhin", "nhin:UserAddress"); referenceParameter.setTextContent(userAddress); endpointReferenceBuilder.referenceParameter(referenceParameter); W3CEndpointReference ref = endpointReferenceBuilder.build(); return ref; } }