001 package controls.webservice.polling.asyncWebService;
002
003 /**
004 * This originally asynchronous web service (copied and modified from SamplesApp/WebServices/async/HelloWorldAsych.jws) has been supplemented with a polling interface. If the client specifies that it cannot hear callbacks (via the useCallback parameter on the HelloAsync() method), the result is not sent in a callback, instead it is stored in the member variable m_message. Two methods have been added to the original web service: checkStatus() getMessageResponse() Three member variables have been added: m_useCallbacks m_messageIsReceived m_message A parameter has been added to the requestMessage() method: useCallbacks. A web service that uses a TimerControl to delay sending a response back to the client. The timer simulates waiting for a slow back end service to complete work for us. We use a callback to asynchronously notify the client when the simulated operation is complete.
005 * @jc:location http-url="HelloWorldAsync.jws" jms-url="HelloWorldAsync.jws"
006 * @jc:wsdl file="#HelloWorldAsyncWsdl"
007 * @editor-info:link autogen-style="java" source="HelloWorldAsync.jws" autogen="true"
008 */
009 public interface HelloWorldAsyncControl extends com.bea.control.ControlExtension, com.bea.control.ServiceControl
010 {
011 public static class StartHeader
012 implements java.io.Serializable
013 {
014 public java.lang.String conversationID;
015 public java.lang.String callbackLocation;
016 }
017
018 public static class ContinueHeader
019 implements java.io.Serializable
020 {
021 public java.lang.String conversationID;
022 }
023
024 public static class CallbackHeader
025 implements java.io.Serializable
026 {
027 public java.lang.String conversationID;
028 }
029
030
031 public interface Callback extends com.bea.control.ServiceControl.Callback
032 {
033 /**
034 * <p>HelloResult is the message we will send back to the client some time after the client initiates the operation.</p> <p>We mark the callback as finishing the conversation because once we invoke the callback the interaction between client and this service is complete. If we didn't use the @common:conversation tag here to finish the conversation, we would have to call finishConversation() on this service's context object.</p>
035 * @jc:conversation phase="finish"
036 */
037 public void onHelloResult (java.lang.String hello);
038
039 }
040
041 /**
042 * <p>The client starts the interaction by calling HelloAsync.</p> <p>The client sends this, and some time later our web service replies by calling callback.onHelloResult.</p> <p>Because we need to remember which client called us, this is a "conversation start" method. This means the system will automatically track which clients have called us, and where to send the result for each. This is known as <i>correlation</i>.</p> <p>Because it uses a TimerControl method that might throw an Exception, the method must declare that it might throw an Exception.</p>
043 * @jc:conversation phase="start"
044 */
045 public void requestMessage (boolean useCallback);
046
047 /**
048 * Clients that don't want callbacks call this method to see if the results are ready to be retrieved.
049 * @jc:conversation phase="continue"
050 */
051 public boolean checkStatus ();
052
053 /**
054 * Clients that don't want callbacks call this method to get the result
055 * @jc:conversation phase="finish"
056 */
057 public java.lang.String getMessageResponse ();
058
059 static final long serialVersionUID = 1L;
060 }
061
062 /** @common:define name="HelloWorldAsyncWsdl" value::
063 <?xml version="1.0" encoding="utf-8"?>
064 <definitions xmlns="http://schemas.xmlsoap.org/wsdl/" xmlns:conv="http://www.openuri.org/2002/04/soap/conversation/" xmlns:cw="http://www.openuri.org/2002/04/wsdl/conversation/" xmlns:http="http://schemas.xmlsoap.org/wsdl/http/" xmlns:jms="http://www.openuri.org/2002/04/wsdl/jms/" xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/" xmlns:s="http://www.w3.org/2001/XMLSchema" xmlns:s0="http://www.openuri.org/" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" targetNamespace="http://www.openuri.org/">
065 <types>
066 <s:schema elementFormDefault="qualified" targetNamespace="http://www.openuri.org/" xmlns:s="http://www.w3.org/2001/XMLSchema">
067 <s:element name="onHelloResultResponse">
068 <s:complexType>
069 <s:sequence/>
070 </s:complexType>
071 </s:element>
072 <s:element name="onHelloResult">
073 <s:complexType>
074 <s:sequence>
075 <s:element name="hello" type="s:string" minOccurs="0"/>
076 </s:sequence>
077 </s:complexType>
078 </s:element>
079 <s:element name="requestMessage">
080 <s:complexType>
081 <s:sequence>
082 <s:element name="useCallback" type="s:boolean"/>
083 </s:sequence>
084 </s:complexType>
085 </s:element>
086 <s:element name="requestMessageResponse">
087 <s:complexType>
088 <s:sequence/>
089 </s:complexType>
090 </s:element>
091 <s:element name="checkStatus">
092 <s:complexType>
093 <s:sequence/>
094 </s:complexType>
095 </s:element>
096 <s:element name="checkStatusResponse">
097 <s:complexType>
098 <s:sequence>
099 <s:element name="checkStatusResult" type="s:boolean"/>
100 </s:sequence>
101 </s:complexType>
102 </s:element>
103 <s:element name="boolean" type="s:boolean"/>
104 <s:element name="getMessageResponse">
105 <s:complexType>
106 <s:sequence/>
107 </s:complexType>
108 </s:element>
109 <s:element name="getMessageResponseResponse">
110 <s:complexType>
111 <s:sequence>
112 <s:element name="getMessageResponseResult" type="s:string" minOccurs="0"/>
113 </s:sequence>
114 </s:complexType>
115 </s:element>
116 <s:element name="string" nillable="true" type="s:string"/>
117 </s:schema>
118
119 <s:schema elementFormDefault="qualified" targetNamespace="http://www.openuri.org/2002/04/soap/conversation/">
120 <s:element name="StartHeader" type="conv:StartHeader"/>
121 <s:element name="ContinueHeader" type="conv:ContinueHeader"/>
122 <s:element name="CallbackHeader" type="conv:CallbackHeader"/>
123 <s:complexType name="StartHeader">
124 <s:sequence>
125 <s:element minOccurs="0" maxOccurs="1" name="conversationID" type="s:string"/>
126 <s:element minOccurs="0" maxOccurs="1" name="callbackLocation" type="s:string"/>
127 </s:sequence>
128 </s:complexType>
129 <s:complexType name="ContinueHeader">
130 <s:sequence>
131 <s:element minOccurs="1" maxOccurs="1" name="conversationID" type="s:string"/>
132 </s:sequence>
133 </s:complexType>
134 <s:complexType name="CallbackHeader">
135 <s:sequence>
136 <s:element minOccurs="1" maxOccurs="1" name="conversationID" type="s:string"/>
137 </s:sequence>
138 </s:complexType>
139 </s:schema>
140 </types>
141 <message name="onHelloResultSoapIn">
142 <part name="parameters" element="s0:onHelloResultResponse"/>
143 </message>
144 <message name="onHelloResultSoapOut">
145 <part name="parameters" element="s0:onHelloResult"/>
146 </message>
147 <message name="requestMessageSoapIn">
148 <part name="parameters" element="s0:requestMessage"/>
149 </message>
150 <message name="requestMessageSoapOut">
151 <part name="parameters" element="s0:requestMessageResponse"/>
152 </message>
153 <message name="checkStatusSoapIn">
154 <part name="parameters" element="s0:checkStatus"/>
155 </message>
156 <message name="checkStatusSoapOut">
157 <part name="parameters" element="s0:checkStatusResponse"/>
158 </message>
159 <message name="getMessageResponseSoapIn">
160 <part name="parameters" element="s0:getMessageResponse"/>
161 </message>
162 <message name="getMessageResponseSoapOut">
163 <part name="parameters" element="s0:getMessageResponseResponse"/>
164 </message>
165 <message name="onHelloResultHttpGetIn"/>
166 <message name="onHelloResultHttpGetOut">
167 <part name="hello" type="s:string"/>
168 </message>
169 <message name="requestMessageHttpGetIn">
170 <part name="useCallback" type="s:string"/>
171 </message>
172 <message name="requestMessageHttpGetOut"/>
173 <message name="checkStatusHttpGetIn"/>
174 <message name="checkStatusHttpGetOut">
175 <part name="Body" element="s0:boolean"/>
176 </message>
177 <message name="getMessageResponseHttpGetIn"/>
178 <message name="getMessageResponseHttpGetOut">
179 <part name="Body" element="s0:string"/>
180 </message>
181 <message name="onHelloResultHttpPostIn"/>
182 <message name="onHelloResultHttpPostOut">
183 <part name="hello" type="s:string"/>
184 </message>
185 <message name="requestMessageHttpPostIn">
186 <part name="useCallback" type="s:string"/>
187 </message>
188 <message name="requestMessageHttpPostOut"/>
189 <message name="checkStatusHttpPostIn"/>
190 <message name="checkStatusHttpPostOut">
191 <part name="Body" element="s0:boolean"/>
192 </message>
193 <message name="getMessageResponseHttpPostIn"/>
194 <message name="getMessageResponseHttpPostOut">
195 <part name="Body" element="s0:string"/>
196 </message>
197 <message name="StartHeader_literal">
198 <part name="StartHeader" element="conv:StartHeader"/>
199 </message>
200 <message name="ContinueHeader_literal">
201 <part name="ContinueHeader" element="conv:ContinueHeader"/>
202 </message>
203 <message name="CallbackHeader_literal">
204 <part name="CallbackHeader" element="conv:CallbackHeader"/>
205 </message>
206 <portType name="HelloWorldAsyncSoap">
207 <operation name="onHelloResult">
208 <documentation><p>HelloResult is the message we will send back to the client some time after the client initiates the operation.</p> <p>We mark the callback as finishing the conversation because once we invoke the callback the interaction between client and this service is complete. If we didn't use the @common:conversation tag here to finish the conversation, we would have to call finishConversation() on this service's context object.</p></documentation>
209 <output message="s0:onHelloResultSoapOut"/>
210 <input message="s0:onHelloResultSoapIn"/>
211 </operation>
212 <operation name="requestMessage">
213 <documentation><p>The client starts the interaction by calling HelloAsync.</p> <p>The client sends this, and some time later our web service replies by calling callback.onHelloResult.</p> <p>Because we need to remember which client called us, this is a "conversation start" method. This means the system will automatically track which clients have called us, and where to send the result for each. This is known as <i>correlation</i>.</p> <p>Because it uses a TimerControl method that might throw an Exception, the method must declare that it might throw an Exception.</p></documentation>
214 <input message="s0:requestMessageSoapIn"/>
215 <output message="s0:requestMessageSoapOut"/>
216 </operation>
217 <operation name="checkStatus">
218 <documentation>Clients that don't want callbacks call this method to see if the results are ready to be retrieved.</documentation>
219 <input message="s0:checkStatusSoapIn"/>
220 <output message="s0:checkStatusSoapOut"/>
221 </operation>
222 <operation name="getMessageResponse">
223 <documentation>Clients that don't want callbacks call this method to get the result</documentation>
224 <input message="s0:getMessageResponseSoapIn"/>
225 <output message="s0:getMessageResponseSoapOut"/>
226 </operation>
227 </portType>
228 <portType name="HelloWorldAsyncHttpGet">
229 <operation name="onHelloResult">
230 <documentation><p>HelloResult is the message we will send back to the client some time after the client initiates the operation.</p> <p>We mark the callback as finishing the conversation because once we invoke the callback the interaction between client and this service is complete. If we didn't use the @common:conversation tag here to finish the conversation, we would have to call finishConversation() on this service's context object.</p></documentation>
231 <output message="s0:onHelloResultHttpGetOut"/>
232 <input message="s0:onHelloResultHttpGetIn"/>
233 </operation>
234 <operation name="requestMessage">
235 <documentation><p>The client starts the interaction by calling HelloAsync.</p> <p>The client sends this, and some time later our web service replies by calling callback.onHelloResult.</p> <p>Because we need to remember which client called us, this is a "conversation start" method. This means the system will automatically track which clients have called us, and where to send the result for each. This is known as <i>correlation</i>.</p> <p>Because it uses a TimerControl method that might throw an Exception, the method must declare that it might throw an Exception.</p></documentation>
236 <input message="s0:requestMessageHttpGetIn"/>
237 <output message="s0:requestMessageHttpGetOut"/>
238 </operation>
239 <operation name="checkStatus">
240 <documentation>Clients that don't want callbacks call this method to see if the results are ready to be retrieved.</documentation>
241 <input message="s0:checkStatusHttpGetIn"/>
242 <output message="s0:checkStatusHttpGetOut"/>
243 </operation>
244 <operation name="getMessageResponse">
245 <documentation>Clients that don't want callbacks call this method to get the result</documentation>
246 <input message="s0:getMessageResponseHttpGetIn"/>
247 <output message="s0:getMessageResponseHttpGetOut"/>
248 </operation>
249 </portType>
250 <portType name="HelloWorldAsyncHttpPost">
251 <operation name="onHelloResult">
252 <documentation><p>HelloResult is the message we will send back to the client some time after the client initiates the operation.</p> <p>We mark the callback as finishing the conversation because once we invoke the callback the interaction between client and this service is complete. If we didn't use the @common:conversation tag here to finish the conversation, we would have to call finishConversation() on this service's context object.</p></documentation>
253 <output message="s0:onHelloResultHttpPostOut"/>
254 <input message="s0:onHelloResultHttpPostIn"/>
255 </operation>
256 <operation name="requestMessage">
257 <documentation><p>The client starts the interaction by calling HelloAsync.</p> <p>The client sends this, and some time later our web service replies by calling callback.onHelloResult.</p> <p>Because we need to remember which client called us, this is a "conversation start" method. This means the system will automatically track which clients have called us, and where to send the result for each. This is known as <i>correlation</i>.</p> <p>Because it uses a TimerControl method that might throw an Exception, the method must declare that it might throw an Exception.</p></documentation>
258 <input message="s0:requestMessageHttpPostIn"/>
259 <output message="s0:requestMessageHttpPostOut"/>
260 </operation>
261 <operation name="checkStatus">
262 <documentation>Clients that don't want callbacks call this method to see if the results are ready to be retrieved.</documentation>
263 <input message="s0:checkStatusHttpPostIn"/>
264 <output message="s0:checkStatusHttpPostOut"/>
265 </operation>
266 <operation name="getMessageResponse">
267 <documentation>Clients that don't want callbacks call this method to get the result</documentation>
268 <input message="s0:getMessageResponseHttpPostIn"/>
269 <output message="s0:getMessageResponseHttpPostOut"/>
270 </operation>
271 </portType>
272 <binding name="HelloWorldAsyncSoap" type="s0:HelloWorldAsyncSoap">
273 <soap:binding transport="http://schemas.xmlsoap.org/soap/http" style="document"/>
274 <operation name="onHelloResult">
275 <soap:operation soapAction="http://www.openuri.org/onHelloResult" style="document"/>
276 <cw:transition phase="finish"/>
277 <input>
278 <soap:body use="literal"/>
279 </input>
280 <output>
281 <soap:body use="literal"/>
282 <soap:header wsdl:required="true" message="s0:CallbackHeader_literal" part="CallbackHeader" use="literal" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"/>
283 </output>
284 </operation>
285 <operation name="requestMessage">
286 <soap:operation soapAction="http://www.openuri.org/requestMessage" style="document"/>
287 <cw:transition phase="start"/>
288 <input>
289 <soap:body use="literal"/>
290 <soap:header wsdl:required="true" message="s0:StartHeader_literal" part="StartHeader" use="literal" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"/>
291 </input>
292 <output>
293 <soap:body use="literal"/>
294 </output>
295 </operation>
296 <operation name="checkStatus">
297 <soap:operation soapAction="http://www.openuri.org/checkStatus" style="document"/>
298 <cw:transition phase="continue"/>
299 <input>
300 <soap:body use="literal"/>
301 <soap:header wsdl:required="true" message="s0:ContinueHeader_literal" part="ContinueHeader" use="literal" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"/>
302 </input>
303 <output>
304 <soap:body use="literal"/>
305 </output>
306 </operation>
307 <operation name="getMessageResponse">
308 <soap:operation soapAction="http://www.openuri.org/getMessageResponse" style="document"/>
309 <cw:transition phase="finish"/>
310 <input>
311 <soap:body use="literal"/>
312 <soap:header wsdl:required="true" message="s0:ContinueHeader_literal" part="ContinueHeader" use="literal" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"/>
313 </input>
314 <output>
315 <soap:body use="literal"/>
316 </output>
317 </operation>
318 </binding>
319 <binding name="HelloWorldAsyncHttpGet" type="s0:HelloWorldAsyncHttpGet">
320 <http:binding verb="GET"/>
321 <operation name="onHelloResult">
322 <http:operation location="/onHelloResult"/>
323 <cw:transition phase="finish"/>
324 <input>
325 <mime:mimeXml part="Body"/>
326 </input>
327 <output>
328 <http:urlEncoded/>
329 </output>
330 </operation>
331 <operation name="requestMessage">
332 <http:operation location="/requestMessage"/>
333 <cw:transition phase="start"/>
334 <input>
335 <http:urlEncoded/>
336 </input>
337 <output/>
338 </operation>
339 <operation name="checkStatus">
340 <http:operation location="/checkStatus"/>
341 <cw:transition phase="continue"/>
342 <input>
343 <http:urlEncoded/>
344 </input>
345 <output>
346 <mime:mimeXml part="Body"/>
347 </output>
348 </operation>
349 <operation name="getMessageResponse">
350 <http:operation location="/getMessageResponse"/>
351 <cw:transition phase="finish"/>
352 <input>
353 <http:urlEncoded/>
354 </input>
355 <output>
356 <mime:mimeXml part="Body"/>
357 </output>
358 </operation>
359 </binding>
360 <binding name="HelloWorldAsyncHttpPost" type="s0:HelloWorldAsyncHttpPost">
361 <http:binding verb="POST"/>
362 <operation name="onHelloResult">
363 <http:operation location="/onHelloResult"/>
364 <cw:transition phase="finish"/>
365 <input>
366 <mime:mimeXml part="Body"/>
367 </input>
368 <output>
369 <mime:content type="application/x-www-form-urlencoded"/>
370 </output>
371 </operation>
372 <operation name="requestMessage">
373 <http:operation location="/requestMessage"/>
374 <cw:transition phase="start"/>
375 <input>
376 <mime:content type="application/x-www-form-urlencoded"/>
377 </input>
378 <output/>
379 </operation>
380 <operation name="checkStatus">
381 <http:operation location="/checkStatus"/>
382 <cw:transition phase="continue"/>
383 <input>
384 <mime:content type="application/x-www-form-urlencoded"/>
385 </input>
386 <output>
387 <mime:mimeXml part="Body"/>
388 </output>
389 </operation>
390 <operation name="getMessageResponse">
391 <http:operation location="/getMessageResponse"/>
392 <cw:transition phase="finish"/>
393 <input>
394 <mime:content type="application/x-www-form-urlencoded"/>
395 </input>
396 <output>
397 <mime:mimeXml part="Body"/>
398 </output>
399 </operation>
400 </binding>
401 <service name="HelloWorldAsync">
402 <documentation>This originally asynchronous web service (copied and modified from SamplesApp/WebServices/async/HelloWorldAsych.jws) has been supplemented with a polling interface. If the client specifies that it cannot hear callbacks (via the useCallback parameter on the HelloAsync() method), the result is not sent in a callback, instead it is stored in the member variable m_message. Two methods have been added to the original web service: checkStatus() getMessageResponse() Three member variables have been added: m_useCallbacks m_messageIsReceived m_message A parameter has been added to the requestMessage() method: useCallbacks. A web service that uses a TimerControl to delay sending a response back to the client. The timer simulates waiting for a slow back end service to complete work for us. We use a callback to asynchronously notify the client when the simulated operation is complete.</documentation>
403 <port name="HelloWorldAsyncSoap" binding="s0:HelloWorldAsyncSoap">
404 <soap:address location="http://localhost:7001/controls/webservice/polling/asyncWebService/HelloWorldAsync.jws"/>
405 </port>
406 <port name="HelloWorldAsyncHttpGet" binding="s0:HelloWorldAsyncHttpGet">
407 <http:address location="http://localhost:7001/controls/webservice/polling/asyncWebService/HelloWorldAsync.jws"/>
408 </port>
409 <port name="HelloWorldAsyncHttpPost" binding="s0:HelloWorldAsyncHttpPost">
410 <http:address location="http://localhost:7001/controls/webservice/polling/asyncWebService/HelloWorldAsync.jws"/>
411 </port>
412 </service>
413 </definitions>
414 * ::
415 */
|