com.highdeal.hci.http
Class HttpMessageSender

java.lang.Object
  extended by com.highdeal.hci.http.HttpMessageSender
All Implemented Interfaces:
MessageSender

public class HttpMessageSender
extends java.lang.Object
implements MessageSender

Your client application must use an HttpMessageSender to send HCI messages and receive correspondind results using the HTTP protocol via HCI; Asynchronous or synchronous communications are possible. You use the HttpMessageSenderFactory to instantiate such a Java class.

This HttpMessageSender defines Java classes and method to send

Implementation in Your Client Application

Use the HttpMessageSenderFactory class to instantiate an HttpMessageSender object.

Important Note

This Java class should not be instantiated directly, but obtained through the HttpMessageSenderFactory class.

Use benefit from the asyncSend(..) and send(..) methods to manage the communications between your client application and the connected SAP CC system.

See Also:
HttpMessageSenderFactory

Nested Class Summary
 
Nested classes/interfaces inherited from interface com.highdeal.hci.MessageSender
MessageSender.IRedirectHandler
 
Constructor Summary
HttpMessageSender(java.lang.String serverUrl, XMLMapping mapping)
          Should not be used directly; see HttpMessageSenderFactory.
HttpMessageSender(java.lang.String serverUrl, XMLMapping mapping, javax.net.ssl.SSLSocketFactory sslSocketFactory)
          Should not be used directly; see HttpMessageSenderFactory.
HttpMessageSender(java.net.URL serverUrl, XMLMapping mapping)
          Should not be used directly; see HttpMessageSenderFactory.
HttpMessageSender(java.net.URL serverUrl, XMLMapping mapping, javax.net.ssl.SSLSocketFactory sslSocketFactory)
          Should not be used directly; see HttpMessageSenderFactory.
 
Method Summary
 void addRedirectHandler(MessageSender.IRedirectHandler redirectHandler)
          Adds a redirection handler to this MessageSender; This handler is notified of redirection events.
 MessageContext asyncSend(MessageEnvelope env, ClientMessageListener listener)
          Sends a HCI message and receives notification of progress and upon termination of the message process via a dedicated listener.
 MessageContext asyncSend(MessageEnvelope env, ClientMessageListener listener, java.util.HashMap<java.lang.String,java.lang.String> addHeaders)
           
 java.net.URL getServerUrl()
           
 void removeRedirectHandler(MessageSender.IRedirectHandler redirectHandler)
          Removes a MessageSender.IRedirectHandler from this MessageSender; The handler is not be notified anymore of redirection events.
 MessageEnvelope send(MessageEnvelope message)
          Sends a HCI message and receives its results via the HCI technical interface; The communications are synchronous.
 MessageEnvelope send(MessageEnvelope message, java.util.HashMap<java.lang.String,java.lang.String> addHeaders)
           
 MessageEnvelope send(MessageEnvelope message, int timeout)
          Sends a HCI message and receives its results via the HCI technical interface; this method is protected by a timeout, that means that, if the SAP CC system does not answer within the timeout, a communication failure is sent.
 MessageEnvelope send(MessageEnvelope message, int timeout, java.util.HashMap<java.lang.String,java.lang.String> addHeaders)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

HttpMessageSender

public HttpMessageSender(java.lang.String serverUrl,
                         XMLMapping mapping)
                  throws java.net.MalformedURLException
Should not be used directly; see HttpMessageSenderFactory.

Throws:
java.net.MalformedURLException

HttpMessageSender

public HttpMessageSender(java.lang.String serverUrl,
                         XMLMapping mapping,
                         javax.net.ssl.SSLSocketFactory sslSocketFactory)
                  throws java.net.MalformedURLException
Should not be used directly; see HttpMessageSenderFactory.

Throws:
java.net.MalformedURLException

HttpMessageSender

public HttpMessageSender(java.net.URL serverUrl,
                         XMLMapping mapping)
