08b2a6b09f1ab176da37deda30c42420c196d603
[jalview.git] / src / ext / vamsas / RegistryServiceSoapBindingStub.java
1 /*
2  * Jalview - A Sequence Alignment Editor and Viewer ($$Version-Rel$$)
3  * Copyright (C) $$Year-Rel$$ The Jalview Authors
4  * 
5  * This file is part of Jalview.
6  * 
7  * Jalview is free software: you can redistribute it and/or
8  * modify it under the terms of the GNU General Public License 
9  * as published by the Free Software Foundation, either version 3
10  * of the License, or (at your option) any later version.
11  *  
12  * Jalview is distributed in the hope that it will be useful, but 
13  * WITHOUT ANY WARRANTY; without even the implied warranty 
14  * of MERCHANTABILITY or FITNESS FOR A PARTICULAR 
15  * PURPOSE.  See the GNU General Public License for more details.
16  * 
17  * You should have received a copy of the GNU General Public License
18  * along with Jalview.  If not, see <http://www.gnu.org/licenses/>.
19  * The Jalview Authors are detailed in the 'AUTHORS' file.
20  */
21 package ext.vamsas;
22
23 public class RegistryServiceSoapBindingStub extends
24         org.apache.axis.client.Stub implements ext.vamsas.IRegistry
25 {
26   private java.util.Vector cachedSerClasses = new java.util.Vector();
27
28   private java.util.Vector cachedSerQNames = new java.util.Vector();
29
30   private java.util.Vector cachedSerFactories = new java.util.Vector();
31
32   private java.util.Vector cachedDeserFactories = new java.util.Vector();
33
34   static org.apache.axis.description.OperationDesc[] _operations;
35
36   static
37   {
38     _operations = new org.apache.axis.description.OperationDesc[1];
39     _initOperationDesc1();
40   }
41
42   private static void _initOperationDesc1()
43   {
44     org.apache.axis.description.OperationDesc oper;
45     oper = new org.apache.axis.description.OperationDesc();
46     oper.setName("getServices");
47     oper.setReturnType(new javax.xml.namespace.QName(
48             "registry.objects.vamsas", "ServiceHandles"));
49     oper.setReturnClass(ext.vamsas.ServiceHandles.class);
50     oper.setReturnQName(new javax.xml.namespace.QName("",
51             "getServicesReturn"));
52     oper.setStyle(org.apache.axis.constants.Style.RPC);
53     oper.setUse(org.apache.axis.constants.Use.ENCODED);
54     _operations[0] = oper;
55
56   }
57
58   public RegistryServiceSoapBindingStub() throws org.apache.axis.AxisFault
59   {
60     this(null);
61   }
62
63   public RegistryServiceSoapBindingStub(java.net.URL endpointURL,
64           javax.xml.rpc.Service service) throws org.apache.axis.AxisFault
65   {
66     this(service);
67     super.cachedEndpoint = endpointURL;
68   }
69
70   public RegistryServiceSoapBindingStub(javax.xml.rpc.Service service)
71           throws org.apache.axis.AxisFault
72   {
73     if (service == null)
74     {
75       super.service = new org.apache.axis.client.Service();
76     }
77     else
78     {
79       super.service = service;
80     }
81     java.lang.Class cls;
82     javax.xml.namespace.QName qName;
83     java.lang.Class beansf = org.apache.axis.encoding.ser.BeanSerializerFactory.class;
84     java.lang.Class beandf = org.apache.axis.encoding.ser.BeanDeserializerFactory.class;
85     // java.lang.Class enumsf =
86     // org.apache.axis.encoding.ser.EnumSerializerFactory.class;
87     // java.lang.Class enumdf =
88     // org.apache.axis.encoding.ser.EnumDeserializerFactory.class;
89     java.lang.Class arraysf = org.apache.axis.encoding.ser.ArraySerializerFactory.class;
90     java.lang.Class arraydf = org.apache.axis.encoding.ser.ArrayDeserializerFactory.class;
91     // java.lang.Class simplesf =
92     // org.apache.axis.encoding.ser.SimpleSerializerFactory.class;
93     // java.lang.Class simpledf =
94     // org.apache.axis.encoding.ser.SimpleDeserializerFactory.class;
95     // java.lang.Class simplelistsf =
96     // org.apache.axis.encoding.ser.SimpleListSerializerFactory.class;
97     // java.lang.Class simplelistdf =
98     // org.apache.axis.encoding.ser.SimpleListDeserializerFactory.class;
99     qName = new javax.xml.namespace.QName("vamsas",
100             "ArrayOf_tns1_ServiceHandle");
101     cachedSerQNames.add(qName);
102     cls = ext.vamsas.ServiceHandle[].class;
103     cachedSerClasses.add(cls);
104     cachedSerFactories.add(arraysf);
105     cachedDeserFactories.add(arraydf);
106
107     qName = new javax.xml.namespace.QName("registry.objects.vamsas",
108             "ServiceHandles");
109     cachedSerQNames.add(qName);
110     cls = ext.vamsas.ServiceHandles.class;
111     cachedSerClasses.add(cls);
112     cachedSerFactories.add(beansf);
113     cachedDeserFactories.add(beandf);
114
115     qName = new javax.xml.namespace.QName("registry.objects.vamsas",
116             "ServiceHandle");
117     cachedSerQNames.add(qName);
118     cls = ext.vamsas.ServiceHandle.class;
119     cachedSerClasses.add(cls);
120     cachedSerFactories.add(beansf);
121     cachedDeserFactories.add(beandf);
122
123   }
124
125   protected org.apache.axis.client.Call createCall()
126           throws java.rmi.RemoteException
127   {
128     try
129     {
130       org.apache.axis.client.Call _call = (org.apache.axis.client.Call) super.service
131               .createCall();
132       if (super.maintainSessionSet)
133       {
134         _call.setMaintainSession(super.maintainSession);
135       }
136       if (super.cachedUsername != null)
137       {
138         _call.setUsername(super.cachedUsername);
139       }
140       if (super.cachedPassword != null)
141       {
142         _call.setPassword(super.cachedPassword);
143       }
144       if (super.cachedEndpoint != null)
145       {
146         _call.setTargetEndpointAddress(super.cachedEndpoint);
147       }
148       if (super.cachedTimeout != null)
149       {
150         _call.setTimeout(super.cachedTimeout);
151       }
152       if (super.cachedPortName != null)
153       {
154         _call.setPortName(super.cachedPortName);
155       }
156       java.util.Enumeration keys = super.cachedProperties.keys();
157       while (keys.hasMoreElements())
158       {
159         java.lang.String key = (java.lang.String) keys.nextElement();
160         _call.setProperty(key, super.cachedProperties.get(key));
161       }
162       // All the type mapping information is registered
163       // when the first call is made.
164       // The type mapping information is actually registered in
165       // the TypeMappingRegistry of the service, which
166       // is the reason why registration is only needed for the first call.
167       synchronized (this)
168       {
169         if (firstCall())
170         {
171           // must set encoding style before registering serializers
172           _call.setSOAPVersion(org.apache.axis.soap.SOAPConstants.SOAP11_CONSTANTS);
173           _call.setEncodingStyle(org.apache.axis.Constants.URI_SOAP11_ENC);
174           for (int i = 0; i < cachedSerFactories.size(); ++i)
175           {
176             java.lang.Class cls = (java.lang.Class) cachedSerClasses.get(i);
177             javax.xml.namespace.QName qName = (javax.xml.namespace.QName) cachedSerQNames
178                     .get(i);
179             java.lang.Class sf = (java.lang.Class) cachedSerFactories
180                     .get(i);
181             java.lang.Class df = (java.lang.Class) cachedDeserFactories
182                     .get(i);
183             _call.registerTypeMapping(cls, qName, sf, df, false);
184           }
185         }
186       }
187       return _call;
188     } catch (java.lang.Throwable _t)
189     {
190       throw new org.apache.axis.AxisFault(
191               "Failure trying to get the Call object", _t);
192     }
193   }
194
195   public ext.vamsas.ServiceHandles getServices()
196           throws java.rmi.RemoteException
197   {
198     if (super.cachedEndpoint == null)
199     {
200       throw new org.apache.axis.NoEndPointException();
201     }
202     org.apache.axis.client.Call _call = createCall();
203     _call.setOperation(_operations[0]);
204     _call.setUseSOAPAction(true);
205     _call.setSOAPActionURI("");
206     _call.setSOAPVersion(org.apache.axis.soap.SOAPConstants.SOAP11_CONSTANTS);
207     _call.setOperationName(new javax.xml.namespace.QName("vamsas",
208             "getServices"));
209
210     setRequestHeaders(_call);
211     setAttachments(_call);
212     java.lang.Object _resp = _call.invoke(new java.lang.Object[] {});
213
214     if (_resp instanceof java.rmi.RemoteException)
215     {
216       throw (java.rmi.RemoteException) _resp;
217     }
218     else
219     {
220       extractAttachments(_call);
221       try
222       {
223         return (ext.vamsas.ServiceHandles) _resp;
224       } catch (java.lang.Exception _exception)
225       {
226         return (ext.vamsas.ServiceHandles) org.apache.axis.utils.JavaUtils
227                 .convert(_resp, ext.vamsas.ServiceHandles.class);
228       }
229     }
230   }
231
232 }