public class HttpMessageSender extends java.lang.Object implements MessageSender
HttpMessageSender to send HCI messages and receive corresponding 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
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.
HttpMessageSenderFactoryMessageSender.IRedirectHandler| Constructor and Description |
|---|
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. |
| Modifier and Type | Method and Description |
|---|---|
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()
Returns the
URL of the server on which the MessageSender is connected. |
SystemStatus |
getSystemStatus(MessageOriginator ori)
Returns the current system status.
|
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) |
public HttpMessageSender(java.lang.String serverUrl,
XMLMapping mapping)
throws java.net.MalformedURLException
HttpMessageSenderFactory.java.net.MalformedURLExceptionpublic HttpMessageSender(java.lang.String serverUrl,
XMLMapping mapping,
javax.net.ssl.SSLSocketFactory sslSocketFactory)
throws java.net.MalformedURLException
HttpMessageSenderFactory.java.net.MalformedURLExceptionpublic HttpMessageSender(java.net.URL serverUrl,
XMLMapping mapping)
HttpMessageSenderFactory.public HttpMessageSender(java.net.URL serverUrl,
XMLMapping mapping,
javax.net.ssl.SSLSocketFactory sslSocketFactory)
HttpMessageSenderFactory.public java.net.URL getServerUrl()
MessageSenderURL of the server on which the MessageSender is connected.getServerUrl in interface MessageSenderURL of the server on which the MessageSender is connectedpublic void addRedirectHandler(MessageSender.IRedirectHandler redirectHandler)
MessageSenderredirection handler to this MessageSender;
This handler is notified of redirection events.addRedirectHandler in interface MessageSenderredirectHandler - The redirection event handler to addMessageSender.IRedirectHandlerpublic void removeRedirectHandler(MessageSender.IRedirectHandler redirectHandler)
MessageSenderMessageSender.IRedirectHandler from this MessageSender;
The handler is not be notified anymore of redirection events.removeRedirectHandler in interface MessageSenderredirectHandler - The redirection event handler to removepublic MessageEnvelope send(MessageEnvelope message) throws CommunicationFailureException, BadMessageFormatException
MessageSenderHCI message and receives its results via the HCI technical interface;
The communications are synchronous.send in interface MessageSendermessage - The message to sendCommunicationFailureException - if the SAP CC system cannot be reachedBadMessageFormatException - if the message received is in a bad formatpublic MessageEnvelope send(MessageEnvelope message, java.util.HashMap<java.lang.String,java.lang.String> addHeaders) throws CommunicationFailureException, BadMessageFormatException
public MessageEnvelope send(MessageEnvelope message, int timeout) throws CommunicationFailureException, BadMessageFormatException
MessageSenderHCI 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.send in interface MessageSendermessage - The HCI message to sendtimeout - The timeout in millisecond (ms), a negative number means no timeoutCommunicationFailureException - if the SAP CC system cannot be reached or
if the timeout expiresBadMessageFormatException - if the message received is in a bad formatpublic MessageEnvelope send(MessageEnvelope message, int timeout, java.util.HashMap<java.lang.String,java.lang.String> addHeaders) throws CommunicationFailureException, BadMessageFormatException
public SystemStatus getSystemStatus(MessageOriginator ori) throws OperationFailureException, CommunicationFailureException
MessageSendergetSystemStatus in interface MessageSenderori - a valid message originator.system statusOperationFailureException - if the system status cannot be retrievedCommunicationFailureException - if the server cannot be contactedpublic MessageContext asyncSend(MessageEnvelope env, ClientMessageListener listener) throws BadMessageFormatException, CommunicationFailureException
MessageSenderHCI message and receives notification of progress
and upon termination of the message process via a dedicated listener.asyncSend in interface MessageSenderenv - The HCI message to sendlistener - A listener that will be notified of
progress and upon termination of
operations and messagemessage context that can be used to cancel
the message or retrieve resultsBadMessageFormatException - if the message is in
a bad formatCommunicationFailureException - if the SAP CC system
cannot be reachedpublic MessageContext asyncSend(MessageEnvelope env, ClientMessageListener listener, java.util.HashMap<java.lang.String,java.lang.String> addHeaders) throws BadMessageFormatException, CommunicationFailureException