KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > soapinterop > InteropTestServiceProxy


1 /*
2  * The Apache Software License, Version 1.1
3  *
4  *
5  * Copyright (c) 2002 The Apache Software Foundation. All rights
6  * reserved.
7  *
8  * Redistribution and use in source and binary forms, with or without
9  * modification, are permitted provided that the following conditions
10  * are met:
11  *
12  * 1. Redistributions of source code must retain the above copyright
13  * notice, this list of conditions and the following disclaimer.
14  *
15  * 2. Redistributions in binary form must reproduce the above copyright
16  * notice, this list of conditions and the following disclaimer in
17  * the documentation and/or other materials provided with the
18  * distribution.
19  *
20  * 3. The end-user documentation included with the redistribution,
21  * if any, must include the following acknowledgment:
22  * "This product includes software developed by the
23  * Apache Software Foundation (http://www.apache.org/)."
24  * Alternately, this acknowledgment may appear in the software itself,
25  * if and wherever such third-party acknowledgments normally appear.
26  *
27  * 4. The names "WSIF" and "Apache Software Foundation" must
28  * not be used to endorse or promote products derived from this
29  * software without prior written permission. For written
30  * permission, please contact apache@apache.org.
31  *
32  * 5. Products derived from this software may not be called "Apache",
33  * nor may "Apache" appear in their name, without prior written
34  * permission of the Apache Software Foundation.
35  *
36  * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
37  * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
38  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
39  * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
40  * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
41  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
42  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
43  * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
44  * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
45  * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
46  * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
47  * SUCH DAMAGE.
48  * ====================================================================
49  *
50  * This software consists of voluntary contributions made by many
51  * individuals on behalf of the Apache Software Foundation and was
52  * originally based on software copyright (c) 2001, 2002, International
53  * Business Machines, Inc., http://www.apache.org. For more
54  * information on the Apache Software Foundation, please see
55  * <http://www.apache.org/>.
56  */

57
58 package soapinterop;
59
60 import javax.xml.namespace.QName JavaDoc;
61
62 import org.apache.wsif.WSIFException;
63 import org.apache.wsif.WSIFMessage;
64 import org.apache.wsif.WSIFOperation;
65 import org.apache.wsif.WSIFPort;
66 import org.apache.wsif.WSIFService;
67 import org.apache.wsif.WSIFServiceFactory;
68 import org.apache.wsif.providers.soap.apachesoap.WSIFDynamicProvider_ApacheSOAP;
69 import org.apache.wsif.util.WSIFPluggableProviders;
70 import util.TestUtilities;
71
72 /**
73  * InteropTestServiceProxy
74  */

