org.fourthline.cling.transport.impl

## Class SOAPActionProcessorImpl

- java.lang.Object
- - org.fourthline.cling.transport.impl.SOAPActionProcessorImpl

- All Implemented Interfaces:
    SOAPActionProcessor, ErrorHandler
  Direct Known Subclasses:
    PullSOAPActionProcessorImpl

      public class SOAPActionProcessorImpl
      extends Object
      implements SOAPActionProcessor, ErrorHandler

  Default implementation based on the W3C DOM XML processing API.
  Author:
    Christian Bauer

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `SOAPActionProcessorImpl()`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `protected DocumentBuilderFactory` | `createDocumentBuilderFactory()`
    `protected ActionArgumentValue` | `createValue(ActionArgument arg, String value)` Creates an instance of `ActionArgumentValue` and wraps an `InvalidValueException` as an `ActionException` with the appropriate `ErrorCode`.
    `void` | `error(SAXParseException e)`
    `void` | `fatalError(SAXParseException e)`
    `protected Node` | `findActionArgumentNode(List<Node> nodes, ActionArgument arg)` Returns the node with the same unprefixed name as the action argument name/alias or `null`.
    `protected List<Node>` | `getMatchingNodes(NodeList nodeList, ActionArgument[] args)` Finds all element nodes in the list that match any argument name or argument alias, throws `ActionException` if not all arguments were found.
    `protected String` | `getMessageBody(ActionMessage message)`
    `protected String` | `getUnprefixedNodeName(Node node)`
    `void` | `readActionInputArguments(Element actionRequestElement, ActionInvocation actionInvocation)`
    `protected void` | `readActionOutputArguments(Element actionResponseElement, ActionInvocation actionInvocation)`
    `protected Element` | `readActionRequestElement(Element bodyElement, ActionRequestMessage message, ActionInvocation actionInvocation)`
    `protected Element` | `readActionResponseElement(Element bodyElement, ActionInvocation actionInvocation)`
    `protected ActionArgumentValue[]` | `readArgumentValues(NodeList nodeList, ActionArgument[] args)` The UPnP spec says that action arguments must be in the order as declared by the service.
    `void` | `readBody(ActionRequestMessage requestMessage, ActionInvocation actionInvocation)` Converts SOAP XML content of the request message and sets input argument values on the given invocation.
    `void` | `readBody(ActionResponseMessage responseMsg, ActionInvocation actionInvocation)` Converts SOAP XML content of the response message and sets output argument values on the given invocation.
    `protected Element` | `readBodyElement(Document d)`
    `protected ActionException` | `readBodyFailure(Document d, Element bodyElement)`
    `protected void` | `readBodyRequest(Document d, Element bodyElement, ActionRequestMessage message, ActionInvocation actionInvocation)`
    `protected void` | `readBodyResponse(Document d, Element bodyElement, ActionResponseMessage message, ActionInvocation actionInvocation)`
    `protected ActionException` | `readFaultElement(Element bodyElement)`
    `protected String` | `toString(Document d)`
    `void` | `warning(SAXParseException e)`
    `protected void` | `writeActionInputArguments(Document d, Element actionRequestElement, ActionInvocation actionInvocation)`
    `protected void` | `writeActionOutputArguments(Document d, Element actionResponseElement, ActionInvocation actionInvocation)`
    `protected Element` | `writeActionRequestElement(Document d, Element bodyElement, ActionRequestMessage message, ActionInvocation actionInvocation)`
    `protected Element` | `writeActionResponseElement(Document d, Element bodyElement, ActionResponseMessage message, ActionInvocation actionInvocation)`
    `void` | `writeBody(ActionRequestMessage requestMessage, ActionInvocation actionInvocation)` Converts the given invocation input into SOAP XML content, setting on the given request message.
    `void` | `writeBody(ActionResponseMessage responseMessage, ActionInvocation actionInvocation)` Converts the given invocation output into SOAP XML content, setting on the given response message.
    `protected Element` | `writeBodyElement(Document d)`
    `protected void` | `writeBodyFailure(Document d, Element bodyElement, ActionResponseMessage message, ActionInvocation actionInvocation)`
    `protected void` | `writeBodyRequest(Document d, Element bodyElement, ActionRequestMessage message, ActionInvocation actionInvocation)`
    `protected void` | `writeBodyResponse(Document d, Element bodyElement, ActionResponseMessage message, ActionInvocation actionInvocation)`
    `protected void` | `writeFaultElement(Document d, Element bodyElement, ActionInvocation actionInvocation)`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### SOAPActionProcessorImpl

          public SOAPActionProcessorImpl()

  - ### Method Detail

    - #### createDocumentBuilderFactory

          protected DocumentBuilderFactory createDocumentBuilderFactory()
                                                                 throws FactoryConfigurationError

      Throws:
        `FactoryConfigurationError`

    - #### writeBody

          public void writeBody(ActionRequestMessage requestMessage,
                       ActionInvocation actionInvocation)
                         throws UnsupportedDataException

      Description copied from interface: `SOAPActionProcessor`
      Converts the given invocation input into SOAP XML content, setting on the given request message.
      Specified by:
        `writeBody` in interface `SOAPActionProcessor`
      Parameters:
        `requestMessage` - The request message on which the SOAP content is set.
        `actionInvocation` - The action invocation from which input argument values are read.
      Throws:
        `UnsupportedDataException`

    - #### writeBody

          public void writeBody(ActionResponseMessage responseMessage,
                       ActionInvocation actionInvocation)
                         throws UnsupportedDataException

      Description copied from interface: `SOAPActionProcessor`
      Converts the given invocation output into SOAP XML content, setting on the given response message.
      Specified by:
        `writeBody` in interface `SOAPActionProcessor`
      Parameters:
        `responseMessage` - The response message on which the SOAP content is set.
        `actionInvocation` - The action invocation from which output argument values are read.
      Throws:
        `UnsupportedDataException`

    - #### readBody

          public void readBody(ActionRequestMessage requestMessage,
                      ActionInvocation actionInvocation)
                        throws UnsupportedDataException

      Description copied from interface: `SOAPActionProcessor`
      Converts SOAP XML content of the request message and sets input argument values on the given invocation.
      Specified by:
        `readBody` in interface `SOAPActionProcessor`
      Parameters:
        `requestMessage` - The request message from which SOAP content is read.
        `actionInvocation` - The action invocation on which input argument values are set.
      Throws:
        `UnsupportedDataException`

    - #### readBody

          public void readBody(ActionResponseMessage responseMsg,
                      ActionInvocation actionInvocation)
                        throws UnsupportedDataException

      Description copied from interface: `SOAPActionProcessor`
      Converts SOAP XML content of the response message and sets output argument values on the given invocation.
      Specified by:
        `readBody` in interface `SOAPActionProcessor`
      Parameters:
        `responseMsg` - The response message from which SOAP content is read.
        `actionInvocation` - The action invocation on which output argument values are set.
      Throws:
        `UnsupportedDataException`

    - #### writeBodyFailure

          protected void writeBodyFailure(Document d,
                              Element bodyElement,
                              ActionResponseMessage message,
                              ActionInvocation actionInvocation)
                                   throws Exception

      Throws:
        `Exception`

    - #### writeBodyRequest

          protected void writeBodyRequest(Document d,
                              Element bodyElement,
                              ActionRequestMessage message,
                              ActionInvocation actionInvocation)
                                   throws Exception

      Throws:
        `Exception`

    - #### writeBodyResponse

          protected void writeBodyResponse(Document d,
                               Element bodyElement,
                               ActionResponseMessage message,
                               ActionInvocation actionInvocation)
                                    throws Exception

      Throws:
        `Exception`

    - #### readBodyFailure

          protected ActionException readBodyFailure(Document d,
                                        Element bodyElement)
                                             throws Exception

      Throws:
        `Exception`

    - #### readBodyRequest

          protected void readBodyRequest(Document d,
                             Element bodyElement,
                             ActionRequestMessage message,
                             ActionInvocation actionInvocation)
                                  throws Exception

      Throws:
        `Exception`

    - #### readBodyResponse

          protected void readBodyResponse(Document d,
                              Element bodyElement,
                              ActionResponseMessage message,
                              ActionInvocation actionInvocation)
                                   throws Exception

      Throws:
        `Exception`

    - #### writeBodyElement

          protected Element writeBodyElement(Document d)

    - #### readBodyElement

          protected Element readBodyElement(Document d)

    - #### writeActionRequestElement

          protected Element writeActionRequestElement(Document d,
                                          Element bodyElement,
                                          ActionRequestMessage message,
                                          ActionInvocation actionInvocation)

    - #### readActionRequestElement

          protected Element readActionRequestElement(Element bodyElement,
                                         ActionRequestMessage message,
                                         ActionInvocation actionInvocation)

    - #### writeActionResponseElement

          protected Element writeActionResponseElement(Document d,
                                           Element bodyElement,
                                           ActionResponseMessage message,
                                           ActionInvocation actionInvocation)

    - #### readActionResponseElement

          protected Element readActionResponseElement(Element bodyElement,
                                          ActionInvocation actionInvocation)

    - #### writeActionInputArguments

          protected void writeActionInputArguments(Document d,
                                       Element actionRequestElement,
                                       ActionInvocation actionInvocation)

    - #### readActionInputArguments

          public void readActionInputArguments(Element actionRequestElement,
                                      ActionInvocation actionInvocation)
                                        throws ActionException

      Throws:
        `ActionException`

    - #### writeActionOutputArguments

          protected void writeActionOutputArguments(Document d,
                                        Element actionResponseElement,
                                        ActionInvocation actionInvocation)

    - #### readActionOutputArguments

          protected void readActionOutputArguments(Element actionResponseElement,
                                       ActionInvocation actionInvocation)
                                            throws ActionException

      Throws:
        `ActionException`

    - #### writeFaultElement

          protected void writeFaultElement(Document d,
                               Element bodyElement,
                               ActionInvocation actionInvocation)

    - #### readFaultElement

          protected ActionException readFaultElement(Element bodyElement)

    - #### getMessageBody

          protected String getMessageBody(ActionMessage message)
                                   throws UnsupportedDataException

      Throws:
        `UnsupportedDataException`

    - #### toString

          protected String toString(Document d)
                             throws Exception

      Throws:
        `Exception`

    - #### getUnprefixedNodeName

          protected String getUnprefixedNodeName(Node node)

    - #### readArgumentValues

          protected ActionArgumentValue[] readArgumentValues(NodeList nodeList,
                                                 ActionArgument[] args)
                                                      throws ActionException

      The UPnP spec says that action arguments must be in the order as declared by the service. This method however is lenient, the action argument nodes in the XML can be in any order, as long as they are all there everything is OK.
      Throws:
        `ActionException`

    - #### getMatchingNodes

          protected List<Node> getMatchingNodes(NodeList nodeList,
                                    ActionArgument[] args)
                                         throws ActionException

      Finds all element nodes in the list that match any argument name or argument alias, throws `ActionException` if not all arguments were found.
      Throws:
        `ActionException`

    - #### createValue

          protected ActionArgumentValue createValue(ActionArgument arg,
                                        String value)
                                             throws ActionException

      Creates an instance of `ActionArgumentValue` and wraps an `InvalidValueException` as an `ActionException` with the appropriate `ErrorCode`.
      Throws:
        `ActionException`

    - #### findActionArgumentNode

          protected Node findActionArgumentNode(List<Node> nodes,
                                    ActionArgument arg)

      Returns the node with the same unprefixed name as the action argument name/alias or `null`.

    - #### warning

          public void warning(SAXParseException e)
                       throws SAXException

      Specified by:
        `warning` in interface `ErrorHandler`
      Throws:
        `SAXException`

    - #### error

          public void error(SAXParseException e)
                     throws SAXException

      Specified by:
        `error` in interface `ErrorHandler`
      Throws:
        `SAXException`

    - #### fatalError

          public void fatalError(SAXParseException e)
                          throws SAXException

      Specified by:
        `fatalError` in interface `ErrorHandler`
      Throws:
        `SAXException`

Copyright © 2014 4th Line GmbH, Switzerland. All Rights Reserved.