Class SOAP


  • public class SOAP
    extends Object
    SOAP is the class which allows sending and receiving of soap messages.
    • Method Detail

      • createFromXMLStreams

        public static SOAP createFromXMLStreams​(InputStream headerStream,
                                                InputStream bodyStream,
                                                String loadOptions)
        Creates a Soap model from a header stream and a body stream.
        Parameters:
        headerStream - - the stream that contains the XML data to load into the header.
        bodyStream - - the stream that contains the XML data to load into the Body.
        loadOptions - - (optional) loading options.
        Returns:
        The created SOAPModel
      • exportContentsToXML

        public static boolean exportContentsToXML​(Element element,
                                                  OutputStream outputStream)
        Export the contents of a SOAP node (and its descendants) to XML. Note that this method is used by the test program. It's unclear whether it has any other value in the public API.
        Parameters:
        element - SOAP node (element) to export.
        outputStream - Output stream to receive the contents of the exported node.
        Returns:
        True if the node was a valid node and successfully exported. To be exported, the node must be a SOAP header or body element.
      • getNodeType

        public static final int getNodeType​(Node node)
        Return the SOAP type of a given DOM node.
        Parameters:
        node - Node for which the type is desired.
        Returns:
        One of SOAP_ENVELOPE, SOAP_HEADER, SOAP_BODY, SOAP_FAULT or SOAP_UNKNOWN, depending on the node.
      • loadFromStream

        public static SOAP loadFromStream​(InputStream stream,
                                          String loadOptions)
        Loads a Soap message into a model from a stream, and creates a hierarchy for it.
        Parameters:
        stream - - the stream that contains the data to load.
        loadOptions - - (optional) loading options.
        Returns:
        The created SOAPModel
      • getBodyNode

        public Element getBodyNode()
        Gets the element which is the SOAP:Body element
        Returns:
        the SOAP:Body element.
      • getEnvelopeNode

        public Element getEnvelopeNode()
        Gets the element which is the Envelope element
        Returns:
        the SOAP:Envelope element.
      • getFaultActor

        public Node getFaultActor()
        Return the fault actor node.
        Returns:
        The faultactor element from the SOAP operation; null if no fault actor.
      • getFaultCode

        public String getFaultCode()
        Return the fault code string (value of faultcode element).
        Returns:
        The fault code from the SOAP operation; null if no fault code.
      • getFaultDetail

        public Node getFaultDetail()
        Return the fault detail string (value of faultdetail element).
        Returns:
        The fault detail from the SOAP operation; null if no fault detail.
      • getFaultNode

        public Element getFaultNode()
        Return the SOAP fault node.
        Returns:
        The fault element from the SOAP operation; null if no fault element.
      • getFaultString

        public String getFaultString()
        Return the fault string (value of faultstring element).
        Returns:
        The fault string from the SOAP operation; null if no fault string.
      • getHeaderNode

        public Element getHeaderNode()
        Gets the element which is the SOAP:Header element
        Returns:
        the SOAP:Header element.
      • getLastError

        public String getLastError()
        Get an error string from the last operation.
        Returns:
        Error string from the last operation; null if that operation succeeded.
      • saveAs

        public void saveAs​(OutputStream outputStream)
        Writes the soap message into a stream.
        Parameters:
        outputStream - - the stream to which the message will be written.
      • sendRequest

        public SOAP sendRequest​(String inSOAPAddress,
                                String inSOAPAction)
        Sends a SOAP message and returns the response.
        Parameters:
        inSOAPAddress - The HTTP address where this SOAP message will be sent.
        inSOAPAction - The SOAP Action.
        Returns:
        SOAPModel which is the response. If the message failed, this will contain the SOAP fault element