File: RpcParamsBindingStub.java

package info (click to toggle)
axis 1.4-29
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 52,100 kB
  • sloc: java: 129,124; xml: 10,602; jsp: 983; sh: 84; cs: 36; makefile: 18
file content (223 lines) | stat: -rw-r--r-- 9,082 bytes parent folder | download | duplicates (10)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
/**
 * RpcParamsBindingStub.java
 *
 * This file was auto-generated from WSDL
 * by the Apache Axis WSDL2Java emitter.
 */

package test.wsdl.rpcParams;

import java.util.Enumeration;
import java.util.Vector;
import java.util.List;
import java.util.ArrayList;
import java.rmi.RemoteException;
import javax.xml.namespace.QName;

import org.apache.axis.description.OperationDesc;
import org.apache.axis.description.ParameterDesc;
import org.apache.axis.client.Stub;

public class RpcParamsBindingStub extends Stub implements RpcParamsTest {
    private Vector cachedSerClasses = new Vector();
    private Vector cachedSerQNames = new Vector();
    private Vector cachedSerFactories = new Vector();
    private Vector cachedDeserFactories = new Vector();

    public RpcParamsBindingStub() throws org.apache.axis.AxisFault {
         this(null);
    }

    public RpcParamsBindingStub(java.net.URL endpointURL, javax.xml.rpc.Service service) throws org.apache.axis.AxisFault {
         this(service);
         super.cachedEndpoint = endpointURL;
    }

    public RpcParamsBindingStub(javax.xml.rpc.Service service) throws org.apache.axis.AxisFault {
        if (service == null) {
            super.service = new org.apache.axis.client.Service();
        } else {
            super.service = service;
        }
            Class cls;
            QName qName;
            Class beansf = org.apache.axis.encoding.ser.BeanSerializerFactory.class;
            Class beandf = org.apache.axis.encoding.ser.BeanDeserializerFactory.class;
            qName = new QName("urn:rpcParams.wsdl.test", "EchoStruct");
            cachedSerQNames.add(qName);
            cls = EchoStruct.class;
            cachedSerClasses.add(cls);
            cachedSerFactories.add(beansf);
            cachedDeserFactories.add(beandf);

    }

    private org.apache.axis.client.Call createCall() throws RemoteException {
        try {
            org.apache.axis.client.Call _call =
                    (org.apache.axis.client.Call) super.service.createCall();
            if (super.maintainSessionSet) {
                _call.setMaintainSession(super.maintainSession);
            }
            if (super.cachedUsername != null) {
                _call.setUsername(super.cachedUsername);
            }
            if (super.cachedPassword != null) {
                _call.setPassword(super.cachedPassword);
            }
            if (super.cachedEndpoint != null) {
                _call.setTargetEndpointAddress(super.cachedEndpoint);
            }
            if (super.cachedTimeout != null) {
                _call.setTimeout(super.cachedTimeout);
            }
            if (super.cachedPortName != null) {
                _call.setPortName(super.cachedPortName);
            }
            Enumeration keys = super.cachedProperties.keys();
            while (keys.hasMoreElements()) {
                String key = (String) keys.nextElement();
                _call.setProperty(key, super.cachedProperties.get(key));
            }
            // All the type mapping information is registered
            // when the first call is made.
            // The type mapping information is actually registered in
            // the TypeMappingRegistry of the service, which
            // is the reason why registration is only needed for the first call.
            synchronized (this) {
                if (firstCall()) {
                    // must set encoding style before registering serializers
                    _call.setSOAPVersion(org.apache.axis.soap.SOAPConstants.SOAP11_CONSTANTS);
                    _call.setEncodingStyle(org.apache.axis.Constants.URI_SOAP11_ENC);
                    for (int i = 0; i < cachedSerFactories.size(); ++i) {
                        Class cls = (Class) cachedSerClasses.get(i);
                        QName qName =
                                (QName) cachedSerQNames.get(i);
                        Class sf = (Class)
                                 cachedSerFactories.get(i);
                        Class df = (Class)
                                 cachedDeserFactories.get(i);
                        _call.registerTypeMapping(cls, qName, sf, df, false);
                    }
                }
            }
            return _call;
        }
        catch (Throwable t) {
            throw new org.apache.axis.AxisFault("Failure trying to get the Call object", t);
        }
    }

