KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > test > wsdl > dataset > DataServiceTestCase


1 /**
2  * DataServiceTestCase.java
3  *
4  * This file was auto-generated from WSDL
5  * by the Apache Axis WSDL2Java emitter.
6  */

7
8 package test.wsdl.dataset;
9
10 import org.apache.axis.AxisFault;
11
12 import java.net.ConnectException JavaDoc;
13 import java.io.IOException JavaDoc;
14
15 public class DataServiceTestCase extends junit.framework.TestCase {
16     public DataServiceTestCase(java.lang.String JavaDoc name) {
17         super(name);
18     }
19     public void test1DataServiceSoapGetTitleAuthors() throws Exception JavaDoc {
20         test.wsdl.dataset.DataServiceSoapStub binding;
21         try {
22             binding = (test.wsdl.dataset.DataServiceSoapStub)
23                     new test.wsdl.dataset.DataServiceLocator().getDataServiceSoap();
24         }
25         catch (javax.xml.rpc.ServiceException JavaDoc jre) {
26             if(jre.getLinkedCause()!=null)
27                 jre.getLinkedCause().printStackTrace();
28             throw new junit.framework.AssertionFailedError("JAX-RPC ServiceException caught: " + jre);
29         }
30         assertTrue("binding is null", binding != null);
31
32         binding.setTimeout(60000);
33         
34         try {
35             // Test operation
36
test.wsdl.dataset.GetTitleAuthorsResponseGetTitleAuthorsResult value = null;
37             value = binding.getTitleAuthors();
38             assertTrue(value != null);
39             // TBD - validate results
40
} catch (java.rmi.RemoteException JavaDoc re) {
41             if (re instanceof AxisFault) {
42                 AxisFault fault = (AxisFault) re;
43                 if (fault.detail instanceof ConnectException JavaDoc ||
44                     fault.getFaultCode().getLocalPart().equals("HTTP")) {
45                     System.err.println("DataService HTTP error: " + fault);
46                     return;
47                 }
48                 if (fault.detail instanceof IOException JavaDoc) {
49                     System.err.println("DataService IO error: " + fault);
50                     return;
51                 }
52             }
53             throw new junit.framework.AssertionFailedError("Remote Exception caught: " + re);
54         }
55     }
56 }
57
Popular Tags