Name
SOAPConnection
Synopsis
public abstract class SOAPConnection {
// Public Constructors
public SOAPConnection( );
// Public Instance Methods
public abstract SOAPMessage call(SOAPMessage request
, Object to)
throws SOAPException;
public abstract void close( ) throws SOAPException;
}
SOAPConnection
is an object that can be used to
send SOAP messages. Despite its name, it does not represent a
connection in the traditional sense, since it does not have a fixed
association with a peer object. Instead, it is better thought of as
an access point that can be used to send any number of individually
addressed SOAP messages to arbitrary receivers.
To obtain a SOAPConnection
, you need to use a
SOAPConnectionFactory
:
SOAPConnectionFactory factory = SOAPConnectionFactory.newInstance; SOAPConnection conn = factory.createConnection;
Both SOAPConnectionFactory
and
SOAPConnection
are abstract classes, concrete
instances of which are provided by your SAAJ implementation. The fact
that the SOAPConnectionFactory
newInstance( )
method searches for a suitable
implementation class (as described in its reference section in this
chapter) means that you can plug in different SAAJ implementations
without changing your application code. When a
SOAPConnection
is no longer required, it should be
released by calling its close( )
method.
The call( )
method takes a
SOAPMessage
object, serializes it into XML, and
sends it to the destination given by its to
argument. This argument is declared to be of type
Object
, which ...
Get Java Web Services in a Nutshell now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.