KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > objectweb > jass > examples > travelagency > ws > TravelAgencySoapBindingStub


1 /**
2  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
3  -
4  - JASS: Java Advanced tranSaction Support
5  -
6  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
7  -
8  - This module was originally developed by
9  -
10  - LSD (Distributed Systems Lab, http://lsd.ls.fi.upm.es/lsd/lsd.htm)
11  - at Universidad Politecnica de Madrid (UPM) as an ObjectWeb Consortium
12  - (http://www.objectweb.org) project.
13  -
14  - This project has been partially funded by the European Commission under
15  - the IST programme of V FP grant IST-2001-37126 and by the Spanish
16  - Ministry of Science & Technology (MCyT) grants TIC2002-10376-E and
17  - TIC2001-1586-C03-02
18  -
19  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
20  - The original code and portions created by LSD are
21  - Copyright (c) 2004 LSD (UPM)
22  - All rights reserved.
23  -
24  - Redistribution and use in source and binary forms, with or without
25  - modification, are permitted provided that the following conditions are met:
26  -
27  - -Redistributions of source code must retain the above copyright notice, this
28  - list of conditions and the following disclaimer.
29  -
30  - -Redistributions in binary form must reproduce the above copyright notice,
31  - this list of conditions and the following disclaimer in the documentation
32  - and/or other materials provided with the distribution.
33  -
34  - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
35  - AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
36  - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
37  - ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
38  - LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
39  - CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
40  - SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
41  - INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
42  - CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
43  - ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
44  - POSSIBILITY OF SUCH DAMAGE.
45  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
46  -
47  - Author: Francisco Perez Sorrosal (frperezs)
48  -
49  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
50 */

