Path: blob/aarch64-shenandoah-jdk8u272-b10/jaxws/src/share/jaxws_classes/javax/xml/ws/Dispatch.java
38890 views
/*1* Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.2* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.3*4* This code is free software; you can redistribute it and/or modify it5* under the terms of the GNU General Public License version 2 only, as6* published by the Free Software Foundation. Oracle designates this7* particular file as subject to the "Classpath" exception as provided8* by Oracle in the LICENSE file that accompanied this code.9*10* This code is distributed in the hope that it will be useful, but WITHOUT11* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or12* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License13* version 2 for more details (a copy is included in the LICENSE file that14* accompanied this code).15*16* You should have received a copy of the GNU General Public License version17* 2 along with this work; if not, write to the Free Software Foundation,18* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.19*20* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA21* or visit www.oracle.com if you need additional information or have any22* questions.23*/2425package javax.xml.ws;2627import java.util.concurrent.Future;2829/** The <code>Dispatch</code> interface provides support30* for the dynamic invocation of a service endpoint operations. The31* <code>javax.xml.ws.Service</code>32* class acts as a factory for the creation of <code>Dispatch</code>33* instances.34*35* @since JAX-WS 2.036**/37public interface Dispatch<T> extends BindingProvider {3839/** Invoke a service operation synchronously.40*41* The client is responsible for ensuring that the <code>msg</code> object42* when marshalled is formed according to the requirements of the protocol43* binding in use.44*45* @param msg An object that will form the message or payload of46* the message used to invoke the operation.47* @return The response message or message payload to the48* operation invocation.49* @throws WebServiceException If a fault occurs during communication with50* the service51* @throws WebServiceException If there is any error in the configuration of52* the <code>Dispatch</code> instance53**/54public T invoke(T msg);5556/** Invoke a service operation asynchronously. The57* method returns without waiting for the response to the operation58* invocation, the results of the operation are obtained by polling the59* returned <code>Response</code>.60* <p>61* The client is responsible for ensuring that the <code>msg</code> object62* when marshalled is formed according to the requirements of the protocol63* binding in use.64*65* @param msg An object that will form the message or payload of66* the message used to invoke the operation.67* @return The response message or message payload to the68* operation invocation.69* @throws WebServiceException If there is any error in the configuration of70* the <code>Dispatch</code> instance71**/72public Response<T> invokeAsync(T msg);7374/** Invoke a service operation asynchronously. The75* method returns without waiting for the response to the operation76* invocation, the results of the operation are communicated to the client77* via the passed in <code>handler</code>.78* <p>79* The client is responsible for ensuring that the <code>msg</code> object80* when marshalled is formed according to the requirements of the protocol81* binding in use.82*83* @param msg An object that will form the message or payload of84* the message used to invoke the operation.85* @param handler The handler object that will receive the86* response to the operation invocation.87* @return A <code>Future</code> object that may be used to check the status88* of the operation invocation. This object MUST NOT be used to try to89* obtain the results of the operation - the object returned from90* <code>Future<?>.get()</code> is implementation dependent91* and any use of it will result in non-portable behaviour.92* @throws WebServiceException If there is any error in the configuration of93* the <code>Dispatch</code> instance94**/95public Future<?> invokeAsync(T msg, AsyncHandler<T> handler);9697/** Invokes a service operation using the one-way98* interaction mode. The operation invocation is logically non-blocking,99* subject to the capabilities of the underlying protocol, no results100* are returned. When101* the protocol in use is SOAP/HTTP, this method MUST block until102* an HTTP response code has been received or an error occurs.103* <p>104* The client is responsible for ensuring that the <code>msg</code> object105* when marshalled is formed according to the requirements of the protocol106* binding in use.107*108* @param msg An object that will form the message or payload of109* the message used to invoke the operation.110* @throws WebServiceException If there is any error in the configuration of111* the <code>Dispatch</code> instance or if an error occurs during the112* invocation.113**/114public void invokeOneWay(T msg);115}116117118