001    /*
002     * Licensed to the Apache Software Foundation (ASF) under one
003     * or more contributor license agreements.  See the NOTICE file
004     * distributed with this work for additional information
005     * regarding copyright ownership.  The ASF licenses this file
006     * to you under the Apache License, Version 2.0 (the
007     * "License"); you may not use this file except in compliance
008     * with the License.  You may obtain a copy of the License at
009     *
010     *  http://www.apache.org/licenses/LICENSE-2.0
011     *
012     * Unless required by applicable law or agreed to in writing,
013     * software distributed under the License is distributed on an
014     * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
015     * KIND, either express or implied.  See the License for the
016     * specific language governing permissions and limitations
017     * under the License.
018     */
019    
020    package javax.xml.soap;
021    
022    /**
023     * A point-to-point connection that a client can use for sending messages
024     * directly to a remote party (represented by a URL, for instance).
025     * <p>
026     * A client can obtain a <code>SOAPConnection</code> object simply by
027     * calling the following static method.
028     * <pre>
029     *
030     *      SOAPConnection con = SOAPConnection.newInstance();
031     * </pre>
032     * A <code>SOAPConnection</code> object can be used to send messages
033     * directly to a URL following the request/response paradigm.  That is,
034     * messages are sent using the method <code>call</code>, which sends the
035     * message and then waits until it gets a reply.
036     */
037    public abstract class SOAPConnection {
038    
039        public SOAPConnection() {}
040    
041        /**
042         * Sends the given message to the specified endpoint and
043         * blocks until it has returned the response.
044         * @param request the <CODE>SOAPMessage</CODE>
045         *     object to be sent
046         * @param endpoint an <code>Object</code> that identifies
047         *            where the message should be sent. It is required to
048         *            support Objects of type
049         *            <code>java.lang.String</code>,
050         *            <code>java.net.URL</code>, and when JAXM is present
051         *            <code>javax.xml.messaging.URLEndpoint</code>
052         * @return the <CODE>SOAPMessage</CODE> object that is the
053         *     response to the message that was sent
054         * @throws  SOAPException if there is a SOAP error
055         */
056        public abstract SOAPMessage call(SOAPMessage request, Object endpoint)
057            throws SOAPException;
058    
059        /**
060         * Closes this <CODE>SOAPConnection</CODE> object.
061         * @throws  SOAPException if there is a SOAP error
062         */
063        public abstract void close() throws SOAPException;
064    }