View Javadoc
1   /*
2    * Copyright (C) 2013 4th Line GmbH, Switzerland
3    *
4    * The contents of this file are subject to the terms of either the GNU
5    * Lesser General Public License Version 2 or later ("LGPL") or the
6    * Common Development and Distribution License Version 1 or later
7    * ("CDDL") (collectively, the "License"). You may not use this file
8    * except in compliance with the License. See LICENSE.txt for more
9    * information.
10   *
11   * This program is distributed in the hope that it will be useful,
12   * but WITHOUT ANY WARRANTY; without even the implied warranty of
13   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
14   */
15  
16  package org.fourthline.cling.transport.spi;
17  
18  import org.fourthline.cling.model.UnsupportedDataException;
19  import org.fourthline.cling.model.action.ActionInvocation;
20  import org.fourthline.cling.model.message.control.ActionRequestMessage;
21  import org.fourthline.cling.model.message.control.ActionResponseMessage;
22  
23  /**
24   * Converts UPnP SOAP messages from/to action invocations.
25   * <p>
26   * The UPnP protocol layer processes local and remote {@link org.fourthline.cling.model.action.ActionInvocation}
27   * instances. The UPnP transport layer accepts and returns {@link org.fourthline.cling.model.message.StreamRequestMessage}s
28   * and {@link org.fourthline.cling.model.message.StreamResponseMessage}s. This processor is an adapter between the
29   * two layers, reading and writing SOAP content.
30   * </p>
31   *
32   * @author Christian Bauer
33   */
34  public interface SOAPActionProcessor {
35  
36      /**
37       * Converts the given invocation input into SOAP XML content, setting on the given request message.
38       *
39       * @param requestMessage The request message on which the SOAP content is set.
40       * @param actionInvocation The action invocation from which input argument values are read.
41       * @throws org.fourthline.cling.model.UnsupportedDataException
42       */
43      public void writeBody(ActionRequestMessage requestMessage, ActionInvocation actionInvocation) throws UnsupportedDataException;
44  
45      /**
46       * Converts the given invocation output into SOAP XML content, setting on the given response message.
47       *
48       * @param responseMessage The response message on which the SOAP content is set.
49       * @param actionInvocation The action invocation from which output argument values are read.
50       * @throws UnsupportedDataException
51       */
52      public void writeBody(ActionResponseMessage responseMessage, ActionInvocation actionInvocation) throws UnsupportedDataException;
53  
54      /**
55       * Converts SOAP XML content of the request message and sets input argument values on the given invocation.
56       *
57       * @param requestMessage The request message from which SOAP content is read.
58       * @param actionInvocation The action invocation on which input argument values are set.
59       * @throws UnsupportedDataException
60       */
61      public void readBody(ActionRequestMessage requestMessage, ActionInvocation actionInvocation) throws UnsupportedDataException;
62  
63      /**
64       * Converts SOAP XML content of the response message and sets output argument values on the given invocation.
65       *
66       * @param responseMsg The response message from which SOAP content is read.
67       * @param actionInvocation The action invocation on which output argument values are set.
68       * @throws UnsupportedDataException
69       */
70      public void readBody(ActionResponseMessage responseMsg, ActionInvocation actionInvocation) throws UnsupportedDataException;
71  
72  }