51
52 package org.objectweb.jass.examples.travelagency.ws;
53
54 public class TravelAgencySoapBindingStub extends org.apache.axis.client.Stub implements org.objectweb.jass.examples.travelagency.ws.TravelAgency {
55     private java.util.Vector cachedSerClasses = new java.util.Vector();
56     private java.util.Vector cachedSerQNames = new java.util.Vector();
57     private java.util.Vector cachedSerFactories = new java.util.Vector();
58     private java.util.Vector cachedDeserFactories = new java.util.Vector();
59
60     static org.apache.axis.description.OperationDesc [] _operations;
61
62     static {
63         _operations = new org.apache.axis.description.OperationDesc[2];
64         org.apache.axis.description.OperationDesc oper;
65         oper = new org.apache.axis.description.OperationDesc();
66         oper.setName("reserveSeats");
67         oper.addParameter(new javax.xml.namespace.QName("", "in0"), new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "int"), int.class, org.apache.axis.description.ParameterDesc.IN, false, false);
68         oper.setReturnType(new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "int"));
69         oper.setReturnClass(int.class);
70         oper.setReturnQName(new javax.xml.namespace.QName("", "reserveSeatsReturn"));
71         oper.setStyle(org.apache.axis.enum.Style.RPC);
72         oper.setUse(org.apache.axis.enum.Use.ENCODED);
73         oper.addFault(new org.apache.axis.description.FaultDesc(
74                       new javax.xml.namespace.QName("http://ws.travelagency.examples.jass.objectweb.org", "fault"),
75                       "org.objectweb.jass.examples.travelagency.ws.NotEnoughSeatsException",
76                       new javax.xml.namespace.QName("http://exceptions.travelagency.examples.jass.objectweb.org", "NotEnoughSeatsException"),
77                       true
78                      ));
79         oper.addFault(new org.apache.axis.description.FaultDesc(
80                       new javax.xml.namespace.QName("http://ws.travelagency.examples.jass.objectweb.org", "fault"),
81                       "org.objectweb.jass.examples.travelagency.ws.DBException",
82                       new javax.xml.namespace.QName("http://exceptions.travelagency.examples.jass.objectweb.org", "DBException"),
83                       true
84                      ));
85         _operations[0] = oper;
86
87         oper = new org.apache.axis.description.OperationDesc();
88         oper.setName("reserveRooms");
89         oper.addParameter(new javax.xml.namespace.QName("", "in0"), new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "int"), int.class, org.apache.axis.description.ParameterDesc.IN, false, false);
90         oper.setReturnType(new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "int"));
91         oper.setReturnClass(int.class);
92         oper.setReturnQName(new javax.xml.namespace.QName("", "reserveRoomsReturn"));
93         oper.setStyle(org.apache.axis.enum.Style.RPC);
94         oper.setUse(org.apache.axis.enum.Use.ENCODED);
95         oper.addFault(new org.apache.axis.description.FaultDesc(
96                       new javax.xml.namespace.QName("http://ws.travelagency.examples.jass.objectweb.org", "fault"),
97                       "org.objectweb.jass.examples.travelagency.ws.DBException",
98                       new javax.xml.namespace.QName("http://exceptions.travelagency.examples.jass.objectweb.org", "DBException"),
99                       true
100                      ));
101         oper.addFault(new org.apache.axis.description.FaultDesc(
102                       new javax.xml.namespace.QName("http://ws.travelagency.examples.jass.objectweb.org", "fault"),
103                       "org.objectweb.jass.examples.travelagency.ws.NotEnoughRoomsException",
104                       new javax.xml.namespace.QName("http://exceptions.travelagency.examples.jass.objectweb.org", "NotEnoughRoomsException"),
105                       true
106                      ));
107         _operations[1] = oper;
108
109     }
110
111     public TravelAgencySoapBindingStub() throws org.apache.axis.AxisFault {
112          this(null);
113     }
114
115     public TravelAgencySoapBindingStub(java.net.URL endpointURL, javax.xml.rpc.Service service) throws org.apache.axis.AxisFault {
116          this(service);
117          super.cachedEndpoint = endpointURL;
118     }
119
120     public TravelAgencySoapBindingStub(javax.xml.rpc.Service service) throws org.apache.axis.AxisFault {
121         if (service == null) {
122             super.service = new org.apache.axis.client.Service();
123         } else {
124             super.service = service;
125         }
126             java.lang.Class cls;
127             javax.xml.namespace.QName qName;
128             java.lang.Class beansf = org.apache.axis.encoding.ser.BeanSerializerFactory.class;
129             java.lang.Class beandf = org.apache.axis.encoding.ser.BeanDeserializerFactory.class;
130             java.lang.Class enumsf = org.apache.axis.encoding.ser.EnumSerializerFactory.class;
131             java.lang.Class enumdf = org.apache.axis.encoding.ser.EnumDeserializerFactory.class;
132             java.lang.Class arraysf = org.apache.axis.encoding.ser.ArraySerializerFactory.class;
133             java.lang.Class arraydf = org.apache.axis.encoding.ser.ArrayDeserializerFactory.class;
134             java.lang.Class simplesf = org.apache.axis.encoding.ser.SimpleSerializerFactory.class;
135             java.lang.Class simpledf = org.apache.axis.encoding.ser.SimpleDeserializerFactory.class;
136             qName = new javax.xml.namespace.QName("http://exceptions.travelagency.examples.jass.objectweb.org", "DBException");
137             cachedSerQNames.add(qName);
138             cls = org.objectweb.jass.examples.travelagency.ws.DBException.class;
139             cachedSerClasses.add(cls);
140             cachedSerFactories.add(beansf);
141             cachedDeserFactories.add(beandf);
142
143             qName = new javax.xml.namespace.QName("http://exceptions.travelagency.examples.jass.objectweb.org", "NotEnoughRoomsException");
144             cachedSerQNames.add(qName);
145             cls = org.objectweb.jass.examples.travelagency.ws.NotEnoughRoomsException.class;
146             cachedSerClasses.add(cls);
147             cachedSerFactories.add(beansf);
148             cachedDeserFactories.add(beandf);
149
150             qName = new javax.xml.namespace.QName("http://exceptions.travelagency.examples.jass.objectweb.org", "NotEnoughSeatsException");
151             cachedSerQNames.add(qName);
152             cls = org.objectweb.jass.examples.travelagency.ws.NotEnoughSeatsException.class;
153             cachedSerClasses.add(cls);
154             cachedSerFactories.add(beansf);
155             cachedDeserFactories.add(beandf);
156
157     }
158
159     private org.apache.axis.client.Call createCall() throws java.rmi.RemoteException {
160         try {
161             org.apache.axis.client.Call _call =
162                     (org.apache.axis.client.Call) super.service.createCall();
163             if (super.maintainSessionSet) {
164                 _call.setMaintainSession(super.maintainSession);
165             }
166             if (super.cachedUsername != null) {
167                 _call.setUsername(super.cachedUsername);
168             }
169             if (super.cachedPassword != null) {
170                 _call.setPassword(super.cachedPassword);
171             }
172             if (super.cachedEndpoint != null) {
173                 _call.setTargetEndpointAddress(super.cachedEndpoint);
174             }
175             if (super.cachedTimeout != null) {
176                 _call.setTimeout(super.cachedTimeout);
177             }
178             if (super.cachedPortName != null) {
179                 _call.setPortName(super.cachedPortName);
180             }
181             java.util.Enumeration keys = super.cachedProperties.keys();
182             while (keys.hasMoreElements()) {
183                 java.lang.String key = (java.lang.String) keys.nextElement();
184                 _call.setProperty(key, super.cachedProperties.get(key));
185             }
186             // All the type mapping information is registered
187
// when the first call is made.
188
// The type mapping information is actually registered in
189
// the TypeMappingRegistry of the service, which
190
// is the reason why registration is only needed for the first call.
191
synchronized (this) {
192                 if (firstCall()) {
193                     // must set encoding style before registering serializers
194
_call.setSOAPVersion(org.apache.axis.soap.SOAPConstants.SOAP11_CONSTANTS);
195                     _call.setEncodingStyle(org.apache.axis.Constants.URI_SOAP11_ENC);
196                     for (int i = 0; i < cachedSerFactories.size(); ++i) {
197                         java.lang.Class cls = (java.lang.Class) cachedSerClasses.get(i);
198                         javax.xml.namespace.QName qName =
199                                 (javax.xml.namespace.QName) cachedSerQNames.get(i);
200                         java.lang.Class sf = (java.lang.Class)
201                                  cachedSerFactories.get(i);
202                         java.lang.Class df = (java.lang.Class)
203                                  cachedDeserFactories.get(i);
204                         _call.registerTypeMapping(cls, qName, sf, df, false);
205                     }
206                 }
207             }
208             return _call;
209         }
210         catch (java.lang.Throwable t) {
211             throw new org.apache.axis.AxisFault("Failure trying to get the Call object", t);
212         }
213     }
214
215     public int reserveSeats(int in0) throws java.rmi.RemoteException, org.objectweb.jass.examples.travelagency.ws.NotEnoughSeatsException, org.objectweb.jass.examples.travelagency.ws.DBException {
216         if (super.cachedEndpoint == null) {
217             throw new org.apache.axis.NoEndPointException();
218         }
219         org.apache.axis.client.Call _call = createCall();
220         _call.setOperation(_operations[0]);
221         _call.setUseSOAPAction(true);
222         _call.setSOAPActionURI("");
223         _call.setSOAPVersion(org.apache.axis.soap.SOAPConstants.SOAP11_CONSTANTS);
224         _call.setOperationName(new javax.xml.namespace.QName("http://ws.travelagency.examples.jass.objectweb.org", "reserveSeats"));
225
226         setRequestHeaders(_call);
227         setAttachments(_call);
228         java.lang.Object _resp = _call.invoke(new java.lang.Object[] {new java.lang.Integer(in0)});
229
230         if (_resp instanceof java.rmi.RemoteException) {
231             throw (java.rmi.RemoteException)_resp;
232         }
233         else {
234             extractAttachments(_call);
235             try {
236                 return ((java.lang.Integer) _resp).intValue();
237             } catch (java.lang.Exception _exception) {
238                 return ((java.lang.Integer) org.apache.axis.utils.JavaUtils.convert(_resp, int.class)).intValue();
239             }
240         }
241     }
242
243     public int reserveRooms(int in0) throws java.rmi.RemoteException, org.objectweb.jass.examples.travelagency.ws.DBException, org.objectweb.jass.examples.travelagency.ws.NotEnoughRoomsException {
244         if (super.cachedEndpoint == null) {
245             throw new org.apache.axis.NoEndPointException();
246         }
247         org.apache.axis.client.Call _call = createCall();
248         _call.setOperation(_operations[1]);
249         _call.setUseSOAPAction(true);
250         _call.setSOAPActionURI("");
251         _call.setSOAPVersion(org.apache.axis.soap.SOAPConstants.SOAP11_CONSTANTS);
252         _call.setOperationName(new javax.xml.namespace.QName("http://ws.travelagency.examples.jass.objectweb.org", "reserveRooms"));
253
254         setRequestHeaders(_call);
255         setAttachments(_call);
256         java.lang.Object _resp = _call.invoke(new java.lang.Object[] {new java.lang.Integer(in0)});
257
258         if (_resp instanceof java.rmi.RemoteException) {
259             throw (java.rmi.RemoteException)_resp;
260         }
261         else {
262             extractAttachments(_call);
263             try {
264                 return ((java.lang.Integer) _resp).intValue();
265             } catch (java.lang.Exception _exception) {
266                 return ((java.lang.Integer) org.apache.axis.utils.JavaUtils.convert(_resp, int.class)).intValue();
267             }
268         }
269     }
270
271 }
272
Popular Tags