KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > wsif > WSIFOperation


1 /*
2  * The Apache Software License, Version 1.1
3  *
4  *
5  * Copyright (c) 2002 The Apache Software Foundation. All rights
6  * reserved.
7  *
8  * Redistribution and use in source and binary forms, with or without
9  * modification, are permitted provided that the following conditions
10  * are met:
11  *
12  * 1. Redistributions of source code must retain the above copyright
13  * notice, this list of conditions and the following disclaimer.
14  *
15  * 2. Redistributions in binary form must reproduce the above copyright
16  * notice, this list of conditions and the following disclaimer in
17  * the documentation and/or other materials provided with the
18  * distribution.
19  *
20  * 3. The end-user documentation included with the redistribution,
21  * if any, must include the following acknowledgment:
22  * "This product includes software developed by the
23  * Apache Software Foundation (http://www.apache.org/)."
24  * Alternately, this acknowledgment may appear in the software itself,
25  * if and wherever such third-party acknowledgments normally appear.
26  *
27  * 4. The names "WSIF" and "Apache Software Foundation" must
28  * not be used to endorse or promote products derived from this
29  * software without prior written permission. For written
30  * permission, please contact apache@apache.org.
31  *
32  * 5. Products derived from this software may not be called "Apache",
33  * nor may "Apache" appear in their name, without prior written
34  * permission of the Apache Software Foundation.
35  *
36  * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
37  * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
38  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
39  * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
40  * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
41  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
42  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
43  * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
44  * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
45  * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
46  * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
47  * SUCH DAMAGE.
48  * ====================================================================
49  *
50  * This software consists of voluntary contributions made by many
51  * individuals on behalf of the Apache Software Foundation and was
52  * originally based on software copyright (c) 2001, 2002, International
53  * Business Machines, Inc., http://www.apache.org. For more
54  * information on the Apache Software Foundation, please see
55  * <http://www.apache.org/>.
56  */

57
58 package org.apache.wsif;
59
60 import java.io.Serializable JavaDoc;
61
62 /**
63  * A WSIFOperation is a handle on a particular operation of a portType
64  * that can be used to invoke web service methods. This interface is
65  * implemented by each provider. A WSIFOperation can be created using
66  * {@link WSIFPort#createOperation(String)}.
67  *
68  * @author Owen Burroughs <owenb@apache.org>
69  * @author Ant Elder <antelder@apache.org>
70  * @author Jeremy Hughes <hughesj@apache.org>
71  * @author Mark Whitlock <whitlock@apache.org>
72  */

