public static final String JBI_NAMESPACE = "http://java.sun.com/xml/ns/jbi";
public static DocumentFragment getReference(ServiceEndpoint endpoint) {
try {
Document doc = DocumentBuilderFactory.newInstance().newDocumentBuilder().newDocument();
DocumentFragment fragment = doc.createDocumentFragment();
Element epr = doc.createElementNS(JBI_NAMESPACE, "jbi:end-point-reference");
epr.setAttribute("xmlns:jbi", JBI_NAMESPACE);
epr.setAttribute("xmlns:sns", endpoint.getServiceName().getNamespaceURI());
epr.setAttributeNS(JBI_NAMESPACE, "jbi:service-name", "sns:" + endpoint.getServiceName().getLocalPart());
epr.setAttributeNS(JBI_NAMESPACE, "jbi:end-point-name", endpoint.getEndpointName());