1 7 8 package test.wsdl.rpcParams; 9 10 import java.util.Enumeration ; 11 import java.util.Vector ; 12 import java.util.List ; 13 import java.util.ArrayList ; 14 import java.rmi.RemoteException ; 15 import javax.xml.namespace.QName ; 16 17 import org.apache.axis.description.OperationDesc; 18 import org.apache.axis.description.ParameterDesc; 19 import org.apache.axis.client.Stub; 20 21 public class RpcParamsBindingStub extends Stub implements RpcParamsTest { 22 private Vector cachedSerClasses = new Vector (); 23 private Vector cachedSerQNames = new Vector (); 24 private Vector cachedSerFactories = new Vector (); 25 private Vector cachedDeserFactories = new Vector (); 26 27 public RpcParamsBindingStub() throws org.apache.axis.AxisFault { 28 this(null); 29 } 30 31 public RpcParamsBindingStub(java.net.URL endpointURL, javax.xml.rpc.Service service) throws org.apache.axis.AxisFault { 32 this(service); 33 super.cachedEndpoint = endpointURL; 34 } 35 36 public RpcParamsBindingStub(javax.xml.rpc.Service service) throws org.apache.axis.AxisFault { 37 if (service == null) { 38 super.service = new org.apache.axis.client.Service(); 39 } else { 40 super.service = service; 41 } 42 Class cls; 43 QName qName; 44 Class beansf = org.apache.axis.encoding.ser.BeanSerializerFactory.class; 45 Class beandf = org.apache.axis.encoding.ser.BeanDeserializerFactory.class; 46 qName = new QName ("urn:rpcParams.wsdl.test", "EchoStruct"); 47 cachedSerQNames.add(qName); 48 cls = EchoStruct.class; 49 cachedSerClasses.add(cls); 50 cachedSerFactories.add(beansf); 51 cachedDeserFactories.add(beandf); 52 53 } 54 55 private org.apache.axis.client.Call createCall() throws RemoteException { 56 try { 57 org.apache.axis.client.Call _call = 58 (org.apache.axis.client.Call) super.service.createCall(); 59 if (super.maintainSessionSet) { 60 _call.setMaintainSession(super.maintainSession); 61 } 62 if (super.cachedUsername != null) { 63 _call.setUsername(super.cachedUsername); 64 } 65 if (super.cachedPassword != null) { 66 _call.setPassword(super.cachedPassword); 67 } 68 if (super.cachedEndpoint != null) { 69 _call.setTargetEndpointAddress(super.cachedEndpoint); 70 } 71 if (super.cachedTimeout != null) { 72 _call.setTimeout(super.cachedTimeout); 73 } 74 if (super.cachedPortName != null) { 75 _call.setPortName(super.cachedPortName); 76 } 77 Enumeration keys = super.cachedProperties.keys(); 78 while (keys.hasMoreElements()) { 79 String key = (String ) keys.nextElement(); 80 _call.setProperty(key, super.cachedProperties.get(key)); 81 } 82 synchronized (this) { 88 if (firstCall()) { 89 _call.setSOAPVersion(org.apache.axis.soap.SOAPConstants.SOAP11_CONSTANTS); 91 _call.setEncodingStyle(org.apache.axis.Constants.URI_SOAP11_ENC); 92 for (int i = 0; i < cachedSerFactories.size(); ++i) { 93 Class cls = (Class ) cachedSerClasses.get(i); 94 QName qName = 95 (QName ) cachedSerQNames.get(i); 96 Class sf = (Class ) 97 cachedSerFactories.get(i); 98 Class df = (Class ) 99 cachedDeserFactories.get(i); 100 _call.registerTypeMapping(cls, qName, sf, df, false); 101 } 102 } 103 } 104 return _call; 105 } 106 catch (Throwable t) { 107 throw new org.apache.axis.AxisFault("Failure trying to get the Call object", t); 108 } 109 } 110 111 114 public EchoStruct echo(String first, String second) throws RemoteException { 115 EchoStruct result; 116 if (super.cachedEndpoint == null) { 117 throw new org.apache.axis.NoEndPointException(); 118 } 119 120 OperationDesc operation = new OperationDesc(); 122 operation.setName("echo"); 123 if (first != null) 124 operation.addParameter(new QName ("", "first"), new QName ("http://www.w3.org/2001/XMLSchema", "string"), String .class, ParameterDesc.IN, false, false); 125 if (second != null) 126 operation.addParameter(new QName ("", "second"), new QName ("http://www.w3.org/2001/XMLSchema", "string"), String .class, ParameterDesc.IN, false, false); 127 operation.setReturnType(new QName ("urn:rpcParams.wsdl.test", "EchoStruct")); 128 operation.setReturnClass(EchoStruct.class); 129 operation.setReturnQName(new QName ("", "echoReturn")); 130 operation.setStyle(org.apache.axis.constants.Style.RPC); 131 operation.setUse(org.apache.axis.constants.Use.ENCODED); 132 133 org.apache.axis.client.Call _call = createCall(); 134 _call.setOperation(operation); 135 _call.setUseSOAPAction(true); 136 _call.setSOAPActionURI(""); 137 _call.setSOAPVersion(org.apache.axis.soap.SOAPConstants.SOAP11_CONSTANTS); 138 _call.setOperationName(new QName ("urn:rpcParams.wsdl.test", "echo")); 139 140 setRequestHeaders(_call); 141 setAttachments(_call); 142 143 List params = new ArrayList (2); 145 if (first != null) 146 params.add(first); 147 if (second != null) 148 params.add(second); 149 150 Object _resp = _call.invoke(params.toArray()); 151 152 if (_resp instanceof RemoteException ) { 153 throw (RemoteException )_resp; 154 } 155 else { 156 getResponseHeaders(_call); 157 extractAttachments(_call); 158 try { 159 result = (EchoStruct) _resp; 160 } catch (Exception _exception) { 161 result = (EchoStruct) org.apache.axis.utils.JavaUtils.convert(_resp, EchoStruct.class); 162 } 163 } 164 return result; 165 } 166 167 170 public EchoStruct echoReverse(String first, String second) throws RemoteException { 171 EchoStruct result; 172 if (super.cachedEndpoint == null) { 173 throw new org.apache.axis.NoEndPointException(); 174 } 175 176 OperationDesc operation = new OperationDesc(); 178 operation.setName("echo"); 179 if (second != null) 180 operation.addParameter(new QName ("", "second"), new QName ("http://www.w3.org/2001/XMLSchema", "string"), String .class, ParameterDesc.IN, false, false); 181 if (first != null) 182 operation.addParameter(new QName ("", "first"), new QName ("http://www.w3.org/2001/XMLSchema", "string"), String .class, ParameterDesc.IN, false, false); 183 operation.setReturnType(new QName ("urn:rpcParams.wsdl.test", "EchoStruct")); 184 operation.setReturnClass(EchoStruct.class); 185 operation.setReturnQName(new QName ("", "echoReturn")); 186 operation.setStyle(org.apache.axis.constants.Style.RPC); 187 operation.setUse(org.apache.axis.constants.Use.ENCODED); 188 189 org.apache.axis.client.Call _call = createCall(); 190 _call.setOperation(operation); 191 _call.setUseSOAPAction(true); 192 _call.setSOAPActionURI(""); 193 _call.setSOAPVersion(org.apache.axis.soap.SOAPConstants.SOAP11_CONSTANTS); 194 _call.setOperationName(new QName ("urn:rpcParams.wsdl.test", "echo")); 195 196 setRequestHeaders(_call); 197 setAttachments(_call); 198 199 List params = new ArrayList (2); 201 if (second != null) 202 params.add(second); 203 if (first != null) 204 params.add(first); 205 206 Object _resp = _call.invoke(params.toArray()); 207 208 if (_resp instanceof RemoteException ) { 209 throw (RemoteException )_resp; 210 } 211 else { 212 getResponseHeaders(_call); 213 extractAttachments(_call); 214 try { 215 result = (EchoStruct) _resp; 216 } catch (Exception _exception) { 217 result = (EchoStruct) org.apache.axis.utils.JavaUtils.convert(_resp, EchoStruct.class); 218 } 219 } 220 return result; 221 } 222 223 } 224 | Popular Tags |