QuoteServiceControl.jcx Sample

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

Sample Location

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

BEA_HOME/weblogic81/samples/workshop/SamplesApp/WebServices/service/

Sample Source Code


001 package service;
002 
003 /**
004  <p>This Service control has been manually modified and is not
005  * automatically generated from QuoteService.jws, although it still
006  * calls QuoteService.jws.</p>
007  
008  <p>The getQuote method has a modified signature, with the customerID
009  * parameter removed.  The customerID parameter is hardcoded in an
010  * XQuery map on the getQuote method.  So the public contract (the format
011  * of the XML message sent to the web service) is still the same, taking
012  * two parameters, but the Java method a client of this control uses
013  * takes only a single parameter.  This is an example of the type
014  * of modifications one can make to a Service control.</p>
015  
016  * @jc:location http-url="QuoteService.jws" jms-url="QuoteService.jws"
017  * @jc:wsdl file="#QuoteServiceWsdl"
018  * @common:xmlns namespace="http://openuri.org/bea/samples/workshop/service/quoteService" prefix="ns0"
019  */
020 public interface QuoteServiceControl extends com.bea.control.ControlExtension, com.bea.control.ServiceControl
021 {
022     public static class StartHeader
023         implements java.io.Serializable
024     {
025         public java.lang.String conversationID;
026         public java.lang.String callbackLocation;
027     }
028     
029     public static class ContinueHeader
030         implements java.io.Serializable
031     {
032         public java.lang.String conversationID;
033     }
034     
035     public static class CallbackHeader
036         implements java.io.Serializable
037     {
038         public java.lang.String conversationID;
039     }
040     
041     
042     public interface Callback extends com.bea.control.ServiceControl.Callback
043     {
044         /**
045          * @jc:conversation phase="finish"
046          */
047         public void onQuoteReady (java.lang.String tickerSymbol, double dQuote);
048 
049     }
050 
051     /**
052      * @jc:conversation phase="start"
053      * @jc:parameter-xml schema-element="ns0:getQuote" xquery::
054      * declare namespace ns1 = "http://workshop.bea.com/QuoteService"
055      * declare namespace ns0 = "http://openuri.org/bea/samples/workshop/service/quoteService"
056      
057      <ns1:getQuote>
058      *     <ns1:customerID>123456789</ns1:customerID>
059      *     <ns1:tickerSymbol>{ data($input/ns0:tickerSymbol) }</ns1:tickerSymbol>
060      </ns1:getQuote>::
061      */
062     public void getQuote (java.lang.String tickerSymbol);
063 
064     static final long serialVersionUID = 1L;
065 }
066 
067 /** @common:define name="QuoteServiceWsdl" value::
068     <?xml version="1.0" encoding="utf-8"?>
069     <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/QuoteService" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" targetNamespace="http://workshop.bea.com/QuoteService">
070       <types>
071         <s:schema elementFormDefault="qualified" targetNamespace="http://workshop.bea.com/QuoteService" xmlns:s="http://www.w3.org/2001/XMLSchema">
072           <s:element name="onQuoteReadyResponse">
073             <s:complexType>
074               <s:sequence/>
075             </s:complexType>
076           </s:element>
077           <s:element name="onQuoteReady">
078             <s:complexType>
079               <s:sequence>
080                 <s:element name="tickerSymbol" type="s:string" minOccurs="0"/>
081                 <s:element name="dQuote" type="s:double"/>
082               </s:sequence>
083             </s:complexType>
084           </s:element>
085           <s:element name="getQuote">
086             <s:complexType>
087               <s:sequence>
088                 <s:element name="tickerSymbol" type="s:string" minOccurs="0"/>
089               </s:sequence>
090             </s:complexType>
091           </s:element>
092           <s:element name="getQuoteResponse">
093             <s:complexType>
094               <s:sequence/>
095             </s:complexType>
096           </s:element>
097         </s:schema>
098     
099         <s:schema elementFormDefault="qualified" targetNamespace="http://www.openuri.org/2002/04/soap/conversation/">
100           <s:element name="StartHeader" type="conv:StartHeader"/>
101           <s:element name="ContinueHeader" type="conv:ContinueHeader"/>
102           <s:element name="CallbackHeader" type="conv:CallbackHeader"/>
103           <s:complexType name="StartHeader">
104             <s:sequence>
105               <s:element minOccurs="0" maxOccurs="1" name="conversationID" type="s:string"/>
106               <s:element minOccurs="0" maxOccurs="1" name="callbackLocation" type="s:string"/>
107             </s:sequence>
108           </s:complexType>
109           <s:complexType name="ContinueHeader">
110             <s:sequence>
111               <s:element minOccurs="1" maxOccurs="1" name="conversationID" type="s:string"/>
112             </s:sequence>
113           </s:complexType>
114           <s:complexType name="CallbackHeader">
115             <s:sequence>
116               <s:element minOccurs="1" maxOccurs="1" name="conversationID" type="s:string"/>
117             </s:sequence>
118           </s:complexType>
119         </s:schema>
120       </types>
121       <message name="onQuoteReadySoapIn">
122         <part name="parameters" element="s0:onQuoteReadyResponse"/>
123       </message>
124       <message name="onQuoteReadySoapOut">
125         <part name="parameters" element="s0:onQuoteReady"/>
126       </message>
127       <message name="getQuoteSoapIn">
128         <part name="parameters" element="s0:getQuote"/>
129       </message>
130       <message name="getQuoteSoapOut">
131         <part name="parameters" element="s0:getQuoteResponse"/>
132       </message>
133       <message name="onQuoteReadyHttpGetIn"/>
134       <message name="onQuoteReadyHttpGetOut">
135         <part name="tickerSymbol" type="s:string"/>
136         <part name="dQuote" type="s:string"/>
137       </message>
138       <message name="getQuoteHttpGetIn">
139         <part name="tickerSymbol" type="s:string"/>
140       </message>
141       <message name="getQuoteHttpGetOut"/>
142       <message name="onQuoteReadyHttpPostIn"/>
143       <message name="onQuoteReadyHttpPostOut">
144         <part name="tickerSymbol" type="s:string"/>
145         <part name="dQuote" type="s:string"/>
146       </message>
147       <message name="getQuoteHttpPostIn">
148         <part name="tickerSymbol" type="s:string"/>
149       </message>
150       <message name="getQuoteHttpPostOut"/>
151       <message name="StartHeader_literal">
152         <part name="StartHeader" element="conv:StartHeader"/>
153       </message>
154       <message name="CallbackHeader_literal">
155         <part name="CallbackHeader" element="conv:CallbackHeader"/>
156       </message>
157       <portType name="QuoteServiceSoap">
158         <operation name="onQuoteReady">
159           <output message="s0:onQuoteReadySoapOut"/>
160           <input message="s0:onQuoteReadySoapIn"/>
161         </operation>
162         <operation name="getQuote">
163           <input message="s0:getQuoteSoapIn"/>
164           <output message="s0:getQuoteSoapOut"/>
165         </operation>
166       </portType>
167       <portType name="QuoteServiceHttpGet">
168         <operation name="onQuoteReady">
169           <output message="s0:onQuoteReadyHttpGetOut"/>
170           <input message="s0:onQuoteReadyHttpGetIn"/>
171         </operation>
172         <operation name="getQuote">
173           <input message="s0:getQuoteHttpGetIn"/>
174           <output message="s0:getQuoteHttpGetOut"/>
175         </operation>
176       </portType>
177       <portType name="QuoteServiceHttpPost">
178         <operation name="onQuoteReady">
179           <output message="s0:onQuoteReadyHttpPostOut"/>
180           <input message="s0:onQuoteReadyHttpPostIn"/>
181         </operation>
182         <operation name="getQuote">
183           <input message="s0:getQuoteHttpPostIn"/>
184           <output message="s0:getQuoteHttpPostOut"/>
185         </operation>
186       </portType>
187       <binding name="QuoteServiceSoap" type="s0:QuoteServiceSoap">
188         <soap:binding transport="http://schemas.xmlsoap.org/soap/http" style="document"/>
189         <operation name="onQuoteReady">
190           <soap:operation soapAction="http://workshop.bea.com/QuoteService/onQuoteReady" style="document"/>
191           <cw:transition phase="finish"/>
192           <input>
193             <soap:body use="literal"/>
194           </input>
195           <output>
196             <soap:body use="literal"/>
197             <soap:header wsdl:required="true" message="s0:CallbackHeader_literal" part="CallbackHeader" use="literal" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"/>
198           </output>
199         </operation>
200         <operation name="getQuote">
201           <soap:operation soapAction="http://workshop.bea.com/QuoteService/getQuote" style="document"/>
202           <cw:transition phase="start"/>
203           <input>
204             <soap:body use="literal"/>
205             <soap:header wsdl:required="true" message="s0:StartHeader_literal" part="StartHeader" use="literal" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"/>
206           </input>
207           <output>
208             <soap:body use="literal"/>
209           </output>
210         </operation>
211       </binding>
212       <binding name="QuoteServiceHttpGet" type="s0:QuoteServiceHttpGet">
213         <http:binding verb="GET"/>
214         <operation name="onQuoteReady">
215           <http:operation location="/onQuoteReady"/>
216           <cw:transition phase="finish"/>
217           <input>
218             <mime:mimeXml part="Body"/>
219           </input>
220           <output>
221             <http:urlEncoded/>
222           </output>
223         </operation>
224         <operation name="getQuote">
225           <http:operation location="/getQuote"/>
226           <cw:transition phase="start"/>
227           <input>
228             <http:urlEncoded/>
229           </input>
230           <output/>
231         </operation>
232       </binding>
233       <binding name="QuoteServiceHttpPost" type="s0:QuoteServiceHttpPost">
234         <http:binding verb="POST"/>
235         <operation name="onQuoteReady">
236           <http:operation location="/onQuoteReady"/>
237           <cw:transition phase="finish"/>
238           <input>
239             <mime:mimeXml part="Body"/>
240           </input>
241           <output>
242             <mime:content type="application/x-www-form-urlencoded"/>
243           </output>
244         </operation>
245         <operation name="getQuote">
246           <http:operation location="/getQuote"/>
247           <cw:transition phase="start"/>
248           <input>
249             <mime:content type="application/x-www-form-urlencoded"/>
250           </input>
251           <output/>
252         </operation>
253       </binding>
254       <service name="QuoteService">
255         <documentation>&lt;p&gt;This is the original service from which QuoteServiceControl.jcx was generated. Notice that the getQuote method takes two parameters. In QuoteService.jcx, the signature of the method is changed to accept a single parameter and hard-code the other.&lt;/p&gt; &lt;p&gt;See the comments in QuoteServiceControl.jcx for details.&lt;/p&gt;</documentation>
256         <port name="QuoteServiceSoap" binding="s0:QuoteServiceSoap">
257           <soap:address location="http://localhost:7001/service/QuoteService.jws"/>
258         </port>
259         <port name="QuoteServiceHttpGet" binding="s0:QuoteServiceHttpGet">
260           <http:address location="http://localhost:7001/service/QuoteService.jws"/>
261         </port>
262         <port name="QuoteServiceHttpPost" binding="s0:QuoteServiceHttpPost">
263           <http:address location="http://localhost:7001/service/QuoteService.jws"/>
264         </port>
265       </service>
266     </definitions>
267  * ::
268  */