Direct Known Subclasses:
ControlRequest, NotifyRequest

public class SOAPRequestextends HTTPRequest
Represents a SOAP (Simple Object Access Protocol) request message.

This class extends HTTPRequest to handle SOAP protocol messages used in UPnP control operations. It provides functionality for creating and parsing SOAP requests with proper XML formatting and SOAP action headers.

Key features:

  • SOAP action header management
  • XML content parsing and generation
  • SOAP envelope and body handling
  • UTF-8 encoding support
  • HTTP protocol integration

This class is used by UPnP control points to send action invocation requests to UPnP devices, enabling remote procedure calls through SOAP messaging over HTTP.

  • Field Details

    • SOAPACTION

      private static final String SOAPACTION
      Header naming the action a SOAP request carries.
      See Also:
    • rootNode

      private Node rootNode
      /////////////////////////////////////////////
  • Constructor Details

    • SOAPRequest

      public SOAPRequest()
      Creates a POST request carrying the SOAP content type.
    • SOAPRequest

      public SOAPRequest(HTTPRequest httpReq)
      Adopts the headers and body of an existing HTTP request.
      Parameters:
      httpReq - the HTTP request whose headers and body this SOAP request copies
  • Method Details

    • setSOAPAction

      public void setSOAPAction(String action)
      Set the SOAP action header.
      Parameters:
      action - the SOAP action to set
    • getSOAPAction

      public String getSOAPAction()
      Return the SOAP action header value.
      Returns:
      the SOAP action header value
    • isSOAPAction

      public boolean isSOAPAction(String value)
      Check if the SOAP action matches the given value.
      Parameters:
      value - value to compare
      Returns:
      true if the SOAP action matches the given value
    • postMessage

      public SOAPResponse postMessage(String host, int port)
      Post a SOAP message to the target host and port.
      Parameters:
      host - the target host
      port - the target port
      Returns:
      the SOAP response
    • setRootNode

      private void setRootNode(Node node)
      Records the parsed body of the request.
      Parameters:
      node - the root of the SOAP body
    • getRootNode

      private Node getRootNode()
      Parses and caches the body if it has not been parsed.
      Returns:
      the root of the SOAP body
    • setEnvelopeNode

      public void setEnvelopeNode(Node node)
      Set the SOAP envelope node.
      Parameters:
      node - the envelope node to set
    • getEnvelopeNode

      public Node getEnvelopeNode()
      Return the SOAP envelope node.
      Returns:
      the envelope node
    • getBodyNode

      public Node getBodyNode()
      Return the SOAP body node.
      Returns:
      the body node, or null if not available
    • setContent

      public void setContent(Node node)
      Set the XML content from a node.
      Parameters:
      node - the node to set as content
    • print

      public void print()
      Writes the request and its root element to the debug log.
      Overrides:
      print in class HTTPRequest