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 net.sf.cglib.core.Signature;
   20   import org.apache.axis.AxisFault;
   21   import org.apache.axis.client.Call;
   22   import org.apache.axis.description.OperationDesc;
   23   import org.apache.axis.soap.SOAPConstants;
   24   
   25   import javax.xml.namespace.QName;
   26   import java.rmi.RemoteException;
   27   
   28   public class OperationInfo {
   29       private final OperationDesc operationDesc;
   30       private final boolean useSOAPAction;
   31       private final String soapActionURI;
   32       private final SOAPConstants soapVersion;
   33       private final QName operationName;
   34       private final String methodName;
   35       private final String methodDesc;
   36   
   37       public OperationInfo(OperationDesc operationDesc, boolean useSOAPAction, String soapActionURI, SOAPConstants soapVersion, QName operationName, String methodName, String methodDesc) {
   38           this.operationDesc = operationDesc;
   39           this.useSOAPAction = useSOAPAction;
   40           this.soapActionURI = soapActionURI;
   41           this.soapVersion = soapVersion;
   42           this.operationName = operationName;
   43           this.methodName = methodName;
   44           this.methodDesc = methodDesc;
   45       }
   46   
   47       public Signature getSignature() {
   48           return new Signature(methodName, methodDesc);
   49       }
   50   
   51       public OperationDesc getOperationDesc() {
   52           return operationDesc;
   53       }
   54   
   55       public boolean isUseSOAPAction() {
   56           return useSOAPAction;
   57       }
   58   
   59       public String getSoapActionURI() {
   60           return soapActionURI;
   61       }
   62   
   63       public SOAPConstants getSoapVersion() {
   64           return soapVersion;
   65       }
   66   
   67       public QName getOperationName() {
   68           return operationName;
   69       }
   70   
   71       public void prepareCall(Call call) {
   72           call.setOperation(operationDesc);
   73           call.setUseSOAPAction(useSOAPAction);
   74           call.setSOAPActionURI(soapActionURI);
   75           call.setSOAPVersion(soapVersion);
   76           call.setOperationName(operationName);
   77           //GAH!!!
   78           call.setOperationStyle(operationDesc.getStyle());
   79           call.setOperationUse(operationDesc.getUse());
   80       }
   81   
   82       public Throwable unwrapFault(RemoteException re) {
   83           if (re instanceof AxisFault && re.getCause() != null) {
   84               Throwable t = re.getCause();
   85               if (operationDesc.getFaultByClass(t.getClass()) != null) {
   86                   return t;
   87               }
   88           }
   89           return re;
   90       }
   91   }

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