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    package javax.xml.soap;
020    
021    /**
022     * A point-to-point connection that a client can use for sending messages directly to a remote party
023     * (represented by a URL, for instance).
024     * <p/>
025     * A client can obtain a <code>SOAPConnection</code> object simply by calling the following static
026     * method.
027     * <pre>
028     * <p/>
029     *      SOAPConnection con = SOAPConnection.newInstance();
030     * </pre>
031     * A <code>SOAPConnection</code> object can be used to send messages directly to a URL following the
032     * request/response paradigm.  That is, messages are sent using the method <code>call</code>, which
033     * sends the message and then waits until it gets a reply.
034     */
035    public abstract class SOAPConnection {
036    
037        public SOAPConnection() {
038        }
039    
040        /**
041         * Sends the given message to the specified endpoint and blocks until it has returned the
042         * response.
043         *
044         * @param request  the <CODE>SOAPMessage</CODE> object to be sent
045         * @param endpoint an <code>Object</code> that identifies where the message should be sent. It
046         *                 is required to support Objects of type <code>java.lang.String</code>,
047         *                 <code>java.net.URL</code>, and when JAXM is present <code>javax.xml.messaging.URLEndpoint</code>
048         * @return the <CODE>SOAPMessage</CODE> object that is the response to the message that was
049         *         sent
050         * @throws SOAPException if there is a SOAP error
051         */
052        public abstract SOAPMessage call(SOAPMessage request, Object endpoint)
053                throws SOAPException;
054    
055        /**
056         * Closes this <CODE>SOAPConnection</CODE> object.
057         *
058         * @throws SOAPException if there is a SOAP error
059         */
060        public abstract void close() throws SOAPException;
061    
062        /**
063         * Gets a message from a specific endpoint and blocks until it receives,
064         *
065         * @param to - an Object that identifies where the request should be sent. Objects of type
066         *           java.lang.String and java.net.URL must be supported.
067         * @return the SOAPMessage object that is the response to the get message request
068         * @throws SOAPException - if there is a SOAP error
069         */
070        public SOAPMessage get(Object obj)
071                throws SOAPException {
072            throw new UnsupportedOperationException();
073        }
074    }