001: /*
002: * The Apache Software License, Version 1.1
003: *
004: *
005: * Copyright (c) 2002 The Apache Software Foundation. All rights
006: * reserved.
007: *
008: * Redistribution and use in source and binary forms, with or without
009: * modification, are permitted provided that the following conditions
010: * are met:
011: *
012: * 1. Redistributions of source code must retain the above copyright
013: * notice, this list of conditions and the following disclaimer.
014: *
015: * 2. Redistributions in binary form must reproduce the above copyright
016: * notice, this list of conditions and the following disclaimer in
017: * the documentation and/or other materials provided with the
018: * distribution.
019: *
020: * 3. The end-user documentation included with the redistribution,
021: * if any, must include the following acknowledgment:
022: * "This product includes software developed by the
023: * Apache Software Foundation (http://www.apache.org/)."
024: * Alternately, this acknowledgment may appear in the software itself,
025: * if and wherever such third-party acknowledgments normally appear.
026: *
027: * 4. The names "WSIF" and "Apache Software Foundation" must
028: * not be used to endorse or promote products derived from this
029: * software without prior written permission. For written
030: * permission, please contact apache@apache.org.
031: *
032: * 5. Products derived from this software may not be called "Apache",
033: * nor may "Apache" appear in their name, without prior written
034: * permission of the Apache Software Foundation.
035: *
036: * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
037: * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
038: * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
039: * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
040: * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
041: * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
042: * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
043: * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
044: * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
045: * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
046: * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
047: * SUCH DAMAGE.
048: * ====================================================================
049: *
050: * This software consists of voluntary contributions made by many
051: * individuals on behalf of the Apache Software Foundation and was
052: * originally based on software copyright (c) 2001, 2002, International
053: * Business Machines, Inc., http://www.apache.org. For more
054: * information on the Apache Software Foundation, please see
055: * <http://www.apache.org/>.
056: */
057:
058: package org.apache.wsif;
059:
060: import java.io.Serializable;
061:
062: /**
063: * A WSIFOperation is a handle on a particular operation of a portType
064: * that can be used to invoke web service methods. This interface is
065: * implemented by each provider. A WSIFOperation can be created using
066: * {@link WSIFPort#createOperation(String)}.
067: *
068: * @author Owen Burroughs <owenb@apache.org>
069: * @author Ant Elder <antelder@apache.org>
070: * @author Jeremy Hughes <hughesj@apache.org>
071: * @author Mark Whitlock <whitlock@apache.org>
072: */
073: public interface WSIFOperation extends Serializable {
074:
075: /**
076: * Execute a request-response operation. The signature allows for
077: * input, output and fault messages. WSDL in fact allows one to
078: * describe the set of possible faults an operation may result
079: * in, however, only one fault can occur at any one time.
080: *
081: * @param op name of operation to execute
082: * @param input input message to send to the operation
083: * @param output an empty message which will be filled in if
084: * the operation invocation succeeds. If it does not
085: * succeed, the contents of this message are undefined.
086: * (This is a return value of this method.)
087: * @param fault an empty message which will be filled in if
088: * the operation invocation fails. If it succeeds, the
089: * contents of this message are undefined. (This is a
090: * return value of this method.)
091: *
092: * @return true or false indicating whether a fault message was
093: * generated or not. The truth value indicates whether
094: * the output or fault message has useful information.
095: *
096: * @exception WSIFException if something goes wrong.
097: */
098: public boolean executeRequestResponseOperation(WSIFMessage input,
099: WSIFMessage output, WSIFMessage fault) throws WSIFException;
100:
101: /**
102: * Execute an asynchronous request
103: * @param input input message to send to the operation
104: *
105: * @return the correlation ID or the request. The correlation ID
106: * is used to associate the request with the WSIFOperation.
107: *
108: * @exception WSIFException if something goes wrong.
109: */
110: public WSIFCorrelationId executeRequestResponseAsync(
111: WSIFMessage input) throws WSIFException;
112:
113: /**
114: * Execute an asynchronous request
115: * @param input input message to send to the operation
116: * @param handler the response handler that will be notified
117: * when the asynchronous response becomes available.
118: *
119: * @return the correlation ID or the request. The correlation ID
120: * is used to associate the request with the WSIFOperation.
121: *
122: * @exception WSIFException if something goes wrong.
123: */
124: public WSIFCorrelationId executeRequestResponseAsync(
125: WSIFMessage input, WSIFResponseHandler handler)
126: throws WSIFException;
127:
128: /**
129: * fireAsyncResponse is called when a response has been received
130: * for a previous executeRequestResponseAsync call.
131: * @param response an Object representing the response
132: * @exception WSIFException if something goes wrong
133: */
134: public void fireAsyncResponse(Object response) throws WSIFException;
135:
136: /**
137: * Processes the response to an asynchronous request.
138: * This is called for when the asynchronous operation was
139: * initiated without a WSIFResponseHandler, that is, by calling
140: * the executeRequestResponseAsync(WSIFMessage input) method.
141: *
142: * @param response an Object representing the response.
143: * @param output an empty message which will be filled in if
144: * the operation invocation succeeds. If it does not
145: * succeed, the contents of this message are undefined.
146: * (This is a return value of this method.)
147: * @param fault an empty message which will be filled in if
148: * the operation invocation fails. If it succeeds, the
149: * contents of this message are undefined. (This is a
150: * return value of this method.)
151: *
152: * @return true or false indicating whether a fault message was
153: * generated or not. The truth value indicates whether
154: * the output or fault message has useful information.
155: *
156: * @exception WSIFException if something goes wrong
157: *
158: */
159: public boolean processAsyncResponse(Object response,
160: WSIFMessage output, WSIFMessage fault) throws WSIFException;
161:
162: /**
163: * Execute an input-only operation.
164: *
165: * @param input input message to send to the operation
166: * @exception WSIFException if something goes wrong.
167: */
168: public void executeInputOnlyOperation(WSIFMessage input)
169: throws WSIFException;
170:
171: /**
172: * Allows the application programmer or stub to pass context
173: * information to the binding. The Port implementation may use
174: * this context - for example to update a SOAP header. There is
175: * no definition of how a Port may utilize the context.
176: * @param context context information
177: */
178: public void setContext(WSIFMessage context);
179:
180: /**
181: * Gets the context information for this binding.
182: * @return context
183: */
184: public WSIFMessage getContext() throws WSIFException;
185:
186: /**
187: * Create an input message that will be sent via this port.
188: * It is responsibility of caller to set message name.
189: * @return a new message
190: */
191: public WSIFMessage createInputMessage();
192:
193: /**
194: * Create an input message that will be sent via this port.
195: * @param name for the new message
196: * @return a new message
197: */
198: public WSIFMessage createInputMessage(String name);
199:
200: /**
201: * Create an output message that will be received into via this port.
202: * It is responsibility of caller to set message name.
203: * @return a new message
204: */
205: public WSIFMessage createOutputMessage();
206:
207: /**
208: * Create an output message that will be received into via this port.
209: *
210: * @param name for the new message
211: * @return a new message
212: */
213: public WSIFMessage createOutputMessage(String name);
214:
215: /**
216: * Create a fault message that may be received into via this port.
217: * It is responsibility of caller to set message name.
218: * @return a new message
219: */
220: public WSIFMessage createFaultMessage();
221:
222: /**
223: * Create a fault message that may be received into via this port.
224: *
225: * @param name for the new message
226: * @return a new message
227: */
228: public WSIFMessage createFaultMessage(String name);
229:
230: }
|