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.openejb.server.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: public class GenericServiceEndpoint extends org.apache.axis.client.Stub {
027: public GenericServiceEndpoint(QName portQName, Service service,
028: URL location) {
029: this .service = service;
030: cachedEndpoint = location;
031: cachedPortName = portQName;
032:
033: }
034:
035: Call createCall() throws java.rmi.RemoteException {
036: try {
037: org.apache.axis.client.Call _call = (org.apache.axis.client.Call) service
038: .createCall();
039: if (super .maintainSessionSet) {
040: _call.setMaintainSession(super .maintainSession);
041: }
042: if (super .cachedUsername != null) {
043: _call.setUsername(super .cachedUsername);
044: }
045: if (super .cachedPassword != null) {
046: _call.setPassword(super .cachedPassword);
047: }
048: if (super .cachedEndpoint != null) {
049: _call.setTargetEndpointAddress(super .cachedEndpoint);
050: }
051: if (super .cachedTimeout != null) {
052: _call.setTimeout(super .cachedTimeout);
053: }
054: if (super .cachedPortName != null) {
055: _call.setPortName(super .cachedPortName);
056: }
057: java.util.Enumeration keys = super .cachedProperties.keys();
058: while (keys.hasMoreElements()) {
059: java.lang.String key = (java.lang.String) keys
060: .nextElement();
061: _call.setProperty(key, super .cachedProperties.get(key));
062: }
063: // All the type mapping information is registered
064: // when the first call is made.
065: // The type mapping information is actually registered in
066: // the TypeMappingRegistry of the service, which
067: // is the reason why registration is only needed for the first call.
068: //TODO figure out if this can be done during deployment!
069: // synchronized (this) {
070: // if (firstCall()) {
071: // // must set encoding style before registering serializers
072: // //TODO these constants probably need to be parameters of GSE.
073: // _call.setSOAPVersion(org.apache.axis.soap.SOAPConstants.SOAP11_CONSTANTS);
074: //// _call.setEncodingStyle(org.apache.axis.Constants.URI_SOAP11_ENC);
075: // //override unsigned long mapping
076: // _call.registerTypeMapping(BigInteger.class,
077: // Constants.XSD_UNSIGNEDLONG,
078: // new SimpleSerializerFactory(BigInteger.class, Constants.XSD_UNSIGNEDLONG),
079: // new SimpleDeserializerFactory(BigInteger.class, Constants.XSD_UNSIGNEDLONG));
080: // _call.registerTypeMapping(URI.class,
081: // Constants.XSD_ANYURI,
082: // new SimpleSerializerFactory(URI.class, Constants.XSD_ANYURI),
083: // new SimpleDeserializerFactory(URI.class, Constants.XSD_ANYURI));
084: // for (Iterator iterator = typeInfo.iterator(); iterator.hasNext();) {
085: // TypeInfo info = (TypeInfo) iterator.next();
086: // _call.registerTypeMapping(info.getClazz(), info.getqName(), info.getSerFactoryClass(), info.getDeserFactoryClass(), false);
087: // }
088: // }
089: // }
090: return _call;
091: } catch (java.lang.Throwable t) {
092: throw new org.apache.axis.AxisFault(
093: "Failure trying to get the Call object", t);
094: }
095: }
096:
097: void checkCachedEndpoint() throws NoEndPointException {
098: if (cachedEndpoint == null) {
099: throw new NoEndPointException();
100: }
101: }
102:
103: void setUpCall(Call call) throws AxisFault {
104: setRequestHeaders(call);
105: setAttachments(call);
106: }
107: }
|