Example usage for org.springframework.integration.xml.source DomSourceFactory DomSourceFactory

List of usage examples for org.springframework.integration.xml.source DomSourceFactory DomSourceFactory

Introduction

In this page you can find the example usage for org.springframework.integration.xml.source DomSourceFactory DomSourceFactory.

Prototype

public DomSourceFactory() 

Source Link

Usage

From source file:ru.lanit.bpm.avatar.webservice.SimpleEchoResponder.java

public Source issueResponseFor(DOMSource request) {
    return new DomSourceFactory()
            .createSource("<echoResponse xmlns=\"http://www.springframework.org/spring-ws/samples/echo\">"
                    + request.getNode().getTextContent() + "</echoResponse>");
}

From source file:com.yamanyar.esb.services.XmlEcho.java

public Source issueResponseFor(DOMSource request) {
    String address;/* ww  w . j  a v  a 2s. co m*/

    try {
        address = InetAddress.getLocalHost().getHostAddress();
    } catch (UnknownHostException e) {
        //use default address
        address = "test-server";
        logger.error("Can not find local host name", e);
    }

    return new DomSourceFactory().createSource("<echoResponse xmlns=\"http://" + address + "/echo\">"
            + request.getNode().getTextContent() + "</echoResponse>");
}

From source file:com.apress.prospringintegration.webservice.web.TicketIssuerEndpoint.java

@ServiceActivator
public Source handleRequest(DOMSource source) throws Exception {

    NodeList nodeList = source.getNode().getChildNodes();
    String description = "";
    String priority = "";

    for (int i = 0; i < nodeList.getLength(); i++) {
        Node node = nodeList.item(i);
        if (node.getNodeName().equals("priority")) {
            priority = node.getFirstChild().getNodeValue();
        } else if (node.getNodeName().equals("description")) {
            description = node.getFirstChild().getNodeValue();
        }/*w w w .  j  ava  2 s. c om*/
    }

    // Transfer properties to an XML document
    String xml = String.format(replyTemplate, description, priority, new Random().nextLong() * 1000,
            new Date());

    return new DomSourceFactory().createSource(xml);
}