Package com.highdeal.hci.http
Class HttpMessageSender
java.lang.Object
com.highdeal.hci.http.HttpMessageSender
- All Implemented Interfaces:
MessageSender
Your client application must use an
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
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:
-
Nested Class Summary
Nested classes/interfaces inherited from interface com.highdeal.hci.MessageSender
MessageSender.IRedirectHandler -
Constructor Summary
ConstructorsConstructorDescriptionHttpMessageSender(String serverUrl, XMLMapping mapping) Should not be used directly; seeHttpMessageSenderFactory.HttpMessageSender(String serverUrl, XMLMapping mapping, SSLSocketFactory sslSocketFactory) Should not be used directly; seeHttpMessageSenderFactory.HttpMessageSender(URL serverUrl, XMLMapping mapping) Should not be used directly; seeHttpMessageSenderFactory.HttpMessageSender(URL serverUrl, XMLMapping mapping, SSLSocketFactory sslSocketFactory) Should not be used directly; seeHttpMessageSenderFactory. -
Method Summary
Modifier and TypeMethodDescriptionvoidaddRedirectHandler(MessageSender.IRedirectHandler redirectHandler) Adds aredirection handlerto thisMessageSender; This handler is notified of redirection events.asyncSend(MessageEnvelope env, ClientMessageListener listener) Sends aHCI messageand receives notification of progress and upon termination of the message process via adedicated listener.asyncSend(MessageEnvelope env, ClientMessageListener listener, Map<String, String> headers) Returns theURLof the server on which the MessageSender is connected.Returns the current system status.voidremoveRedirectHandler(MessageSender.IRedirectHandler redirectHandler) Removes aMessageSender.IRedirectHandlerfrom thisMessageSender; The handler is not be notified anymore of redirection events.send(MessageEnvelope message) Sends aHCI messageand receives its results via the HCI technical interface; The communications are synchronous.send(MessageEnvelope message, int timeout) Sends aHCI messageand 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.send(MessageEnvelope message, int timeout, Map<String, String> headers) send(MessageEnvelope message, Map<String, String> headers)
-
Constructor Details
-
HttpMessageSender
Should not be used directly; seeHttpMessageSenderFactory.- Throws:
MalformedURLException
-
HttpMessageSender
public HttpMessageSender(String serverUrl, XMLMapping mapping, SSLSocketFactory sslSocketFactory) throws MalformedURLException Should not be used directly; seeHttpMessageSenderFactory.- Throws:
MalformedURLException
-
HttpMessageSender
Should not be used directly; seeHttpMessageSenderFactory. -
HttpMessageSender
Should not be used directly; seeHttpMessageSenderFactory.
-
-
Method Details
-
getServerUrl
Description copied from interface:MessageSenderReturns theURLof the server on which the MessageSender is connected.- Specified by:
getServerUrlin interfaceMessageSender- Returns:
- the
URLof the server on which the MessageSender is connected
-
addRedirectHandler
Description copied from interface:MessageSenderAdds aredirection handlerto thisMessageSender; This handler is notified of redirection events.- Specified by:
addRedirectHandlerin interfaceMessageSender- Parameters:
redirectHandler- The redirection event handler to add- See Also:
-
removeRedirectHandler
Description copied from interface:MessageSenderRemoves aMessageSender.IRedirectHandlerfrom thisMessageSender; The handler is not be notified anymore of redirection events.- Specified by:
removeRedirectHandlerin interfaceMessageSender- Parameters:
redirectHandler- The redirection event handler to remove
-
send
public MessageEnvelope send(MessageEnvelope message) throws CommunicationFailureException, BadMessageFormatException Description copied from interface:MessageSenderSends aHCI messageand receives its results via the HCI technical interface; The communications are synchronous.- Specified by:
sendin interfaceMessageSender- Parameters:
message- The message to send- Returns:
- The resulting message
- Throws:
CommunicationFailureException- if the SAP CC system cannot be reachedBadMessageFormatException- if the message received is in a bad format
-
send
public MessageEnvelope send(MessageEnvelope message, Map<String, String> headers) throws CommunicationFailureException, BadMessageFormatException -
send
public MessageEnvelope send(MessageEnvelope message, int timeout) throws CommunicationFailureException, BadMessageFormatException Description copied from interface:MessageSenderSends aHCI messageand 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:
sendin interfaceMessageSender- Parameters:
message- The HCI message to sendtimeout- 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 expiresBadMessageFormatException- if the message received is in a bad format
-
send
public MessageEnvelope send(MessageEnvelope message, int timeout, Map<String, String> headers) throws CommunicationFailureException, BadMessageFormatException -
getSystemStatus
public SystemStatus getSystemStatus(MessageOriginator ori) throws OperationFailureException, CommunicationFailureException Description copied from interface:MessageSenderReturns the current system status.- Specified by:
getSystemStatusin interfaceMessageSender- Parameters:
ori- a validmessage originator.- Returns:
- the current
system status - Throws:
OperationFailureException- if the system status cannot be retrievedCommunicationFailureException- if the server cannot be contacted
-
asyncSend
public MessageContext asyncSend(MessageEnvelope env, ClientMessageListener listener) throws BadMessageFormatException, CommunicationFailureException Description copied from interface:MessageSenderSends aHCI messageand receives notification of progress and upon termination of the message process via adedicated listener.- Specified by:
asyncSendin interfaceMessageSender- Parameters:
env- The HCI message to sendlistener- Alistenerthat will be notified of progress and upon termination of operations and message- Returns:
- A
message contextthat can be used to cancel the message or retrieve results - Throws:
BadMessageFormatException- if the message is in a bad formatCommunicationFailureException- if the SAP CC system cannot be reached
-
asyncSend
public MessageContext asyncSend(MessageEnvelope env, ClientMessageListener listener, Map<String, String> headers) throws BadMessageFormatException, CommunicationFailureException
-