01 /*
02 * $Id: SOAPConnection.java,v 1.11 2004/04/02 01:24:17 ofung Exp $
03 * $Revision: 1.11 $
04 * $Date: 2004/04/02 01:24:17 $
05 */
06
07 /*
08 * Copyright 2005-2006 Sun Microsystems, Inc. All Rights Reserved.
09 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
10 *
11 * This code is free software; you can redistribute it and/or modify it
12 * under the terms of the GNU General Public License version 2 only, as
13 * published by the Free Software Foundation. Sun designates this
14 * particular file as subject to the "Classpath" exception as provided
15 * by Sun in the LICENSE file that accompanied this code.
16 *
17 * This code is distributed in the hope that it will be useful, but WITHOUT
18 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
19 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
20 * version 2 for more details (a copy is included in the LICENSE file that
21 * accompanied this code).
22 *
23 * You should have received a copy of the GNU General Public License version
24 * 2 along with this work; if not, write to the Free Software Foundation,
25 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
26 *
27 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
28 * CA 95054 USA or visit www.sun.com if you need additional information or
29 * have any questions.
30 */
31 package javax.xml.soap;
32
33 /**
34 * A point-to-point connection that a client can use for sending messages
35 * directly to a remote party (represented by a URL, for instance).
36 * <p>
37 * The SOAPConnection class is optional. Some implementations may
38 * not implement this interface in which case the call to
39 * <code>SOAPConnectionFactory.newInstance()</code> (see below) will
40 * throw an <code>UnsupportedOperationException</code>.
41 * <p>
42 * A client can obtain a <code>SOAPConnection</code> object using a
43 * {@link SOAPConnectionFactory} object as in the following example:
44 * <PRE>
45 * SOAPConnectionFactory factory = SOAPConnectionFactory.newInstance();
46 * SOAPConnection con = factory.createConnection();
47 * </PRE>
48 * A <code>SOAPConnection</code> object can be used to send messages
49 * directly to a URL following the request/response paradigm. That is,
50 * messages are sent using the method <code>call</code>, which sends the
51 * message and then waits until it gets a reply.
52 */
53 public abstract class SOAPConnection {
54
55 /**
56 * Sends the given message to the specified endpoint and blocks until
57 * it has returned the response.
58 *
59 * @param request the <code>SOAPMessage</code> object to be sent
60 * @param to an <code>Object</code> that identifies
61 * where the message should be sent. It is required to
62 * support Objects of type
63 * <code>java.lang.String</code>,
64 * <code>java.net.URL</code>, and when JAXM is present
65 * <code>javax.xml.messaging.URLEndpoint</code>
66 *
67 * @return the <code>SOAPMessage</code> object that is the response to the
68 * message that was sent
69 * @throws SOAPException if there is a SOAP error
70 */
71 public abstract SOAPMessage call(SOAPMessage request, Object to)
72 throws SOAPException;
73
74 /**
75 * Gets a message from a specific endpoint and blocks until it receives,
76 *
77 * @param to an <code>Object</code> that identifies where
78 * the request should be sent. Objects of type
79 * <code>java.lang.String</code> and
80 * <code>java.net.URL</code> must be supported.
81 *
82 * @return the <code>SOAPMessage</code> object that is the response to the
83 * get message request
84 * @throws SOAPException if there is a SOAP error
85 * @since SAAJ 1.3
86 */
87 public SOAPMessage get(Object to) throws SOAPException {
88 throw new UnsupportedOperationException(
89 "All subclasses of SOAPConnection must override get()");
90 }
91
92 /**
93 * Closes this <code>SOAPConnection</code> object.
94 *
95 * @throws SOAPException if there is a SOAP error
96 */
97 public abstract void close() throws SOAPException;
98 }
|