CustomJMSClient.jws Sample

This topic inludes the source code for the CustomJMSClient.jws Sample.

Sample Location

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

BEA_HOME/weblogic81/samples/workshop/SamplesApp/WebServices/jms/

Sample Source Code


01 package jms; 
02 
03 /**
04  <p>This web service shows the use of a customized jms control.</p>
05  *
06  <p>It uses the same queue for send and receive, so it will send messages to
07  * itself (defined in CustomJMSControl).  The queue used by this sample is
08  * preconfigured in the cg domain when WebLogic Server is installed.</p>
09  *
10  <p>"<i>sendPerson</i>" will publish a message to the send queue.</p>
11  *
12  <p>"<i>onPersonJMS</i>" will receive the message from the receive queue 
13  * (in this case, the message just sent from publish).</p>
14  * @common:target-namespace namespace="http://workshop.bea.com/CustomJMSClient"
15  */
16 public class CustomJMSClient implements com.bea.jws.WebService
17 
18     /**
19      * @common:control
20      */
21     private jms.CustomJMSControl myCustomQ;
22 
23     public Callback callback;
24 
25     public interface Callback {
26         /**
27          * @jws:conversation phase="finish"
28          */
29        public void onResponse(String msg);
30     }
31 
32     /**
33      * @common:operation
34      * @jws:conversation phase="start"
35      */
36     public void sendPerson(String firstname, String lastnamethrows Exception {
37 
38         String personname = firstname + " " + lastname;
39         myCustomQ.sendPersonJMSpersonname, 
40                              "red property""blue property");
41     }
42 
43     public void myCustomQ_onPersonJMS(String personname, 
44                                        String prop1, String prop2) {
45 
46         callback.onResponse(
47           "Hello, " + personname + 
48           ". You supplied property values '" + prop1 + "' and '" + prop2 + "'." );    
49     }
50