Should not be used directly; see HttpMessageSenderFactory.


HttpMessageSender

public HttpMessageSender(java.net.URL serverUrl,
                         XMLMapping mapping,
                         javax.net.ssl.SSLSocketFactory sslSocketFactory)
Should not be used directly; see HttpMessageSenderFactory.

Method Detail

getServerUrl

public java.net.URL getServerUrl()

addRedirectHandler

public void addRedirectHandler(MessageSender.IRedirectHandler redirectHandler)
Description copied from interface: MessageSender
Adds a redirection handler to this MessageSender; This handler is notified of redirection events.

Specified by:
addRedirectHandler in interface MessageSender
Parameters:
redirectHandler - The redirection event handler to add
See Also:
MessageSender.IRedirectHandler

removeRedirectHandler

public void removeRedirectHandler(MessageSender.IRedirectHandler redirectHandler)
Description copied from interface: MessageSender
Removes a MessageSender.IRedirectHandler from this MessageSender; The handler is not be notified anymore of redirection events.

Specified by:
removeRedirectHandler in interface MessageSender
Parameters:
redirectHandler - The redirection event handler to remove

send

public MessageEnvelope send(MessageEnvelope message)
                     throws CommunicationFailureException,
                            BadMessageFormatException
Description copied from interface: MessageSender
Sends a HCI message and receives its results via the HCI technical interface; The communications are synchronous.

Specified by:
send in interface MessageSender
Parameters:
message - The message to send
Returns:
The resulting message
Throws:
CommunicationFailureException - if the SAP CC system cannot be reached
BadMessageFormatException - if the message received is in a bad format

send

public MessageEnvelope send(MessageEnvelope message,
                            java.util.HashMap<java.lang.String,java.lang.String> addHeaders)
                     throws CommunicationFailureException,
                            BadMessageFormatException
Throws:
CommunicationFailureException
BadMessageFormatException

send

public MessageEnvelope send(MessageEnvelope message,
                            int timeout)
                     throws CommunicationFailureException,
                            BadMessageFormatException
Description copied from interface: MessageSender
Sends a HCI message and receives its results via the HCI technical interface; this method is protected by a timeout, that means that, if the SAP CC system does not answer within the timeout, a communication failure is sent. Option: You can define a client-side timeout.

Specified by:
send in interface MessageSender
Parameters:
message - The HCI message to send
timeout - The timeout in millisecond (ms), a negative number means no timeout
Returns:
The resulting message
Throws:
CommunicationFailureException - if the SAP CC system cannot be reached or if the timeout expires
BadMessageFormatException - if the message received is in a bad format

send

public MessageEnvelope send(MessageEnvelope message,
                            int timeout,
                            java.util.HashMap<java.lang.String,java.lang.String> addHeaders)
                     throws CommunicationFailureException,
                            BadMessageFormatException
Throws:
CommunicationFailureException
BadMessageFormatException

asyncSend

public MessageContext asyncSend(MessageEnvelope env,
                                ClientMessageListener listener)
                         throws BadMessageFormatException,
                                CommunicationFailureException
Description copied from interface: MessageSender
Sends a HCI message and receives notification of progress and upon termination of the message process via a dedicated listener.

Specified by:
asyncSend in interface MessageSender
Parameters:
env - The HCI message to send
listener - A listener that will be notified of progress and upon termination of operations and message
Returns:
A message context that can be used to cancel the message or retrieve results
Throws:
BadMessageFormatException - if the message is in a bad format
CommunicationFailureException - if the SAP CC system cannot be reached

asyncSend

public MessageContext asyncSend(MessageEnvelope env,
                                ClientMessageListener listener,
                                java.util.HashMap<java.lang.String,java.lang.String> addHeaders)
                         throws BadMessageFormatException,
                                CommunicationFailureException
Throws:
BadMessageFormatException
CommunicationFailureException

Document Published: October 2015 (SAP CC 4.0 SP10 and Later)