[SWS-367] SOAP over JMS (BEA Weblogic 9.2) - empty body in SOAP responses with a jms TextMessage Created: 02/Jun/08  Updated: 21/Jul/08  Resolved: 05/Jun/08

Status: Closed
Project: Spring Web Services
Component/s: XML
Affects Version/s: 1.5.2
Fix Version/s: 1.5.3

Type: Bug Priority: Major
Reporter: Guillaume Menguy Assignee: Arjen Poutsma
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Spring core 2.5.4, Spring-ws 1.5.2 Weblogic 9.2 - jdk 1.5.10


A SOAP request is sent over JMS, the JMSReplyTo is set manually to an internal jms Queue.
Both for normal responses and for soap faults, the produced response (TextMessage) has an empty soap body.

The problem is coming from the following method in org.springframework.ws.transport.jms.JmsReceiverConnection

protected OutputStream getResponseOutputStream() throws IOException {
if (responseMessage instanceof BytesMessage)

{ return new BytesMessageOutputStream((BytesMessage) responseMessage); }

else if (responseMessage instanceof TextMessage) {

return new ByteArrayOutputStream() {

public void close() throws IOException {
String text = new String(toByteArray(), textMessageEncoding);

{ ((TextMessage) responseMessage).setText(text); }

catch (JMSException ex)

{ throw new JmsTransportException(ex); }


{ throw new IllegalStateException("Unknown request message type [" + responseMessage + "]"); }


The close() on the private class set the text property of the TextMessage, but the close() is called AFTER the message has been sent by the JMS message producer :

See this method in the ancestor AbstractWebServiceConnection
public final void send(WebServiceMessage message) throws IOException {
tos = createTransportOutputStream();
if (tos == null)

{ return; }


For a TextMessage the line : message.writeTo(tos) did not set yet the text property of the TextMessage, then the onSendAfterWrite(message) is called, which sends the JMS message to the destination ( see in JmsReceiverConnection).
Finally, a close() is performed in the caller bean ( a message listener) via a TransportUtils.closeConnection(connection) which closes also the private ByteArrayOutputStream, but a bit too late ...

The JMS Specification says :

3.9 Access to Sent Messages
After sending a message, a client may retain and modify it without affecting
the message that has been sent. The same message object may be sent multiple

I have triggered the 'set' of the text property with the flush() method instead of the close(). It solved the problem but it's not very proper because the flush() may be called multiple times when writing in a OutputStream

Comment by Arjen Poutsma [ 21/Jul/08 ]

Closing issues in 1.5.3

Generated at Sat Apr 20 07:09:00 UTC 2019 using JIRA 7.9.2#79002-sha1:3bb15b68ecd99a30eb364c4c1a393359bcad6278.