Java SOAP Message getBodyContent(SOAPBody body)

Here you can find the source of getBodyContent(SOAPBody body)

Description

Extract the first Node contaning the payload of a SOAPBody/

License

Apache License

Parameter

Parameter Description
body the <code>SOAPBody</code> to extract the payload from

Return

the first Node of the payload

Declaration

public static Node getBodyContent(SOAPBody body) 

Method Source Code

//package com.java2s;
//License from project: Apache License 

import javax.xml.soap.*;

import java.util.Iterator;

public class Main {
    /**//from   w  w w. ja  va2 s  . c o  m
     * Extract the first <code>Node</code> contaning the payload of a <code>SOAPBody</code>/
     *
     * @param body the <code>SOAPBody</code> to extract the payload from
     * @return the first <code>Node</code> of the payload
     */
    public static Node getBodyContent(SOAPBody body) {
        Iterator iterator = body.getChildElements();

        Node firstNode = null;
        while (iterator.hasNext()) {
            Node currentNode = (Node) iterator.next();
            if (currentNode instanceof SOAPBodyElement) {
                firstNode = currentNode;
                break;
            }
        }
        return firstNode;
    }
}

Related

  1. ensureNamespaceDeclared(SOAPElement elem, String namespaceURI, String prefix)
  2. ensureNamespaceDeclared(SOAPElement element, String prefix, String nsURI)
  3. extractXMLPayloadFromSOAPMessage(SOAPMessage messageSOAP)
  4. getAttachmentContentType(SOAPMessage message)
  5. getBody(SOAPMessage m)
  6. getBytes(SOAPMessage soap)
  7. getDeclaredNamespaces(SOAPElement aElement, Map aPrefixMap)
  8. getExcludedTypes()
  9. getFaultCodeAndString(SOAPMessage message)