01: /**
02: * Licensed to the Apache Software Foundation (ASF) under one or more
03: * contributor license agreements. See the NOTICE file distributed with
04: * this work for additional information regarding copyright ownership.
05: * The ASF licenses this file to You under the Apache License, Version 2.0
06: * (the "License"); you may not use this file except in compliance with
07: * the License. You may obtain a copy of the License at
08: *
09: * 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: */package org.apache.openejb.server.axis.client;
17:
18: import net.sf.cglib.core.Signature;
19: import org.apache.axis.AxisFault;
20: import org.apache.axis.client.Call;
21: import org.apache.axis.description.OperationDesc;
22: import org.apache.axis.soap.SOAPConstants;
23:
24: import javax.xml.namespace.QName;
25: import java.rmi.RemoteException;
26:
27: public class OperationInfo {
28: private final OperationDesc operationDesc;
29: private final boolean useSOAPAction;
30: private final String soapActionURI;
31: private final SOAPConstants soapVersion;
32: private final QName operationName;
33: private final String methodName;
34: private final String methodDesc;
35:
36: public OperationInfo(OperationDesc operationDesc,
37: boolean useSOAPAction, String soapActionURI,
38: SOAPConstants soapVersion, QName operationName,
39: String methodName, String methodDesc) {
40: this .operationDesc = operationDesc;
41: this .useSOAPAction = useSOAPAction;
42: this .soapActionURI = soapActionURI;
43: this .soapVersion = soapVersion;
44: this .operationName = operationName;
45: this .methodName = methodName;
46: this .methodDesc = methodDesc;
47: }
48:
49: public Signature getSignature() {
50: return new Signature(methodName, methodDesc);
51: }
52:
53: public OperationDesc getOperationDesc() {
54: return operationDesc;
55: }
56:
57: public boolean isUseSOAPAction() {
58: return useSOAPAction;
59: }
60:
61: public String getSoapActionURI() {
62: return soapActionURI;
63: }
64:
65: public SOAPConstants getSoapVersion() {
66: return soapVersion;
67: }
68:
69: public QName getOperationName() {
70: return operationName;
71: }
72:
73: public void prepareCall(Call call) {
74: call.setOperation(operationDesc);
75: call.setUseSOAPAction(useSOAPAction);
76: call.setSOAPActionURI(soapActionURI);
77: call.setSOAPVersion(soapVersion);
78: call.setOperationName(operationName);
79: //GAH!!!
80: call.setOperationStyle(operationDesc.getStyle());
81: call.setOperationUse(operationDesc.getUse());
82: }
83:
84: public Throwable unwrapFault(RemoteException re) {
85: if (re instanceof AxisFault && re.getCause() != null) {
86: Throwable t = re.getCause();
87: if (operationDesc.getFaultByClass(t.getClass()) != null) {
88: return t;
89: }
90: }
91: return re;
92: }
93: }
|