ohair@286: /* alanb@368: * Copyright (c) 2004, 2012, Oracle and/or its affiliates. All rights reserved. ohair@286: * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. ohair@286: * ohair@286: * This code is free software; you can redistribute it and/or modify it ohair@286: * under the terms of the GNU General Public License version 2 only, as ohair@286: * published by the Free Software Foundation. Oracle designates this ohair@286: * particular file as subject to the "Classpath" exception as provided ohair@286: * by Oracle in the LICENSE file that accompanied this code. ohair@286: * ohair@286: * This code is distributed in the hope that it will be useful, but WITHOUT ohair@286: * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or ohair@286: * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License ohair@286: * version 2 for more details (a copy is included in the LICENSE file that ohair@286: * accompanied this code). ohair@286: * ohair@286: * You should have received a copy of the GNU General Public License version ohair@286: * 2 along with this work; if not, write to the Free Software Foundation, ohair@286: * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. ohair@286: * ohair@286: * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA ohair@286: * or visit www.oracle.com if you need additional information or have any ohair@286: * questions. ohair@286: */ ohair@286: ohair@286: package javax.xml.soap; ohair@286: ohair@286: ohair@286: /** ohair@286: * A point-to-point connection that a client can use for sending messages ohair@286: * directly to a remote party (represented by a URL, for instance). ohair@286: *
ohair@286: * The SOAPConnection class is optional. Some implementations may
ohair@286: * not implement this interface in which case the call to
ohair@286: * SOAPConnectionFactory.newInstance()
(see below) will
ohair@286: * throw an UnsupportedOperationException
.
ohair@286: *
ohair@286: * A client can obtain a SOAPConnection
object using a
ohair@286: * {@link SOAPConnectionFactory} object as in the following example:
ohair@286: *
ohair@286: * SOAPConnectionFactory factory = SOAPConnectionFactory.newInstance(); ohair@286: * SOAPConnection con = factory.createConnection(); ohair@286: *ohair@286: * A
SOAPConnection
object can be used to send messages
ohair@286: * directly to a URL following the request/response paradigm. That is,
ohair@286: * messages are sent using the method call
, which sends the
ohair@286: * message and then waits until it gets a reply.
ohair@286: */
ohair@286: public abstract class SOAPConnection {
ohair@286:
ohair@286: /**
ohair@286: * Sends the given message to the specified endpoint and blocks until
ohair@286: * it has returned the response.
ohair@286: *
ohair@286: * @param request the SOAPMessage
object to be sent
ohair@286: * @param to an Object
that identifies
ohair@286: * where the message should be sent. It is required to
ohair@286: * support Objects of type
ohair@286: * java.lang.String
,
ohair@286: * java.net.URL
, and when JAXM is present
ohair@286: * javax.xml.messaging.URLEndpoint
ohair@286: *
ohair@286: * @return the SOAPMessage
object that is the response to the
ohair@286: * message that was sent
ohair@286: * @throws SOAPException if there is a SOAP error
ohair@286: */
ohair@286: public abstract SOAPMessage call(SOAPMessage request,
ohair@286: Object to) throws SOAPException;
ohair@286:
ohair@286: /**
ohair@286: * Gets a message from a specific endpoint and blocks until it receives,
ohair@286: *
ohair@286: * @param to an Object
that identifies where
ohair@286: * the request should be sent. Objects of type
ohair@286: * java.lang.String
and
ohair@286: * java.net.URL
must be supported.
ohair@286: *
ohair@286: * @return the SOAPMessage
object that is the response to the
ohair@286: * get message request
ohair@286: * @throws SOAPException if there is a SOAP error
ohair@286: * @since SAAJ 1.3
ohair@286: */
ohair@286: public SOAPMessage get(Object to)
ohair@286: throws SOAPException {
ohair@286: throw new UnsupportedOperationException("All subclasses of SOAPConnection must override get()");
ohair@286: }
ohair@286:
ohair@286: /**
ohair@286: * Closes this SOAPConnection
object.
ohair@286: *
ohair@286: * @throws SOAPException if there is a SOAP error
ohair@286: */
ohair@286: public abstract void close()
ohair@286: throws SOAPException;
ohair@286: }