Example usage for javax.xml.soap SOAPPart createCDATASection

List of usage examples for javax.xml.soap SOAPPart createCDATASection

Introduction

In this page you can find the example usage for javax.xml.soap SOAPPart createCDATASection.

Prototype

public CDATASection createCDATASection(String data) throws DOMException;

Source Link

Document

Creates a CDATASection node whose value is the specified string.

Usage

From source file:fi.vrk.xroad.catalog.lister.WsdlCdataInterceptor.java

@Override
public boolean handleResponse(MessageContext messageContext, Object o) throws Exception {

    WebServiceMessage response = messageContext.getResponse();

    SaajSoapMessage saajSoapMessage = (SaajSoapMessage) response;
    SOAPMessage soapMessage = saajSoapMessage.getSaajMessage();
    SOAPPart soapPart = soapMessage.getSOAPPart();
    SOAPEnvelope envelope = soapPart.getEnvelope();
    SOAPBody body = envelope.getBody();
    Iterator responses = body//from  ww  w.  j a  v a 2s  .co m
            .getChildElements(new QName("http://xroad.vrk.fi/xroad-catalog-lister", "GetWsdlResponse"));
    while (responses.hasNext()) {
        Node wsdlResponse = (Node) responses.next();
        NodeList children = wsdlResponse.getChildNodes();
        for (int i = 0; i < children.getLength(); i++) {
            Node child = children.item(i);
            if (child.getLocalName().equals("wsdl")) {
                CDATASection cdat = soapPart.createCDATASection(child.getFirstChild().getNodeValue());
                child.removeChild(child.getFirstChild());
                child.appendChild(cdat);
            }
        }
    }
    return true;
}