2
* Copyright 2001-2004 The Apache Software Foundation.
4
* Licensed under the Apache License, Version 2.0 (the "License");
5
* you may not use this file except in compliance with the License.
6
* You may obtain a copy of the License at
8
* http://www.apache.org/licenses/LICENSE-2.0
10
* Unless required by applicable law or agreed to in writing, software
11
* distributed under the License is distributed on an "AS IS" BASIS,
12
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
* See the License for the specific language governing permissions and
14
* limitations under the License.
19
import junit.framework.TestCase;
20
import org.apache.axis.AxisFault;
21
import samples.client.DynamicInvoker;
23
import java.io.InterruptedIOException;
24
import java.net.ConnectException;
26
public class TestDynamicInvoker extends TestCase {
27
public TestDynamicInvoker(String name) {
31
public void test1() throws Exception {
33
String[] args = new String[]{"http://www.xmethods.net/sd/2001/TemperatureService.wsdl", "getTemp", "02067"};
34
DynamicInvoker.main(args);
35
} catch (java.net.ConnectException ce) {
36
System.err.println("getTemp connect error: " + ce);
38
} catch (java.rmi.RemoteException re) {
39
if (re instanceof AxisFault) {
40
AxisFault fault = (AxisFault) re;
41
if (fault.detail instanceof ConnectException ||
42
fault.detail instanceof InterruptedIOException ||
43
(fault.getFaultString().indexOf("Connection timed out") != -1) ||
44
fault.getFaultCode().getLocalPart().equals("HTTP")) {
45
System.err.println("getTemp HTTP error: " + fault);
49
throw new junit.framework.AssertionFailedError("Remote Exception caught: " + re);
50
} catch (java.io.IOException ioe) {
51
System.err.println("getTemp connect error: " + ioe);
56
public void test2() throws Exception {
58
String[] args = new String[]{"http://services.xmethods.net/soap/urn:xmethods-delayed-quotes.wsdl", "getQuote", "IBM"};
59
DynamicInvoker.main(args);
60
} catch (java.net.ConnectException ce) {
61
System.err.println("getQuote connect error: " + ce);
63
} catch (java.rmi.RemoteException re) {
64
if (re instanceof AxisFault) {
65
AxisFault fault = (AxisFault) re;
66
if (fault.detail instanceof ConnectException ||
67
fault.detail instanceof InterruptedIOException ||
68
fault.getFaultCode().getLocalPart().equals("HTTP")) {
69
System.err.println("getQuote HTTP error: " + fault);
73
throw new junit.framework.AssertionFailedError("Remote Exception caught: " + re);
74
} catch (java.io.IOException ioe) {
75
System.err.println("getQuote connect error: " + ioe);
80
public void test3() throws Exception {
82
String[] args = new String[]{"http://mssoapinterop.org/asmx/xsd/round4XSD.wsdl", "echoString(Round4XSDTestSoap)", "Hello World!!!"};
83
DynamicInvoker.main(args);
84
} catch (java.net.ConnectException ce) {
85
System.err.println("round4XSD connect error: " + ce);
87
} catch (java.rmi.RemoteException re) {
88
if (re instanceof AxisFault) {
89
AxisFault fault = (AxisFault) re;
90
if (fault.detail instanceof ConnectException ||
91
fault.detail instanceof InterruptedIOException ||
92
fault.getFaultCode().getLocalPart().equals("HTTP")) {
93
System.err.println("round4XSD HTTP error: " + fault);
97
throw new junit.framework.AssertionFailedError("Remote Exception caught: " + re);
98
} catch (java.io.IOException ioe) {
99
System.err.println("round4XSD connect error: " + ioe);
104
public void test4() throws Exception {
106
String[] args = new String[]{"http://samples.gotdotnet.com/quickstart/aspplus/samples/services/MathService/VB/MathService.asmx?WSDL",
110
DynamicInvoker.main(args);
111
} catch (java.net.ConnectException ce) {
112
System.err.println("MathService connect error: " + ce);
114
} catch (java.rmi.RemoteException re) {
115
if (re instanceof AxisFault) {
116
AxisFault fault = (AxisFault) re;
117
if (fault.detail instanceof ConnectException ||
118
fault.detail instanceof InterruptedIOException ||
119
fault.getFaultCode().getLocalPart().equals("HTTP")) {
120
System.err.println("MathService HTTP error: " + fault);
124
throw new junit.framework.AssertionFailedError("Remote Exception caught: " + re);
125
} catch (java.io.IOException ioe) {
126
System.err.println("MathService connect error: " + ioe);