73 public interface WSIFOperation extends Serializable JavaDoc {
74
75     /**
76      * Execute a request-response operation. The signature allows for
77      * input, output and fault messages. WSDL in fact allows one to
78      * describe the set of possible faults an operation may result
79      * in, however, only one fault can occur at any one time.
80      *
81      * @param op name of operation to execute
82      * @param input input message to send to the operation
83      * @param output an empty message which will be filled in if
84      * the operation invocation succeeds. If it does not
85      * succeed, the contents of this message are undefined.
86      * (This is a return value of this method.)
87      * @param fault an empty message which will be filled in if
88      * the operation invocation fails. If it succeeds, the
89      * contents of this message are undefined. (This is a
90      * return value of this method.)
91      *
92      * @return true or false indicating whether a fault message was
93      * generated or not. The truth value indicates whether
94      * the output or fault message has useful information.
95      *
96      * @exception WSIFException if something goes wrong.
97      */

98     public boolean executeRequestResponseOperation(
99         WSIFMessage input,
100         WSIFMessage output,
101         WSIFMessage fault)
102         throws WSIFException;
103
104     /**
105      * Execute an asynchronous request
106      * @param input input message to send to the operation
107      *
108      * @return the correlation ID or the request. The correlation ID
109      * is used to associate the request with the WSIFOperation.
110      *
111      * @exception WSIFException if something goes wrong.
112      */

113     public WSIFCorrelationId executeRequestResponseAsync(WSIFMessage input)
114         throws WSIFException;
115
116     /**
117      * Execute an asynchronous request
118      * @param input input message to send to the operation
119      * @param handler the response handler that will be notified
120      * when the asynchronous response becomes available.
121      *
122      * @return the correlation ID or the request. The correlation ID
123      * is used to associate the request with the WSIFOperation.
124      *
125      * @exception WSIFException if something goes wrong.
126      */

127     public WSIFCorrelationId executeRequestResponseAsync(
128         WSIFMessage input,
129         WSIFResponseHandler handler)
130         throws WSIFException;
131
132     /**
133      * fireAsyncResponse is called when a response has been received
134      * for a previous executeRequestResponseAsync call.
135      * @param response an Object representing the response
136      * @exception WSIFException if something goes wrong
137      */

138     public void fireAsyncResponse(Object JavaDoc response) throws WSIFException;
139
140     /**
141      * Processes the response to an asynchronous request.
142      * This is called for when the asynchronous operation was
143      * initiated without a WSIFResponseHandler, that is, by calling
144      * the executeRequestResponseAsync(WSIFMessage input) method.
145      *
146      * @param response an Object representing the response.
147      * @param output an empty message which will be filled in if
148      * the operation invocation succeeds. If it does not
149      * succeed, the contents of this message are undefined.
150      * (This is a return value of this method.)
151      * @param fault an empty message which will be filled in if
152      * the operation invocation fails. If it succeeds, the
153      * contents of this message are undefined. (This is a
154      * return value of this method.)
155      *
156      * @return true or false indicating whether a fault message was
157      * generated or not. The truth value indicates whether
158      * the output or fault message has useful information.
159      *
160      * @exception WSIFException if something goes wrong
161      *
162      */

163     public boolean processAsyncResponse(
164         Object JavaDoc response,
165         WSIFMessage output,
166         WSIFMessage fault)
167         throws WSIFException;
168
169     /**
170      * Execute an input-only operation.
171      *
172      * @param input input message to send to the operation
173      * @exception WSIFException if something goes wrong.
174      */

175     public void executeInputOnlyOperation(WSIFMessage input) throws WSIFException;
176
177     /**
178      * Allows the application programmer or stub to pass context
179      * information to the binding. The Port implementation may use
180      * this context - for example to update a SOAP header. There is
181      * no definition of how a Port may utilize the context.
182      * @param context context information
183      */

184     public void setContext(WSIFMessage context);
185
186     /**
187      * Gets the context information for this binding.
188      * @return context
189      */

190     public WSIFMessage getContext() throws WSIFException;
191
192     /**
193      * Create an input message that will be sent via this port.
194      * It is responsibility of caller to set message name.
195      * @return a new message
196      */

197     public WSIFMessage createInputMessage();
198
199     /**
200      * Create an input message that will be sent via this port.
201      * @param name for the new message
202      * @return a new message
203      */

204     public WSIFMessage createInputMessage(String JavaDoc name);
205
206     /**
207      * Create an output message that will be received into via this port.
208      * It is responsibility of caller to set message name.
209      * @return a new message
210      */

211     public WSIFMessage createOutputMessage();
212
213     /**
214      * Create an output message that will be received into via this port.
215      *
216      * @param name for the new message
217      * @return a new message
218      */

219     public WSIFMessage createOutputMessage(String JavaDoc name);
220
221     /**
222      * Create a fault message that may be received into via this port.
223      * It is responsibility of caller to set message name.
224      * @return a new message
225      */

226     public WSIFMessage createFaultMessage();
227
228     /**
229      * Create a fault message that may be received into via this port.
230      *
231      * @param name for the new message
232      * @return a new message
233      */

234     public WSIFMessage createFaultMessage(String JavaDoc name);
235
236 }
237
Popular Tags