Class JmsSenderConnection
java.lang.Object
org.springframework.ws.transport.AbstractWebServiceConnection
org.springframework.ws.transport.AbstractSenderConnection
org.springframework.ws.transport.jms.JmsSenderConnection
- All Implemented Interfaces:
AutoCloseable
,HeadersAwareSenderWebServiceConnection
,WebServiceConnection
Implementation of
WebServiceConnection
that is used for client-side JMS access. Exposes a
BytesMessage
request and response message.- Since:
- 1.5.0
- Author:
- Arjen Poutsma, Greg Turnquist
-
Constructor Summary
ModifierConstructorDescriptionprotected
JmsSenderConnection
(jakarta.jms.ConnectionFactory connectionFactory, jakarta.jms.Connection connection, jakarta.jms.Session session, jakarta.jms.Destination requestDestination, jakarta.jms.Message requestMessage) Constructs a new JMS connection with the given parameters. -
Method Summary
Modifier and TypeMethodDescriptionvoid
addRequestHeader
(String name, String value) Adds a request header with the given name and value.Returns the error message.jakarta.jms.Message
Returns the request message for this connection.protected OutputStream
Returns the output stream to write the request to.Returns an iteration over all the header names this request contains.getResponseHeaders
(String name) Returns an iteration over all the string values of the specified header.protected InputStream
Returns the input stream to read the response from.jakarta.jms.Message
Returns the response message, if any, for this connection.getUri()
Returns the URI for this connection.boolean
hasError()
Indicates whether this connection has an error.protected boolean
Indicates whether this connection has a response.protected void
onClose()
Template method invoked fromAbstractWebServiceConnection.close()
.protected void
Called before a message has been read from theTransportInputStream
.protected void
onSendAfterWrite
(WebServiceMessage message) Called after the given message has been written to theTransportOutputStream
.Methods inherited from class org.springframework.ws.transport.AbstractSenderConnection
createTransportInputStream, createTransportOutputStream
Methods inherited from class org.springframework.ws.transport.AbstractWebServiceConnection
close, onReceiveAfterRead, onSendBeforeWrite, receive, send
-
Constructor Details
-
JmsSenderConnection
protected JmsSenderConnection(jakarta.jms.ConnectionFactory connectionFactory, jakarta.jms.Connection connection, jakarta.jms.Session session, jakarta.jms.Destination requestDestination, jakarta.jms.Message requestMessage) throws jakarta.jms.JMSException Constructs a new JMS connection with the given parameters.- Throws:
jakarta.jms.JMSException
-
-
Method Details
-
getRequestMessage
public jakarta.jms.Message getRequestMessage()Returns the request message for this connection. Returns either aBytesMessage
or aTextMessage
. -
getResponseMessage
public jakarta.jms.Message getResponseMessage()Returns the response message, if any, for this connection. Returns either aBytesMessage
or aTextMessage
. -
getUri
Description copied from interface:WebServiceConnection
Returns the URI for this connection.- Throws:
URISyntaxException
-
hasError
Description copied from interface:WebServiceConnection
Indicates whether this connection has an error. Typically, error detection is done by inspecting connection error codes, etc.- Returns:
true
if this connection has an error;false
otherwise.- Throws:
IOException
-
getErrorMessage
Description copied from interface:WebServiceConnection
Returns the error message.- Returns:
- the connection error message, if any; returns
null
when no error is present - Throws:
IOException
- See Also:
-
addRequestHeader
Description copied from interface:HeadersAwareSenderWebServiceConnection
Adds a request header with the given name and value. This method can be called multiple times, to allow for headers with multiple values.- Parameters:
name
- the name of the headervalue
- the value of the header- Throws:
IOException
-
getRequestOutputStream
Description copied from class:AbstractSenderConnection
Returns the output stream to write the request to.- Specified by:
getRequestOutputStream
in classAbstractSenderConnection
- Throws:
IOException
-
onSendAfterWrite
Description copied from class:AbstractWebServiceConnection
Called after the given message has been written to theTransportOutputStream
. Called fromAbstractWebServiceConnection.send(WebServiceMessage)
.Default implementation does nothing.
- Overrides:
onSendAfterWrite
in classAbstractWebServiceConnection
- Parameters:
message
- the message- Throws:
IOException
- when an I/O exception occurs
-
onReceiveBeforeRead
Description copied from class:AbstractWebServiceConnection
Called before a message has been read from theTransportInputStream
. Called fromAbstractWebServiceConnection.receive(WebServiceMessageFactory)
.Default implementation does nothing.
- Overrides:
onReceiveBeforeRead
in classAbstractWebServiceConnection
- Throws:
IOException
- when an I/O exception occurs
-
hasResponse
Description copied from class:AbstractSenderConnection
Indicates whether this connection has a response.- Specified by:
hasResponse
in classAbstractSenderConnection
- Throws:
IOException
-
getResponseHeaderNames
Description copied from interface:HeadersAwareSenderWebServiceConnection
Returns an iteration over all the header names this request contains. Returns an emptyIterator
if there are no headers.- Throws:
IOException
-
getResponseHeaders
Description copied from interface:HeadersAwareSenderWebServiceConnection
Returns an iteration over all the string values of the specified header. Returns an emptyIterator
if there are no headers of the specified name.- Throws:
IOException
-
getResponseInputStream
Description copied from class:AbstractSenderConnection
Returns the input stream to read the response from.- Specified by:
getResponseInputStream
in classAbstractSenderConnection
- Throws:
IOException
-
onClose
Description copied from class:AbstractSenderConnection
Template method invoked fromAbstractWebServiceConnection.close()
. Default implementation is empty.- Overrides:
onClose
in classAbstractSenderConnection
- Throws:
IOException
- if an I/O error occurs when closing this connection
-