RegisterPerson.jws Sample

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

Sample Location

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

BEA_HOME/weblogic81/samples/workshop/SamplesApp/WebServices/proxy/register/

Sample Source Code


001 package proxy.register; 
002 
003 import proxy.register.Person;
004 import proxy.register.Contact;
005 
006 /**
007  <p>This web service serves as a target web service for the RegisterClient.java
008  * web service client. The client illustrates invocation of a WebLogic Workshop
009  * conversational web service that uses complex Java types in its interface.</p>
010  *
011  <p>A sample Java client for this web service is located in:
012  * %WL_HOME%\samples\workshop\SamplesApp\ProxyClient\register\RegisterClient.java</p>
013  
014  * @jws:conversation-lifetime max-age="5 minutes"
015  */
016 public class RegisterPerson implements com.bea.jws.WebService
017 
018     /*
019      * m_Person represents the conversational state of this web service. Any member
020      * variables of the web service's class are persisted on a per conversation
021      * basis.
022      */
023     Person m_Person = null;
024     
025     /**
026      <p>Starts a conversation and accepts initial Person data.</p><br>
027      
028      * @common:operation
029      * @jws:conversation phase="start"
030      */
031     public boolean setPerson(Person newPerson)
032     {
033         boolean retval = false;
034         
035         ifnewPerson != null ) {
036             m_Person = newPerson;
037             retval = true;
038         }
039         else {
040             m_Person = null;
041             retval = false;
042         }
043         return retval;
044     }
045 
046     /**
047      <p>Returns the current Person data.</p><br>
048      
049      * @common:operation
050      * @jws:conversation phase="continue"
051      */
052     public Person getPerson()
053     {
054         return m_Person;
055     }
056 
057     /**
058      <p>Accepts new <tt>home</tt> contact data for the Person.</p>
059      *
060      <p>The default SOAP message encoding for WebLogic Workshop web services is
061      * SOAP document/literal, but this may be set on a per web service or per
062      * method basis. This method uses the default, so it expects its argument to
063      * be document/literal encoded.</p><br>
064      
065      * @common:operation
066      * @jws:conversation phase="continue"
067      */
068     public boolean setHomeContact(Contact newContact)
069     {
070         boolean retval = false;
071         
072         ifnewContact != null ) {
073             m_Person.home = newContact;
074             retval = true;
075         }
076         else {
077             m_Person.home = null;
078             retval = false;
079         }
080         return retval;
081     }
082     
083     /**
084      <p>Accepts new <tt>home</tt> contact data for the Person.</p>
085      
086      <p>The default SOAP message encoding for WebLogic Workshop web services is
087      * SOAP document/literal, but this may be set on a per web service or per
088      * method basis. This method overrides the default, specifying it expects its
089      * argument to be SOAP-RPC encoded.</p><br>
090      
091      * @common:operation
092      * @jws:conversation phase="continue"
093      * @jws:protocol soap-style="rpc"
094      */
095     public boolean setHomeContactRPC(Contact newContact)
096     {
097         boolean retval = false;
098         
099         ifnewContact != null ) {
100             m_Person.home = newContact;
101             retval = true;
102         }
103         else {
104             m_Person.home = null;
105             retval = false;
106         }
107         return retval;
108     }
109     
110     /**
111      <p>Returns the current <tt>home</tt> contact data for the Person.</p>
112      
113      <p>The default SOAP message encoding for WebLogic Workshop web services is
114      * SOAP document/literal, but this may be set on a per web service or per
115      * method basis. This method uses the default, so its return value is
116      * document/literal encoded.</p><br>
117      
118      * @common:operation
119      * @jws:conversation phase="continue"
120      */
121     public Contact getHomeContact()
122     {
123         Contact retval = null;
124         
125         ifm_Person.home != null ) {
126             retval = m_Person.home;
127         }
128         return retval;
129     }    
130 
131     /**
132      <p>Accepts new <tt>work</tt> contact data for the Person.</p>
133      
134      <p>The default SOAP message encoding for WebLogic Workshop web services is
135      * SOAP document/literal, but this may be set on a per web service or per
136      * method basis. This method uses the default, so it expects its argument to
137      * be document/literal encoded.</p><br>
138      
139      * @common:operation
140      * @jws:conversation phase="continue"
141      */
142     public boolean setWorkContact(Contact newContact)
143     {
144         boolean retval = false;
145         
146         ifnewContact != null ) {
147             m_Person.work = newContact;
148             retval = true;
149         }
150         else {
151             m_Person.work = null;
152             retval = false;
153         }
154         return retval;
155     }
156 
157     /**
158      <p>Accepts new <tt>work</tt> contact data for the Person.</p>
159      
160      <p>The default SOAP message encoding for WebLogic Workshop web services is
161      * SOAP document/literal, but this may be set on a per web service or per
162      * method basis. This method overrides the default, specifying it expects its
163      * argument to be SOAP-RPC encoded.</p><br>
164     
165      * @common:operation
166      * @jws:conversation phase="continue"
167      * @jws:protocol soap-style="rpc"
168      */
169     public boolean setWorkContactRPC(Contact newContact)
170     {
171         boolean retval = false;
172         
173         ifnewContact != null ) {
174             m_Person.work = newContact;
175             retval = true;
176         }
177         else {
178             m_Person.work = null;
179             retval = false;
180         }
181         return retval;
182     }
183 
184     /**
185      <p>Returns the current <tt>work</tt> contact data for the Person.</p>
186      
187      <p>The default SOAP message encoding for WebLogic Workshop web services is
188      * SOAP document/literal, but this may be set on a per web service or per
189      * method basis. This method uses the default, so its return value is
190      * document/literal encoded.</p><br>
191      
192      * @common:operation
193      * @jws:conversation phase="continue"
194      */
195     public Contact getWorkContact()
196     {
197         Contact retval = null;
198         
199         ifm_Person.work != null ) {
200             retval = m_Person.work;
201         }
202         return retval;
203     }
204 
205     /**
206      <p>Terminates the current conversation.</p>
207      
208      * @common:operation
209      * @jws:conversation phase="finish"
210      */
211     public void endSession()
212     {
213     }
214 }