KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > geronimo > axis > client > OperationInfo


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.geronimo.axis.client;
18
19 import java.io.Serializable JavaDoc;
20 import java.rmi.RemoteException JavaDoc;
21
22 import javax.xml.namespace.QName JavaDoc;
23
24 import org.apache.axis.description.OperationDesc;
25 import org.apache.axis.description.FaultDesc;
26 import org.apache.axis.client.Call;
27 import org.apache.axis.soap.SOAPConstants;
28 import org.apache.axis.AxisFault;
29 import net.sf.cglib.core.Signature;
30
31 /**
32  * @version $Rev: 476049 $ $Date: 2006-11-16 23:35:17 -0500 (Thu, 16 Nov 2006) $
33  */

34 public class OperationInfo implements Serializable JavaDoc {
35
36     private final OperationDesc operationDesc;
37     private final boolean useSOAPAction;
38     private final String JavaDoc soapActionURI;
39     private final SOAPConstants soapVersion;
40     private final QName JavaDoc operationName;
41     private final String JavaDoc methodName;
42     private final String JavaDoc methodDesc;
43
44     public OperationInfo(OperationDesc operationDesc, boolean useSOAPAction, String JavaDoc soapActionURI, SOAPConstants soapVersion, QName JavaDoc operationName, String JavaDoc methodName, String JavaDoc methodDesc) {
45         this.operationDesc = operationDesc;
46         this.useSOAPAction = useSOAPAction;
47         this.soapActionURI = soapActionURI;
48         this.soapVersion = soapVersion;
49         this.operationName = operationName;
50         this.methodName = methodName;
51         this.methodDesc = methodDesc;
52     }
53
54     public Signature getSignature() {
55         return new Signature(methodName, methodDesc);
56     }
57
58     public OperationDesc getOperationDesc() {
59         return operationDesc;
60     }
61
62     public boolean isUseSOAPAction() {
63         return useSOAPAction;
64     }
65
66     public String JavaDoc getSoapActionURI() {
67         return soapActionURI;
68     }
69
70     public SOAPConstants getSoapVersion() {
71         return soapVersion;
72     }
73
74     public QName JavaDoc getOperationName() {
75         return operationName;
76     }
77
78     public void prepareCall(Call call) {
79         call.setOperation(operationDesc);
80         call.setUseSOAPAction(useSOAPAction);
81         call.setSOAPActionURI(soapActionURI);
82         call.setSOAPVersion(soapVersion);
83         call.setOperationName(operationName);
84         //GAH!!!
85
call.setOperationStyle(operationDesc.getStyle());
86         call.setOperationUse(operationDesc.getUse());
87     }
88
89     public Throwable JavaDoc unwrapFault(RemoteException JavaDoc re) {
90         if (re instanceof AxisFault && re.getCause() != null) {
91             Throwable JavaDoc t = re.getCause();
92             if (operationDesc.getFaultByClass(t.getClass()) != null) {
93                 return t;
94             }
95         }
96         return re;
97     }
98 }
99
Popular Tags