KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > geronimo > axis > client > GenericServiceEndpoint


1 /**
2  * Licensed to the Apache Software Foundation (ASF) under one or more
3  * contributor license agreements. See the NOTICE file distributed with
4  * this work for additional information regarding copyright ownership.
5  * The ASF licenses this file to You under the Apache License, Version 2.0
6  * (the "License"); you may not use this file except in compliance with
7  * the License. You may obtain a copy of the License at
8  *
9  * http://www.apache.org/licenses/LICENSE-2.0
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  */

17 package org.apache.geronimo.axis.client;
18
19 import java.net.URL JavaDoc;
20 import javax.xml.namespace.QName JavaDoc;
21
22 import org.apache.axis.AxisFault;
23 import org.apache.axis.NoEndPointException;
24 import org.apache.axis.client.Call;
25 import org.apache.axis.client.Service;
26
27 /**
28  * @version $Rev: 476049 $ $Date: 2006-11-16 23:35:17 -0500 (Thu, 16 Nov 2006) $
29  */

30 public class GenericServiceEndpoint extends org.apache.axis.client.Stub {
31
32
33     public GenericServiceEndpoint(QName JavaDoc portQName, Service service, URL JavaDoc location) {
34         this.service = service;
35         cachedEndpoint = location;
36         cachedPortName = portQName;
37
38     }
39
40     Call createCall() throws java.rmi.RemoteException JavaDoc {
41         try {
42             org.apache.axis.client.Call _call =
43                     (org.apache.axis.client.Call) service.createCall();
44             if (super.maintainSessionSet) {
45                 _call.setMaintainSession(super.maintainSession);
46             }
47             if (super.cachedUsername != null) {
48                 _call.setUsername(super.cachedUsername);
49             }
50             if (super.cachedPassword != null) {
51                 _call.setPassword(super.cachedPassword);
52             }
53             if (super.cachedEndpoint != null) {
54                 _call.setTargetEndpointAddress(super.cachedEndpoint);
55             }
56             if (super.cachedTimeout != null) {
57                 _call.setTimeout(super.cachedTimeout);
58             }
59             if (super.cachedPortName != null) {
60                 _call.setPortName(super.cachedPortName);
61             }
62             java.util.Enumeration JavaDoc keys = super.cachedProperties.keys();
63             while (keys.hasMoreElements()) {
64                 java.lang.String JavaDoc key = (java.lang.String JavaDoc) keys.nextElement();
65                 _call.setProperty(key, super.cachedProperties.get(key));
66             }
67             // All the type mapping information is registered
68
// when the first call is made.
69
// The type mapping information is actually registered in
70
// the TypeMappingRegistry of the service, which
71
// is the reason why registration is only needed for the first call.
72
//TODO figure out if this can be done during deployment!
73
// synchronized (this) {
74
// if (firstCall()) {
75
// // must set encoding style before registering serializers
76
// //TODO these constants probably need to be parameters of GSE.
77
// _call.setSOAPVersion(org.apache.axis.soap.SOAPConstants.SOAP11_CONSTANTS);
78
//// _call.setEncodingStyle(org.apache.axis.Constants.URI_SOAP11_ENC);
79
// //override unsigned long mapping
80
// _call.registerTypeMapping(BigInteger.class,
81
// Constants.XSD_UNSIGNEDLONG,
82
// new SimpleSerializerFactory(BigInteger.class, Constants.XSD_UNSIGNEDLONG),
83
// new SimpleDeserializerFactory(BigInteger.class, Constants.XSD_UNSIGNEDLONG));
84
// _call.registerTypeMapping(URI.class,
85
// Constants.XSD_ANYURI,
86
// new SimpleSerializerFactory(URI.class, Constants.XSD_ANYURI),
87
// new SimpleDeserializerFactory(URI.class, Constants.XSD_ANYURI));
88
// for (Iterator iterator = typeInfo.iterator(); iterator.hasNext();) {
89
// TypeInfo info = (TypeInfo) iterator.next();
90
// _call.registerTypeMapping(info.getClazz(), info.getqName(), info.getSerFactoryClass(), info.getDeserFactoryClass(), false);
91
// }
92
// }
93
// }
94
return _call;
95         } catch (java.lang.Throwable JavaDoc t) {
96             throw new org.apache.axis.AxisFault("Failure trying to get the Call object", t);
97         }
98     }
99
100     void checkCachedEndpoint() throws NoEndPointException {
101         if (cachedEndpoint == null) {
102             throw new NoEndPointException();
103         }
104     }
105
106     void setUpCall(Call call) throws AxisFault {
107         setRequestHeaders(call);
108         setAttachments(call);
109     }
110
111 }
112
Popular Tags