001: /**
002: * Licensed to the Apache Software Foundation (ASF) under one or more
003: * contributor license agreements. See the NOTICE file distributed with
004: * this work for additional information regarding copyright ownership.
005: * The ASF licenses this file to You under the Apache License, Version 2.0
006: * (the "License"); you may not use this file except in compliance with
007: * the License. You may obtain a copy of the License at
008: *
009: * http://www.apache.org/licenses/LICENSE-2.0
010: *
011: * Unless required by applicable law or agreed to in writing, software
012: * distributed under the License is distributed on an "AS IS" BASIS,
013: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014: * See the License for the specific language governing permissions and
015: * limitations under the License.
016: */package org.apache.geronimo.axis.client;
017:
018: import java.net.URL;
019: import javax.xml.namespace.QName;
020:
021: import org.apache.axis.AxisFault;
022: import org.apache.axis.NoEndPointException;
023: import org.apache.axis.client.Call;
024: import org.apache.axis.client.Service;
025:
026: /**
027: * @version $Rev: 476049 $ $Date: 2006-11-16 20:35:17 -0800 (Thu, 16 Nov 2006) $
028: */
029: public class GenericServiceEndpoint extends org.apache.axis.client.Stub {
030:
031: public GenericServiceEndpoint(QName portQName, Service service,
032: URL location) {
033: this .service = service;
034: cachedEndpoint = location;
035: cachedPortName = portQName;
036:
037: }
038:
039: Call createCall() throws java.rmi.RemoteException {
040: try {
041: org.apache.axis.client.Call _call = (org.apache.axis.client.Call) service
042: .createCall();
043: if (super .maintainSessionSet) {
044: _call.setMaintainSession(super .maintainSession);
045: }
046: if (super .cachedUsername != null) {
047: _call.setUsername(super .cachedUsername);
048: }
049: if (super .cachedPassword != null) {
050: _call.setPassword(super .cachedPassword);
051: }
052: if (super .cachedEndpoint != null) {
053: _call.setTargetEndpointAddress(super .cachedEndpoint);
054: }
055: if (super .cachedTimeout != null) {
056: _call.setTimeout(super .cachedTimeout);
057: }
058: if (super .cachedPortName != null) {
059: _call.setPortName(super .cachedPortName);
060: }
061: java.util.Enumeration keys = super .cachedProperties.keys();
062: while (keys.hasMoreElements()) {
063: java.lang.String key = (java.lang.String) keys
064: .nextElement();
065: _call.setProperty(key, super .cachedProperties.get(key));
066: }
067: // All the type mapping information is registered
068: // when the first call is made.
069: // The type mapping information is actually registered in
070: // the TypeMappingRegistry of the service, which
071: // is the reason why registration is only needed for the first call.
072: //TODO figure out if this can be done during deployment!
073: // synchronized (this) {
074: // if (firstCall()) {
075: // // must set encoding style before registering serializers
076: // //TODO these constants probably need to be parameters of GSE.
077: // _call.setSOAPVersion(org.apache.axis.soap.SOAPConstants.SOAP11_CONSTANTS);
078: //// _call.setEncodingStyle(org.apache.axis.Constants.URI_SOAP11_ENC);
079: // //override unsigned long mapping
080: // _call.registerTypeMapping(BigInteger.class,
081: // Constants.XSD_UNSIGNEDLONG,
082: // new SimpleSerializerFactory(BigInteger.class, Constants.XSD_UNSIGNEDLONG),
083: // new SimpleDeserializerFactory(BigInteger.class, Constants.XSD_UNSIGNEDLONG));
084: // _call.registerTypeMapping(URI.class,
085: // Constants.XSD_ANYURI,
086: // new SimpleSerializerFactory(URI.class, Constants.XSD_ANYURI),
087: // new SimpleDeserializerFactory(URI.class, Constants.XSD_ANYURI));
088: // for (Iterator iterator = typeInfo.iterator(); iterator.hasNext();) {
089: // TypeInfo info = (TypeInfo) iterator.next();
090: // _call.registerTypeMapping(info.getClazz(), info.getqName(), info.getSerFactoryClass(), info.getDeserFactoryClass(), false);
091: // }
092: // }
093: // }
094: return _call;
095: } catch (java.lang.Throwable t) {
096: throw new org.apache.axis.AxisFault(
097: "Failure trying to get the Call object", t);
098: }
099: }
100:
101: void checkCachedEndpoint() throws NoEndPointException {
102: if (cachedEndpoint == null) {
103: throw new NoEndPointException();
104: }
105: }
106:
107: void setUpCall(Call call) throws AxisFault {
108: setRequestHeaders(call);
109: setAttachments(call);
110: }
111:
112: }
|