1 /*
2 * $Id: SOAPConnection.java,v 1.11 2004/04/02 01:24:17 ofung Exp $
3 * $Revision: 1.11 $
4 * $Date: 2004/04/02 01:24:17 $
5 */
6
7 /*
8 * Copyright 2005-2006 Sun Microsystems, Inc. All Rights Reserved.
9 * 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 /**
35 * A point-to-point connection that a client can use for sending messages
36 * directly to a remote party (represented by a URL, for instance).
37 * <p>
38 * The SOAPConnection class is optional. Some implementations may
39 * not implement this interface in which case the call to
40 * <code>SOAPConnectionFactory.newInstance()</code> (see below) will
41 * throw an <code>UnsupportedOperationException</code>.
42 * <p>
43 * A client can obtain a <code>SOAPConnection</code> object using a
44 * {@link SOAPConnectionFactory} object as in the following example:
45 * <PRE>
46 * SOAPConnectionFactory factory = SOAPConnectionFactory.newInstance();
47 * SOAPConnection con = factory.createConnection();
48 * </PRE>
49 * A <code>SOAPConnection</code> object can be used to send messages
50 * directly to a URL following the request/response paradigm. That is,
51 * messages are sent using the method <code>call</code>, which sends the
52 * message and then waits until it gets a reply.
53 */
54 public abstract class SOAPConnection {
55
56 /**
57 * Sends the given message to the specified endpoint and blocks until
58 * it has returned the response.
59 *
60 * @param request the <code>SOAPMessage</code> object to be sent
61 * @param to an <code>Object</code> that identifies
62 * where the message should be sent. It is required to
63 * support Objects of type
64 * <code>java.lang.String</code>,
65 * <code>java.net.URL</code>, and when JAXM is present
66 * <code>javax.xml.messaging.URLEndpoint</code>
67 *
68 * @return the <code>SOAPMessage</code> object that is the response to the
69 * message that was sent
70 * @throws SOAPException if there is a SOAP error
71 */
72 public abstract SOAPMessage call(SOAPMessage request,
73 Object to) throws SOAPException;
74
75 /**
76 * Gets a message from a specific endpoint and blocks until it receives,
77 *
78 * @param to an <code>Object</code> that identifies where
79 * the request should be sent. Objects of type
80 * <code>java.lang.String</code> and
81 * <code>java.net.URL</code> must be supported.
82 *
83 * @return the <code>SOAPMessage</code> object that is the response to the
84 * get message request
85 * @throws SOAPException if there is a SOAP error
86 * @since SAAJ 1.3
87 */
88 public SOAPMessage get(Object to)
89 throws SOAPException {
90 throw new UnsupportedOperationException("All subclasses of SOAPConnection must override get()");
91 }
92
93 /**
94 * Closes this <code>SOAPConnection</code> object.
95 *
96 * @throws SOAPException if there is a SOAP error
97 */
98 public abstract void close()
99 throws SOAPException;
100 }