Class SoapUtils


  • public abstract class SoapUtils
    extends Object
    Generic constants and subroutines for SOAP/XML processing.
    Author:
    Dmytro Rud
    • Field Detail

      • WS_ADDRESSING_NS_URIS

        public static final Set<String> WS_ADDRESSING_NS_URIS
        Set of URIs corresponding to supported WS-Addressing specification versions.
      • SOAP_NS_URIS

        public static final Set<String> SOAP_NS_URIS
        Set of URIs corresponding to supported SOAP versions.
    • Method Detail

      • extractSoapBody

        public static String extractSoapBody​(String soapEnvelope)
        Extracts the proper body (for example, a Query) from the SOAP envelope, both represented as Strings.

        Does really suppose that the given String contains a SOAP envelope and not check it thoroughly.

        Parameters:
        soapEnvelope - The SOAP Envelope (XML document) as String.
        Returns:
        Extracted SOAP Body contents as String, or the original parameter when it does not seem to represent a valid SOAP envelope.
      • extractOutgoingException

        public static Exception extractOutgoingException​(org.apache.cxf.message.Exchange exchange)
        Returns Exception object from the outgoing fault message contained in the given CXF exchange, or null, when no exception could be extracted.
      • extractOutgoingPayload

        public static String extractOutgoingPayload​(org.apache.cxf.message.Exchange exchange)
        Returns String payload of the outgoing message contained in the given CXF exchange, or null, when no String payload could be extracted.
      • getElementNS

        public static Element getElementNS​(Element root,
                                           Set<String> nsUris,
                                           String wantedLocalName)
        Searches for the first sub-element of the given XML element, which has the given local name and whose namespace belongs to the given set.
        Parameters:
        root - an XML element whose children will be iterated, null values are allowed
        nsUris - a set of namespace URIs the wanted element can belong to
        wantedLocalName - local name of the wanted element
        Returns:
        corresponding child element or null when none found