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.io.Serializable;
019: import java.rmi.RemoteException;
020:
021: import javax.xml.namespace.QName;
022:
023: import org.apache.axis.description.OperationDesc;
024: import org.apache.axis.description.FaultDesc;
025: import org.apache.axis.client.Call;
026: import org.apache.axis.soap.SOAPConstants;
027: import org.apache.axis.AxisFault;
028: import net.sf.cglib.core.Signature;
029:
030: /**
031: * @version $Rev: 476049 $ $Date: 2006-11-16 20:35:17 -0800 (Thu, 16 Nov 2006) $
032: */
033: public class OperationInfo implements Serializable {
034:
035: private final OperationDesc operationDesc;
036: private final boolean useSOAPAction;
037: private final String soapActionURI;
038: private final SOAPConstants soapVersion;
039: private final QName operationName;
040: private final String methodName;
041: private final String methodDesc;
042:
043: public OperationInfo(OperationDesc operationDesc,
044: boolean useSOAPAction, String soapActionURI,
045: SOAPConstants soapVersion, QName operationName,
046: String methodName, String methodDesc) {
047: this .operationDesc = operationDesc;
048: this .useSOAPAction = useSOAPAction;
049: this .soapActionURI = soapActionURI;
050: this .soapVersion = soapVersion;
051: this .operationName = operationName;
052: this .methodName = methodName;
053: this .methodDesc = methodDesc;
054: }
055:
056: public Signature getSignature() {
057: return new Signature(methodName, methodDesc);
058: }
059:
060: public OperationDesc getOperationDesc() {
061: return operationDesc;
062: }
063:
064: public boolean isUseSOAPAction() {
065: return useSOAPAction;
066: }
067:
068: public String getSoapActionURI() {
069: return soapActionURI;
070: }
071:
072: public SOAPConstants getSoapVersion() {
073: return soapVersion;
074: }
075:
076: public QName getOperationName() {
077: return operationName;
078: }
079:
080: public void prepareCall(Call call) {
081: call.setOperation(operationDesc);
082: call.setUseSOAPAction(useSOAPAction);
083: call.setSOAPActionURI(soapActionURI);
084: call.setSOAPVersion(soapVersion);
085: call.setOperationName(operationName);
086: //GAH!!!
087: call.setOperationStyle(operationDesc.getStyle());
088: call.setOperationUse(operationDesc.getUse());
089: }
090:
091: public Throwable unwrapFault(RemoteException re) {
092: if (re instanceof AxisFault && re.getCause() != null) {
093: Throwable t = re.getCause();
094: if (operationDesc.getFaultByClass(t.getClass()) != null) {
095: return t;
096: }
097: }
098: return re;
099: }
100: }
|