Spring Web Services Framework

org.springframework.ws.transport
Class AbstractWebServiceConnection

java.lang.Object
  extended by org.springframework.ws.transport.AbstractWebServiceConnection
All Implemented Interfaces:
WebServiceConnection
Direct Known Subclasses:
AbstractReceiverConnection, AbstractSenderConnection

public abstract class AbstractWebServiceConnection
extends Object
implements WebServiceConnection

Abstract base class for WebServiceConnection implementations.

Since:
1.0.0
Author:
Arjen Poutsma

Constructor Summary
AbstractWebServiceConnection()
           
 
Method Summary
 void close()
          Closes this connection.
protected abstract  TransportInputStream createTransportInputStream()
          Returns a TransportInputStream.
protected abstract  TransportOutputStream createTransportOutputStream()
          Returns a TransportOutputStream for the given message.
protected  void onClose()
          Template method invoked from close().
protected  void onReceiveAfterRead(WebServiceMessage message)
          Called when the given message has been read from the TransportInputStream.
protected  void onReceiveBeforeRead()
          Called before a message has been read from the TransportInputStream.
protected  void onSendAfterWrite(WebServiceMessage message)
          Called after the given message has been written to the TransportOutputStream.
protected  void onSendBeforeWrite(WebServiceMessage message)
          Called before the given message has been written to the TransportOutputStream.
 WebServiceMessage receive(WebServiceMessageFactory messageFactory)
          Receives a message using the given WebServiceMessageFactory.
 void send(WebServiceMessage message)
          Sends the given message using this connection.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.springframework.ws.transport.WebServiceConnection
getErrorMessage, getUri, hasError
 

Constructor Detail

AbstractWebServiceConnection

public AbstractWebServiceConnection()
Method Detail

send

public final void send(WebServiceMessage message)
                throws IOException
Description copied from interface: WebServiceConnection
Sends the given message using this connection.

Specified by:
send in interface WebServiceConnection
Parameters:
message - the message to be sent
Throws:
IOException - in case of I/O errors

onSendBeforeWrite

protected void onSendBeforeWrite(WebServiceMessage message)
                          throws IOException
Called before the given message has been written to the TransportOutputStream. Called from send(WebServiceMessage).

Default implementation does nothing.

Parameters:
message - the message
Throws:
IOException - when an I/O exception occurs

createTransportOutputStream

protected abstract TransportOutputStream createTransportOutputStream()
                                                              throws IOException
Returns a TransportOutputStream for the given message. Called from send(WebServiceMessage).

Returns:
the output stream
Throws:
IOException - when an I/O exception occurs

onSendAfterWrite

protected void onSendAfterWrite(WebServiceMessage message)
                         throws IOException
Called after the given message has been written to the TransportOutputStream. Called from send(WebServiceMessage).

Default implementation does nothing.

Parameters:
message - the message
Throws:
IOException - when an I/O exception occurs

receive

public final WebServiceMessage receive(WebServiceMessageFactory messageFactory)
                                throws IOException
Description copied from interface: WebServiceConnection
Receives a message using the given WebServiceMessageFactory. This method blocks until it receives, or returns null when no message is received.

Specified by:
receive in interface WebServiceConnection
Parameters:
messageFactory - the message factory used for reading messages
Returns:
the read message, or null if no message received
Throws:
IOException - in case of I/O errors

onReceiveBeforeRead

protected void onReceiveBeforeRead()
                            throws IOException
Called before a message has been read from the TransportInputStream. Called from receive(WebServiceMessageFactory).

Default implementation does nothing.

Throws:
IOException - when an I/O exception occurs

createTransportInputStream

protected abstract TransportInputStream createTransportInputStream()
                                                            throws IOException
Returns a TransportInputStream. Called from receive(WebServiceMessageFactory).

Returns:
the input stream, or null if no response can be read
Throws:
IOException - when an I/O exception occurs

onReceiveAfterRead

protected void onReceiveAfterRead(WebServiceMessage message)
                           throws IOException
Called when the given message has been read from the TransportInputStream. Called from receive(WebServiceMessageFactory).

Default implementation does nothing.

Parameters:
message - the message
Throws:
IOException - when an I/O exception occurs

close

public final void close()
                 throws IOException
Description copied from interface: WebServiceConnection
Closes this connection.

Once a connection has been closed, it is not available for further use. A new connection needs to be created.

Specified by:
close in interface WebServiceConnection
Throws:
IOException - if an I/O error occurs when closing this connection

onClose

protected void onClose()
                throws IOException
Template method invoked from close(). Default implementation is empty.

Throws:
IOException - if an I/O error occurs when closing this connection

Spring Web Services Framework

Copyright © 2005-2013 The Spring Web Services Framework. All Rights Reserved.