    /**
     * Send the given request to the server, ommitting any null parameters.
     */
    public EchoStruct echo(String first, String second) throws RemoteException {
        EchoStruct result;
        if (super.cachedEndpoint == null) {
            throw new org.apache.axis.NoEndPointException();
        }

        // create the operation... omit any null parameters
        OperationDesc operation = new OperationDesc();
        operation.setName("echo");
        if (first != null)
            operation.addParameter(new QName("", "first"), new QName("http://www.w3.org/2001/XMLSchema", "string"), String.class, ParameterDesc.IN, false, false);
        if (second != null)
            operation.addParameter(new QName("", "second"), new QName("http://www.w3.org/2001/XMLSchema", "string"), String.class, ParameterDesc.IN, false, false);
        operation.setReturnType(new QName("urn:rpcParams.wsdl.test", "EchoStruct"));
        operation.setReturnClass(EchoStruct.class);
        operation.setReturnQName(new QName("", "echoReturn"));
        operation.setStyle(org.apache.axis.constants.Style.RPC);
        operation.setUse(org.apache.axis.constants.Use.ENCODED);

        org.apache.axis.client.Call _call = createCall();
        _call.setOperation(operation);
        _call.setUseSOAPAction(true);
        _call.setSOAPActionURI("");
        _call.setSOAPVersion(org.apache.axis.soap.SOAPConstants.SOAP11_CONSTANTS);
        _call.setOperationName(new QName("urn:rpcParams.wsdl.test", "echo"));

        setRequestHeaders(_call);
        setAttachments(_call);

        // add the params we're actually going to send, again ommitting nulls
        List params = new ArrayList(2);
        if (first != null)
            params.add(first);
        if (second != null)
            params.add(second);

        Object _resp = _call.invoke(params.toArray());

        if (_resp instanceof RemoteException) {
            throw (RemoteException)_resp;
        }
        else {
            getResponseHeaders(_call);
            extractAttachments(_call);
            try {
                result = (EchoStruct) _resp;
            } catch (Exception _exception) {
                result = (EchoStruct) org.apache.axis.utils.JavaUtils.convert(_resp, EchoStruct.class);
            }
        }
        return result;
    }

    /**
     * The same as echo, but reverse the order of parameters we send.
     */
    public EchoStruct echoReverse(String first, String second) throws RemoteException {
        EchoStruct result;
        if (super.cachedEndpoint == null) {
            throw new org.apache.axis.NoEndPointException();
        }

        // create the operation... omit any null parameters
        OperationDesc operation = new OperationDesc();
        operation.setName("echo");
        if (second != null)
            operation.addParameter(new QName("", "second"), new QName("http://www.w3.org/2001/XMLSchema", "string"), String.class, ParameterDesc.IN, false, false);
        if (first != null)
            operation.addParameter(new QName("", "first"), new QName("http://www.w3.org/2001/XMLSchema", "string"), String.class, ParameterDesc.IN, false, false);
        operation.setReturnType(new QName("urn:rpcParams.wsdl.test", "EchoStruct"));
        operation.setReturnClass(EchoStruct.class);
        operation.setReturnQName(new QName("", "echoReturn"));
        operation.setStyle(org.apache.axis.constants.Style.RPC);
        operation.setUse(org.apache.axis.constants.Use.ENCODED);

        org.apache.axis.client.Call _call = createCall();
        _call.setOperation(operation);
        _call.setUseSOAPAction(true);
        _call.setSOAPActionURI("");
        _call.setSOAPVersion(org.apache.axis.soap.SOAPConstants.SOAP11_CONSTANTS);
        _call.setOperationName(new QName("urn:rpcParams.wsdl.test", "echo"));

        setRequestHeaders(_call);
        setAttachments(_call);

        // add the params we're actually going to send, again ommitting nulls
        List params = new ArrayList(2);
        if (second != null)
            params.add(second);
        if (first != null)
            params.add(first);

        Object _resp = _call.invoke(params.toArray());

        if (_resp instanceof RemoteException) {
            throw (RemoteException)_resp;
        }
        else {
            getResponseHeaders(_call);
            extractAttachments(_call);
            try {
                result = (EchoStruct) _resp;
            } catch (Exception _exception) {
                result = (EchoStruct) org.apache.axis.utils.JavaUtils.convert(_resp, EchoStruct.class);
            }
        }
        return result;
    }

}