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