LegacySystemControl.jcx Sample

This topic inludes the source code for the LegacySystemControl.jcx Sample.

Sample Location

This sample is located in the following directory in your WebLogic Workshop installation:

BEA_HOME/weblogic81/samples/workshop/SamplesApp/WebServices/timer/

Sample Source Code


001 package timer;
002 
003 /**
004  <p>This web service is used by the AdvancedTimer sample. It a mock version of a legacy system that lacks the ability to call you back when its operation is complete. To get around this limitation, AdvancedTimer has to "poll" this service to determine when it's complete.</p> <p>This service has only a single operation that it can perform. To start this operation running, call <b>start</b>. Once <b>start</b> has been called, you can call <b>isDone</b> to determine if the operation has completed.</p> <p>We implement this operation by using a timer. The timer will fire between 10 and 20 seconds after the operation is started. Once the timer goes off, we will report the operation as completed.</p>
005  * @jc:location http-url="LegacySystem.jws" jms-url="LegacySystem.jws"
006  * @jc:wsdl file="#LegacySystemWsdl"
007  * @editor-info:link autogen-style="java" source="LegacySystem.jws" autogen="true"
008  */
009 public interface LegacySystemControl 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     /**
032      <p>Starts a new instance of the operation running. This operation will complete in between 10 and 15 seconds.</p>
033      * @jc:conversation phase="start"
034      */
035     public void start ();
036 
037     /**
038      <p>Call this to determine if the operation has completed.</p>
039      * @jc:conversation phase="continue"
040      */
041     public boolean isDone ();
042 
043     /**
044      * @jc:conversation phase="finish"
045      */
046     public void finish ();
047 
048     static final long serialVersionUID = 1L;
049 }
050 
051 /** @common:define name="LegacySystemWsdl" value::
052     <?xml version="1.0" encoding="utf-8"?>
053     <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://workshop.bea.com/LegacySystem" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" targetNamespace="http://workshop.bea.com/LegacySystem">
054       <types>
055         <s:schema elementFormDefault="qualified" targetNamespace="http://workshop.bea.com/LegacySystem" xmlns:s="http://www.w3.org/2001/XMLSchema">
056           <s:element name="start">
057             <s:complexType>
058               <s:sequence/>
059             </s:complexType>
060           </s:element>
061           <s:element name="startResponse">
062             <s:complexType>
063               <s:sequence/>
064             </s:complexType>
065           </s:element>
066           <s:element name="isDone">
067             <s:complexType>
068               <s:sequence/>
069             </s:complexType>
070           </s:element>
071           <s:element name="isDoneResponse">
072             <s:complexType>
073               <s:sequence>
074                 <s:element name="isDoneResult" type="s:boolean"/>
075               </s:sequence>
076             </s:complexType>
077           </s:element>
078           <s:element name="boolean" type="s:boolean"/>
079           <s:element name="finish">
080             <s:complexType>
081               <s:sequence/>
082             </s:complexType>
083           </s:element>
084           <s:element name="finishResponse">
085             <s:complexType>
086               <s:sequence/>
087             </s:complexType>
088           </s:element>
089         </s:schema>
090     
091         <s:schema elementFormDefault="qualified" targetNamespace="http://www.openuri.org/2002/04/soap/conversation/">
092           <s:element name="StartHeader" type="conv:StartHeader"/>
093           <s:element name="ContinueHeader" type="conv:ContinueHeader"/>
094           <s:element name="CallbackHeader" type="conv:CallbackHeader"/>
095           <s:complexType name="StartHeader">
096             <s:sequence>
097               <s:element minOccurs="0" maxOccurs="1" name="conversationID" type="s:string"/>
098               <s:element minOccurs="0" maxOccurs="1" name="callbackLocation" type="s:string"/>
099             </s:sequence>
100           </s:complexType>
101           <s:complexType name="ContinueHeader">
102             <s:sequence>
103               <s:element minOccurs="1" maxOccurs="1" name="conversationID" type="s:string"/>
104             </s:sequence>
105           </s:complexType>
106           <s:complexType name="CallbackHeader">
107             <s:sequence>
108               <s:element minOccurs="1" maxOccurs="1" name="conversationID" type="s:string"/>
109             </s:sequence>
110           </s:complexType>
111         </s:schema>
112       </types>
113       <message name="startSoapIn">
114         <part name="parameters" element="s0:start"/>
115       </message>
116       <message name="startSoapOut">
117         <part name="parameters" element="s0:startResponse"/>
118       </message>
119       <message name="isDoneSoapIn">
120         <part name="parameters" element="s0:isDone"/>
121       </message>
122       <message name="isDoneSoapOut">
123         <part name="parameters" element="s0:isDoneResponse"/>
124       </message>
125       <message name="finishSoapIn">
126         <part name="parameters" element="s0:finish"/>
127       </message>
128       <message name="finishSoapOut">
129         <part name="parameters" element="s0:finishResponse"/>
130       </message>
131       <message name="startHttpGetIn"/>
132       <message name="startHttpGetOut"/>
133       <message name="isDoneHttpGetIn"/>
134       <message name="isDoneHttpGetOut">
135         <part name="Body" element="s0:boolean"/>
136       </message>
137       <message name="finishHttpGetIn"/>
138       <message name="finishHttpGetOut"/>
139       <message name="startHttpPostIn"/>
140       <message name="startHttpPostOut"/>
141       <message name="isDoneHttpPostIn"/>
142       <message name="isDoneHttpPostOut">
143         <part name="Body" element="s0:boolean"/>
144       </message>
145       <message name="finishHttpPostIn"/>
146       <message name="finishHttpPostOut"/>
147       <message name="StartHeader_literal">
148         <part name="StartHeader" element="conv:StartHeader"/>
149       </message>
150       <message name="ContinueHeader_literal">
151         <part name="ContinueHeader" element="conv:ContinueHeader"/>
152       </message>
153       <portType name="LegacySystemSoap">
154         <operation name="start">
155           <documentation>&lt;p&gt;Starts a new instance of the operation running. This operation will complete in between 10 and 15 seconds.&lt;/p&gt;</documentation>
156           <input message="s0:startSoapIn"/>
157           <output message="s0:startSoapOut"/>
158         </operation>
159         <operation name="isDone">
160           <documentation>&lt;p&gt;Call this to determine if the operation has completed.&lt;/p&gt;</documentation>
161           <input message="s0:isDoneSoapIn"/>
162           <output message="s0:isDoneSoapOut"/>
163         </operation>
164         <operation name="finish">
165           <input message="s0:finishSoapIn"/>
166           <output message="s0:finishSoapOut"/>
167         </operation>
168       </portType>
169       <portType name="LegacySystemHttpGet">
170         <operation name="start">
171           <documentation>&lt;p&gt;Starts a new instance of the operation running. This operation will complete in between 10 and 15 seconds.&lt;/p&gt;</documentation>
172           <input message="s0:startHttpGetIn"/>
173           <output message="s0:startHttpGetOut"/>
174         </operation>
175         <operation name="isDone">
176           <documentation>&lt;p&gt;Call this to determine if the operation has completed.&lt;/p&gt;</documentation>
177           <input message="s0:isDoneHttpGetIn"/>
178           <output message="s0:isDoneHttpGetOut"/>
179         </operation>
180         <operation name="finish">
181           <input message="s0:finishHttpGetIn"/>
182           <output message="s0:finishHttpGetOut"/>
183         </operation>
184       </portType>
185       <portType name="LegacySystemHttpPost">
186         <operation name="start">
187           <documentation>&lt;p&gt;Starts a new instance of the operation running. This operation will complete in between 10 and 15 seconds.&lt;/p&gt;</documentation>
188           <input message="s0:startHttpPostIn"/>
189           <output message="s0:startHttpPostOut"/>
190         </operation>
191         <operation name="isDone">
192           <documentation>&lt;p&gt;Call this to determine if the operation has completed.&lt;/p&gt;</documentation>
193           <input message="s0:isDoneHttpPostIn"/>
194           <output message="s0:isDoneHttpPostOut"/>
195         </operation>
196         <operation name="finish">
197           <input message="s0:finishHttpPostIn"/>
198           <output message="s0:finishHttpPostOut"/>
199         </operation>
200       </portType>
201       <binding name="LegacySystemSoap" type="s0:LegacySystemSoap">
202         <soap:binding transport="http://schemas.xmlsoap.org/soap/http" style="document"/>
203         <operation name="start">
204           <soap:operation soapAction="http://workshop.bea.com/LegacySystem/start" style="document"/>
205           <cw:transition phase="start"/>
206           <input>
207             <soap:body use="literal"/>
208             <soap:header wsdl:required="true" message="s0:StartHeader_literal" part="StartHeader" use="literal" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"/>
209           </input>
210           <output>
211             <soap:body use="literal"/>
212           </output>
213         </operation>
214         <operation name="isDone">
215           <soap:operation soapAction="http://workshop.bea.com/LegacySystem/isDone" style="document"/>
216           <cw:transition phase="continue"/>
217           <input>
218             <soap:body use="literal"/>
219             <soap:header wsdl:required="true" message="s0:ContinueHeader_literal" part="ContinueHeader" use="literal" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"/>
220           </input>
221           <output>
222             <soap:body use="literal"/>
223           </output>
224         </operation>
225         <operation name="finish">
226           <soap:operation soapAction="http://workshop.bea.com/LegacySystem/finish" style="document"/>
227           <cw:transition phase="finish"/>
228           <input>
229             <soap:body use="literal"/>
230             <soap:header wsdl:required="true" message="s0:ContinueHeader_literal" part="ContinueHeader" use="literal" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"/>
231           </input>
232           <output>
233             <soap:body use="literal"/>
234           </output>
235         </operation>
236       </binding>
237       <binding name="LegacySystemHttpGet" type="s0:LegacySystemHttpGet">
238         <http:binding verb="GET"/>
239         <operation name="start">
240           <http:operation location="/start"/>
241           <cw:transition phase="start"/>
242           <input>
243             <http:urlEncoded/>
244           </input>
245           <output/>
246         </operation>
247         <operation name="isDone">
248           <http:operation location="/isDone"/>
249           <cw:transition phase="continue"/>
250           <input>
251             <http:urlEncoded/>
252           </input>
253           <output>
254             <mime:mimeXml part="Body"/>
255           </output>
256         </operation>
257         <operation name="finish">
258           <http:operation location="/finish"/>
259           <cw:transition phase="finish"/>
260           <input>
261             <http:urlEncoded/>
262           </input>
263           <output/>
264         </operation>
265       </binding>
266       <binding name="LegacySystemHttpPost" type="s0:LegacySystemHttpPost">
267         <http:binding verb="POST"/>
268         <operation name="start">
269           <http:operation location="/start"/>
270           <cw:transition phase="start"/>
271           <input>
272             <mime:content type="application/x-www-form-urlencoded"/>
273           </input>
274           <output/>
275         </operation>
276         <operation name="isDone">
277           <http:operation location="/isDone"/>
278           <cw:transition phase="continue"/>
279           <input>
280             <mime:content type="application/x-www-form-urlencoded"/>
281           </input>
282           <output>
283             <mime:mimeXml part="Body"/>
284           </output>
285         </operation>
286         <operation name="finish">
287           <http:operation location="/finish"/>
288           <cw:transition phase="finish"/>
289           <input>
290             <mime:content type="application/x-www-form-urlencoded"/>
291           </input>
292           <output/>
293         </operation>
294       </binding>
295       <service name="LegacySystem">
296         <documentation>&lt;p&gt;This web service is used by the AdvancedTimer sample. It a mock version of a legacy system that lacks the ability to call you back when its operation is complete. To get around this limitation, AdvancedTimer has to "poll" this service to determine when it's complete.&lt;/p&gt; &lt;p&gt;This service has only a single operation that it can perform. To start this operation running, call &lt;b&gt;start&lt;/b&gt;. Once &lt;b&gt;start&lt;/b&gt; has been called, you can call &lt;b&gt;isDone&lt;/b&gt; to determine if the operation has completed.&lt;/p&gt; &lt;p&gt;We implement this operation by using a timer. The timer will fire between 10 and 20 seconds after the operation is started. Once the timer goes off, we will report the operation as completed.&lt;/p&gt;</documentation>
297         <port name="LegacySystemSoap" binding="s0:LegacySystemSoap">
298           <soap:address location="http://localhost:7001/timer/LegacySystem.jws"/>
299         </port>
300         <port name="LegacySystemHttpGet" binding="s0:LegacySystemHttpGet">
301           <http:address location="http://localhost:7001/timer/LegacySystem.jws"/>
302         </port>
303         <port name="LegacySystemHttpPost" binding="s0:LegacySystemHttpPost">
304           <http:address location="http://localhost:7001/timer/LegacySystem.jws"/>
305         </port>
306       </service>
307     </definitions>
308  * ::
309  */