Java XML Transform Usage getWSAAddress(W3CEndpointReference ref)

Here you can find the source of getWSAAddress(W3CEndpointReference ref)

Description

get WSA Address

License

Open Source License

Declaration

public static String getWSAAddress(W3CEndpointReference ref) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.transform.dom.DOMResult;
import javax.xml.ws.wsaddressing.W3CEndpointReference;
import org.apache.log4j.Level;
import org.apache.log4j.Logger;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.NodeList;

public class Main {
    final static Logger log = Logger.getLogger("WS-NotificationBroker");

    public static String getWSAAddress(W3CEndpointReference ref) {
        try {// www.j a va 2s.c o  m
            Document xmlDocument = null;
            xmlDocument = DocumentBuilderFactory.newInstance()
                    .newDocumentBuilder().newDocument();
            Element element = xmlDocument.createElement("elem");
            ref.writeTo(new DOMResult(element));
            NodeList nl = element.getElementsByTagNameNS(
                    "http://www.w3.org/2005/08/addressing", "Address");
            if (nl != null && nl.getLength() > 0) {
                Element e = (Element) nl.item(0);
                log.log(Level.DEBUG, "return " + e.getTextContent().trim()
                        + " for a callback address");
                return e.getTextContent().trim();
            }
        } catch (Exception ex) {
            log.log(Level.WARN,
                    "unable to obtain a WS-Addressing endpoint", ex);
            ex.printStackTrace();
        }
        return null;
    }
}

Related

  1. getSaxSource(File newFile, SAXParserFactory spf)
  2. getSchema(InputStream... inputs)
  3. getSourceFromEndpointReference(EndpointReference epr)
  4. getStreamSources(File[] stylesheets)
  5. getTemplatesByName(File xslF)
  6. getXMLCalendar(Date date)
  7. getXmlEventWriter(Result r)
  8. longToGregorian(long date)
  9. map2Xml(Map map)