com.universaldevices.soap
Class UDSOAPRequest

java.lang.Object
  extended by com.universaldevices.soap.UDSOAPRequest

public class UDSOAPRequest
extends java.lang.Object

UDSOAPRequest encapsulates all the necessary methods for sending Web Services/SOAP requests to ISY.

It also takes care of all the security level related tasks

Author:
UD Architect

Constructor Summary
protected UDSOAPRequest(AbstractHTTPRequest request, UDProxyDevice dev)
          Constructor
 
Method Summary
static UDSOAPRequest create(boolean isSSL, java.net.InetSocketAddress address, java.lang.String method, java.lang.String url_path, java.lang.String httpCredentials, UDProxyDevice dev)
          UDSOAPRequest factory method
 java.lang.StringBuffer getSOAPEnvelope(short signatureType, java.lang.String soapAction, java.lang.StringBuffer body)
          Same as getSOAPEnvelope with no attributes
 java.lang.StringBuffer getSOAPEnvelope(short signatureType, java.lang.String soapAction, java.lang.String attributes, java.lang.StringBuffer body)
          Returns the SOAPEnvelope
 void setSocketTimeoutMillis(int v)
          Sets the number of milliseconds before the socket times out.
 UDHTTPResponse submit(java.lang.StringBuffer body, java.lang.String soapAction, short signatureType, boolean encrypt, boolean keep_alive)
          Same as submit without attributes
 UDHTTPResponse submit(java.lang.StringBuffer body, java.lang.String soapAction, java.lang.String attributes, short signatureType, boolean encrypt, boolean keep_alive)
          Submits a SOAP Web Services request to ISY
 UDHTTPResponse subscribe(boolean keep_alive, java.lang.String local_host, int port)
          Subscribe to ISY events
 UDHTTPResponse unsubscribe()
          Unsubscribe from ISY events
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

UDSOAPRequest

protected UDSOAPRequest(AbstractHTTPRequest request,
                        UDProxyDevice dev)
Constructor

Parameters:
request - - the pre-built AbstractHTTPRequest
dev - - the UDProxyDevice which this request is being issued against
Method Detail

setSocketTimeoutMillis

public void setSocketTimeoutMillis(int v)
Sets the number of milliseconds before the socket times out.


subscribe

public UDHTTPResponse subscribe(boolean keep_alive,
                                java.lang.String local_host,
                                int port)
Subscribe to ISY events

Parameters:
keep_alive - - whether or not the socket should be kept alive: ISY event notification engine shall use this same socket to notify the client of changes
local_host - - if keep_alive is false, then this is the IP of the local host which is to be notified of changes. Otherwise, this parameter has no significance
port - if keep_alive is false, then this is the port of the local host which is to be notified of changes. Otherwise, this parameter has no significance
Returns:
- the response as encapsulated in UDHTTPResponse
See Also:
UDHTTPResponse, UDProxyDevice

unsubscribe

public UDHTTPResponse unsubscribe()
Unsubscribe from ISY events

Returns:
- the response as encapsulated by an UDHTTPResponse
See Also:
UDHTTPResponse

getSOAPEnvelope

public java.lang.StringBuffer getSOAPEnvelope(short signatureType,
                                              java.lang.String soapAction,
                                              java.lang.String attributes,
                                              java.lang.StringBuffer body)
Returns the SOAPEnvelope

Parameters:
signatureType - - the type of signature to be used (all defined in UPnPSecurity: NO_SIGNATURE = 0; SIGN_WITH_PUBLIC_KEY = 1; SIGN_WITH_HMAC_KEY = 2;
soapAction - - the SOAP Action
attributes - - attributes for the message. Note that attribute are added as is
body - - the body to be included in the s:Body element of SOAPEnvelope
Returns:
- the SOAP Envelope

getSOAPEnvelope

public java.lang.StringBuffer getSOAPEnvelope(short signatureType,
                                              java.lang.String soapAction,
                                              java.lang.StringBuffer body)
Same as getSOAPEnvelope with no attributes

Parameters:
signatureType -
soapAction -
body -
Returns:
The SOAP Envelope

submit

public UDHTTPResponse submit(java.lang.StringBuffer body,
                             java.lang.String soapAction,
                             java.lang.String attributes,
                             short signatureType,
                             boolean encrypt,
                             boolean keep_alive)
Submits a SOAP Web Services request to ISY

Parameters:
body - - the body to be included in the s:Body element of SOAPEnvelope
soapAction - - the SOAP Action
attributes -
signatureType - - the type of signature to be used (all defined in UPnPSecurity: NO_SIGNATURE = 0; SIGN_WITH_PUBLIC_KEY = 1; SIGN_WITH_HMAC_KEY = 2;D
encrypt - - whether or not to encrypt the contents (of payload)
keep_alive - - whether or not to keep the socket open
Returns:
- the response from ISY
See Also:
UDHTTPResponse

submit

public UDHTTPResponse submit(java.lang.StringBuffer body,
                             java.lang.String soapAction,
                             short signatureType,
                             boolean encrypt,
                             boolean keep_alive)
Same as submit without attributes

Parameters:
body -
soapAction -
signatureType -
encrypt -
keep_alive -
Returns:
UDHTTPResponse

create

public static UDSOAPRequest create(boolean isSSL,
                                   java.net.InetSocketAddress address,
                                   java.lang.String method,
                                   java.lang.String url_path,
                                   java.lang.String httpCredentials,
                                   UDProxyDevice dev)

UDSOAPRequest factory method

Parameters:
isSSL - - whether or not to return UDHTTPRequest or UDHTTPSRequest
address - - the address segment of the URL including port
method - - the method either GET or POST
url_path - - the path segment of the URL (i.e. /web/nodescnf.xml)
httpCredentials - - the Authorization header (use UDHTTPUtil.getHTTPAuthorization())
dev - - the UDProxyDevice representing an instance of ISY
Returns:
- the constructed UDSOAPRequest