1 7 8 package test.wsdl.dataset; 9 10 import org.apache.axis.AxisFault; 11 12 import java.net.ConnectException ; 13 import java.io.IOException ; 14 15 public class DataServiceTestCase extends junit.framework.TestCase { 16 public DataServiceTestCase(java.lang.String name) { 17 super(name); 18 } 19 public void test1DataServiceSoapGetTitleAuthors() throws Exception { 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 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.wsdl.dataset.GetTitleAuthorsResponseGetTitleAuthorsResult value = null; 37 value = binding.getTitleAuthors(); 38 assertTrue(value != null); 39 } catch (java.rmi.RemoteException re) { 41 if (re instanceof AxisFault) { 42 AxisFault fault = (AxisFault) re; 43 if (fault.detail instanceof ConnectException || 44 fault.getFaultCode().getLocalPart().equals("HTTP")) { 45 System.err.println("DataService HTTP error: " + fault); 46 return; 47 } 48 if (fault.detail instanceof IOException ) { 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 |