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

Save This Page
Home » openejb-3.1.2-src » org.apache » openejb » server » axis » client » [javadoc | source]