75 public class InteropTestServiceProxy {
76     private WSIFServiceFactory factory;
77     private WSIFService svc;
78         String JavaDoc wsdlLocation = //"com/ibm/wsif/test/soapinterop/ApacheAxis.wsdl";
79
TestUtilities.getWsdlPath("java\\test\\soapinterop") + "ApacheAxis.wsdl";
80
81     /**
82      * getPortFactory
83      * @generated
84      */

85     /* public WSIFDynamicPortFactory getPortFactory() {
86             return fieldPortFactory;
87         }*/

88     /**
89      * setPortFactory
90      * @generated
91      */

92     /* public void setPortFactory(WSIFDynamicPortFactory newPortFactory) {
93             fieldPortFactory= newPortFactory;
94         }*/

95
96     /**
97      * echoString
98      * @generated
99      */

100     public java.lang.String JavaDoc echoString(java.lang.String JavaDoc argInputString)
101         throws WSIFException {
102
103         WSIFPort port = this.svc.getPort();
104
105         WSIFOperation operation = port.createOperation("echoString", null, null);
106
107         WSIFMessage inputMessage = operation.createInputMessage();
108
109         WSIFMessage outputMessage = operation.createOutputMessage();
110
111         inputMessage.setObjectPart("inputString", argInputString);
112
113         operation.executeRequestResponseOperation(inputMessage, outputMessage, null);
114
115         port.close();
116
117         return (java.lang.String JavaDoc) outputMessage.getObjectPart("return");
118
119     }
120
121     /**
122      * echoStringArray
123      * @generated
124      */

125     public java.lang.String JavaDoc[] echoStringArray(
126         java.lang.String JavaDoc[] argInputStringArray)
127         throws WSIFException {
128
129         WSIFPort port = this.svc.getPort();
130
131         WSIFOperation operation =
132             port.createOperation(
133                 "echoStringArray",
134                 "echoStringArrayRequest",
135                 "echoStringArrayResponse");
136
137         WSIFMessage inputMessage = operation.createInputMessage();
138         inputMessage.setName("echoStringArrayRequest");
139
140         WSIFMessage outputMessage = operation.createOutputMessage();
141         outputMessage.setName("echoStringArrayResponse");
142
143         inputMessage.setObjectPart("inputStringArray", argInputStringArray);
144
145         operation.executeRequestResponseOperation(inputMessage, outputMessage, null);
146
147         port.close();
148
149         return (java.lang.String JavaDoc[]) outputMessage.getObjectPart("return");
150
151     }
152
153     /**
154      * echoInteger
155      * @generated
156      */

157     public int echoInteger(int argInputInteger) throws WSIFException {
158
159         WSIFPort port = this.svc.getPort();
160
161         WSIFOperation operation =
162             port.createOperation(
163                 "echoInteger",
164                 "echoIntegerRequest",
165                 "echoIntegerResponse");
166
167         WSIFMessage inputMessage = operation.createInputMessage();
168         inputMessage.setName("echoIntegerRequest");
169
170         WSIFMessage outputMessage = operation.createOutputMessage();
171         outputMessage.setName("echoIntegerResponse");
172
173         inputMessage.setObjectPart(
174             "inputInteger",
175             new java.lang.Integer JavaDoc(argInputInteger));
176
177         operation.executeRequestResponseOperation(inputMessage, outputMessage, null);
178
179         port.close();
180
181         return ((java.lang.Integer JavaDoc) outputMessage.getObjectPart("return")).intValue();
182
183     }
184
185     /**
186      * echoIntegerArray
187      * @generated
188      */

189     public int[] echoIntegerArray(int[] argInputIntegerArray)
190         throws WSIFException {
191
192         WSIFPort port = this.svc.getPort();
193
194         WSIFOperation operation =
195             port.createOperation(
196                 "echoIntegerArray",
197                 "echoIntegerArrayRequest",
198                 "echoIntegerArrayResponse");
199
200         WSIFMessage inputMessage = operation.createInputMessage();
201         inputMessage.setName("echoIntegerArrayRequest");
202
203         WSIFMessage outputMessage = operation.createOutputMessage();
204         outputMessage.setName("echoIntegerArrayResponse");
205
206         inputMessage.setObjectPart("inputIntegerArray", argInputIntegerArray);
207
208         operation.executeRequestResponseOperation(inputMessage, outputMessage, null);
209
210         port.close();
211
212         return (int[]) outputMessage.getObjectPart("return");
213
214     }
215
216     /**
217      * echoFloat
218      * @generated
219      */

220     public float echoFloat(float argInputFloat) throws WSIFException {
221
222         WSIFPort port = this.svc.getPort();
223
224         WSIFOperation operation =
225             port.createOperation("echoFloat", "echoFloatRequest", "echoFloatResponse");
226
227         WSIFMessage inputMessage = operation.createInputMessage();
228         inputMessage.setName("echoFloatRequest");
229
230         WSIFMessage outputMessage = operation.createOutputMessage();
231         outputMessage.setName("echoFloatResponse");
232
233         inputMessage.setObjectPart("inputFloat", new java.lang.Float JavaDoc(argInputFloat));
234
235         operation.executeRequestResponseOperation(inputMessage, outputMessage, null);
236
237         port.close();
238
239         return ((java.lang.Float JavaDoc) outputMessage.getObjectPart("return")).floatValue();
240
241     }
242
243     /**
244      * echoFloatArray
245      * @generated
246      */

247     public float[] echoFloatArray(float[] argInputFloatArray)
248         throws WSIFException {
249
250         WSIFPort port = this.svc.getPort();
251
252         WSIFOperation operation =
253             port.createOperation(
254                 "echoFloatArray",
255                 "echoFloatArrayRequest",
256                 "echoFloatArrayResponse");
257
258         WSIFMessage inputMessage = operation.createInputMessage();
259         inputMessage.setName("echoFloatArrayRequest");
260
261         WSIFMessage outputMessage = operation.createOutputMessage();
262         outputMessage.setName("echoFloatArrayResponse");
263
264         inputMessage.setObjectPart("inputFloatArray", argInputFloatArray);
265
266         operation.executeRequestResponseOperation(inputMessage, outputMessage, null);
267
268         port.close();
269
270         return (float[]) outputMessage.getObjectPart("return");
271
272     }
273
274     /**
275      * echoStruct
276      * @generated
277      */

278     /* public org.soapinterop.xsd.SOAPStruct echoStruct(
279             org.soapinterop.xsd.SOAPStruct argInputStruct)
280             throws WSIFException {
281     
282             WSIFPort port = this.svc.getPort();
283     
284             WSIFOperation operation =
285                 port.createOperation("echoStruct", "echoStructRequest", "echoStructResponse");
286     
287             WSIFMessage inputMessage = operation.createInputMessage();
288             inputMessage.setName("echoStructRequest");
289     
290             WSIFMessage outputMessage = operation.createOutputMessage();
291             outputMessage.setName("echoStructResponse");
292     
293             inputMessage.setObjectPart("inputStruct", argInputStruct);
294     
295             operation.executeRequestResponseOperation(inputMessage, outputMessage, null);
296     
297             port.close();
298     
299             return (org.soapinterop.xsd.SOAPStruct) outputMessage.getObjectPart("return");
300     
301         }*/

302
303     /**
304      * echoStructArray
305      * @generated
306      */

307     /* public org.soapinterop.xsd.SOAPStruct[] echoStructArray(
308             org.soapinterop.xsd.SOAPStruct[] argInputStructArray)
309             throws WSIFException {
310     
311             WSIFPort port = this.svc.getPort();
312     
313             WSIFOperation operation =
314                 port.createOperation(
315                     "echoStructArray",
316                     "echoStructArrayRequest",
317                     "echoStructArrayResponse");
318     
319             WSIFMessage inputMessage = operation.createInputMessage();
320             inputMessage.setName("echoStructArrayRequest");
321     
322             WSIFMessage outputMessage = operation.createOutputMessage();
323             outputMessage.setName("echoStructArrayResponse");
324     
325             inputMessage.setObjectPart("inputStructArray", argInputStructArray);
326     
327             operation.executeRequestResponseOperation(inputMessage, outputMessage, null);
328     
329             port.close();
330     
331             return (org.soapinterop.xsd.SOAPStruct[]) outputMessage.getObjectPart("return");
332     
333         }*/

334
335     /**
336      * echoVoid
337      * @generated
338      */

339     public void echoVoid() throws WSIFException {
340
341         WSIFPort port = this.svc.getPort();
342
343         WSIFOperation operation =
344             port.createOperation("echoVoid", "echoVoidRequest", "echoVoidResponse");
345
346         WSIFMessage inputMessage = operation.createInputMessage();
347         inputMessage.setName("echoVoidRequest");
348
349         WSIFMessage outputMessage = operation.createOutputMessage();
350         outputMessage.setName("echoVoidResponse");
351
352         operation.executeRequestResponseOperation(inputMessage, outputMessage, null);
353
354         port.close();
355
356     }
357
358     /**
359      * echoBase64
360      * @generated
361      */

362     public byte[] echoBase64(byte[] argInputBase64) throws WSIFException {
363
364         WSIFPort port = this.svc.getPort();
365
366         WSIFOperation operation =
367             port.createOperation("echoBase64", "echoBase64Request", "echoBase64Response");
368
369         WSIFMessage inputMessage = operation.createInputMessage();
370         inputMessage.setName("echoBase64Request");
371
372         WSIFMessage outputMessage = operation.createOutputMessage();
373         outputMessage.setName("echoBase64Response");
374
375         inputMessage.setObjectPart("inputBase64", argInputBase64);
376
377         operation.executeRequestResponseOperation(inputMessage, outputMessage, null);
378
379         port.close();
380
381         return (byte[]) outputMessage.getObjectPart("return");
382
383     }
384
385     /**
386      * echoDate
387      * @generated
388      */

389     public java.util.Date JavaDoc echoDate(java.util.Date JavaDoc argInputDate)
390         throws WSIFException {
391
392         WSIFPort port = this.svc.getPort();
393
394         WSIFOperation operation =
395             port.createOperation("echoDate", "echoDateRequest", "echoDateResponse");
396
397         WSIFMessage inputMessage = operation.createInputMessage();
398         inputMessage.setName("echoDateRequest");
399
400         WSIFMessage outputMessage = operation.createOutputMessage();
401         outputMessage.setName("echoDateResponse");
402
403         inputMessage.setObjectPart("inputDate", argInputDate);
404
405         operation.executeRequestResponseOperation(inputMessage, outputMessage, null);
406
407         port.close();
408
409         return (java.util.Date JavaDoc) outputMessage.getObjectPart("return");
410
411     }
412
413     /**
414      * echoHexBinary
415      * @generated
416      */

417     public byte[] echoHexBinary(byte[] argInputHexBinary) throws WSIFException {
418
419         WSIFPort port = this.svc.getPort();
420
421         WSIFOperation operation =
422             port.createOperation(
423                 "echoHexBinary",
424                 "echoHexBinaryRequest",
425                 "echoHexBinaryResponse");
426
427         WSIFMessage inputMessage = operation.createInputMessage();
428         inputMessage.setName("echoHexBinaryRequest");
429
430         WSIFMessage outputMessage = operation.createOutputMessage();
431         outputMessage.setName("echoHexBinaryResponse");
432
433         inputMessage.setObjectPart("inputHexBinary", argInputHexBinary);
434
435         operation.executeRequestResponseOperation(inputMessage, outputMessage, null);
436
437         port.close();
438
439         return (byte[]) outputMessage.getObjectPart("return");
440
441     }
442
443     /**
444      * echoDecimal
445      * @generated
446      */

447     public java.math.BigDecimal JavaDoc echoDecimal(java.math.BigDecimal JavaDoc argInputDecimal)
448         throws WSIFException {
449
450         WSIFPort port = this.svc.getPort();
451
452         WSIFOperation operation =
453             port.createOperation(
454                 "echoDecimal",
455                 "echoDecimalRequest",
456                 "echoDecimalResponse");
457
458         WSIFMessage inputMessage = operation.createInputMessage();
459         inputMessage.setName("echoDecimalRequest");
460
461         WSIFMessage outputMessage = operation.createOutputMessage();
462         outputMessage.setName("echoDecimalResponse");
463
464         inputMessage.setObjectPart("inputDecimal", argInputDecimal);
465
466         operation.executeRequestResponseOperation(inputMessage, outputMessage, null);
467
468         port.close();
469
470         return (java.math.BigDecimal JavaDoc) outputMessage.getObjectPart("return");
471
472     }
473
474     /**
475      * echoBoolean
476      * @generated
477      */

478     public boolean echoBoolean(boolean argInputBoolean) throws WSIFException {
479
480         WSIFPort port = this.svc.getPort();
481
482         WSIFOperation operation =
483             port.createOperation(
484                 "echoBoolean",
485                 "echoBooleanRequest",
486                 "echoBooleanResponse");
487
488         WSIFMessage inputMessage = operation.createInputMessage();
489         inputMessage.setName("echoBooleanRequest");
490
491         WSIFMessage outputMessage = operation.createOutputMessage();
492         outputMessage.setName("echoBooleanResponse");
493
494         inputMessage.setObjectPart(
495             "inputBoolean",
496             new java.lang.Boolean JavaDoc(argInputBoolean));
497
498         operation.executeRequestResponseOperation(inputMessage, outputMessage, null);
499
500         port.close();
501
502         return ((java.lang.Boolean JavaDoc) outputMessage.getObjectPart("return"))
503             .booleanValue();
504
505     }
506
507     /**
508      * Constructor
509      * @generated
510      */

511     public InteropTestServiceProxy() throws WSIFException {
512
513         this.factory = WSIFServiceFactory.newInstance();
514
515         WSIFPluggableProviders.overrideDefaultProvider(
516             "http://schemas.xmlsoap.org/wsdl/soap/",
517             new WSIFDynamicProvider_ApacheSOAP());
518
519         this.svc = factory.getService(wsdlLocation,
520             //this.getClass().getClassLoader(),
521
"http://soapinterop.org/",
522             "interopLab",
523             "http://soapinterop.org/",
524             "InteropTestPortType");
525
526         if (this.svc == null)
527             throw new WSIFException("Failed to create WSIFDynamicPortFactory");
528         //this.svc.mapType(
529
// new QName("http://soapinterop.org/xsd", "SOAPStruct"),
530
// SOAPStruct.class);
531
this.svc.mapType(
532             new QName JavaDoc("http://soapinterop.org/xsd", "ArrayOfstring"),
533             java.lang.String JavaDoc[].class);
534         this.svc.mapType(
535             new QName JavaDoc("http://soapinterop.org/xsd", "ArrayOfint"),
536             int[].class);
537         //this.svc.mapType(
538
// new QName("http://soapinterop.org/xsd", "ArrayOfSOAPStruct"),
539
// SOAPStruct[].class);
540
this.svc.mapType(
541             new QName JavaDoc("http://soapinterop.org/xsd", "ArrayOffloat"),
542             float[].class);
543
544     }
545
546 }
547
Popular Tags