org.fourthline.cling.transport.impl

## Class RecoveringSOAPActionProcessorImpl

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

- All Implemented Interfaces:
    SOAPActionProcessor, ErrorHandler

      @Alternative
      public class RecoveringSOAPActionProcessorImpl
      extends PullSOAPActionProcessorImpl

  Implementation based on the Xml Pull Parser XML processing API.

  This processor extends `PullSOAPActionProcessorImpl`, it will always first try to read messages regularly with the superclass' methods before trying to recover from a failure.

  When the superclass can't read the message, this processor will try to recover from broken XML by for example, detecting wrongly encoded XML entities, and working around other vendor-specific bugs caused by incompatible UPnP stacks in the wild.

  Additionally any `UnsupportedDataException` thrown while reading an XML message will be passed on to the `handleInvalidMessage(org.fourthline.cling.model.action.ActionInvocation, org.fourthline.cling.model.UnsupportedDataException, org.fourthline.cling.model.UnsupportedDataException)` method for you to handle. The default implementation will simply throw the original exception from the first processing attempt.

  Author:
    Michael Pujos

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `RecoveringSOAPActionProcessorImpl()`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `protected void` | `handleInvalidMessage(ActionInvocation actionInvocation, UnsupportedDataException originalException, UnsupportedDataException recoveringException)` Handle processing errors while reading of XML messages.
    `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.

    - ### Methods inherited from class org.fourthline.cling.transport.impl.PullSOAPActionProcessorImpl

      `findActionArgumentValue, getMatchingNodes, readActionInputArguments, readActionOutputArguments, readArgumentValues, readBodyElement, readBodyRequest, readBodyResponse, readFaultElement`

    - ### Methods inherited from class org.fourthline.cling.transport.impl.SOAPActionProcessorImpl

      `createDocumentBuilderFactory, createValue, error, fatalError, findActionArgumentNode, getMatchingNodes, getMessageBody, getUnprefixedNodeName, readActionInputArguments, readActionOutputArguments, readActionRequestElement, readActionResponseElement, readArgumentValues, readBodyElement, readBodyFailure, readBodyRequest, readBodyResponse, readFaultElement, toString, warning, writeActionInputArguments, writeActionOutputArguments, writeActionRequestElement, writeActionResponseElement, writeBody, writeBody, writeBodyElement, writeBodyFailure, writeBodyRequest, writeBodyResponse, writeFaultElement`

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

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

- - ### Constructor Detail

    - #### RecoveringSOAPActionProcessorImpl

          public RecoveringSOAPActionProcessorImpl()

  - ### Method Detail

    - #### 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`
      Overrides:
        `readBody` in class `PullSOAPActionProcessorImpl`
      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`
      Overrides:
        `readBody` in class `PullSOAPActionProcessorImpl`
      Parameters:
        `responseMsg` - The response message from which SOAP content is read.
        `actionInvocation` - The action invocation on which output argument values are set.
      Throws:
        `UnsupportedDataException`

    - #### handleInvalidMessage

          protected void handleInvalidMessage(ActionInvocation actionInvocation,
                                              UnsupportedDataException originalException,
                                              UnsupportedDataException recoveringException)
                                       throws UnsupportedDataException

      Handle processing errors while reading of XML messages.

      Typically you want to log this problem or create an error report, and in any case, throw an `UnsupportedDataException` to notify the caller of the processor of this failure.

      You can access the invalid XML with `UnsupportedDataException.getData()`.

      Parameters:
        `originalException` - The original exception throw by the first parsing attempt
        `recoveringException` - The exception thrown after trying to fix the XML.
      Throws:
        `UnsupportedDataException`

Copyright © 2016 4th Line GmbH, Switzerland. All rights reserved.