| 1 |
/** |
| 2 |
* TerraServiceTestCase.java |
| 3 |
* |
| 4 |
* This file was auto-generated from WSDL |
| 5 |
* by the Apache Axis WSDL2Java emitter. |
| 6 |
*/ |
| 7 |
|
| 8 |
package test.wsdl.terra; |
| 9 |
|
| 10 |
import org.apache.axis.AxisFault; |
| 11 |
|
| 12 |
import java.net.ConnectException; |
| 13 |
|
| 14 |
public class TerraServiceTestCase extends junit.framework.TestCase { |
| 15 |
public TerraServiceTestCase(java.lang.String name) { |
| 16 |
super(name); |
| 17 |
} |
| 18 |
|
| 19 |
public void test11TerraServiceSoapGetPlaceList() { |
| 20 |
TerraServiceSoap binding; |
| 21 |
try { |
| 22 |
binding = new TerraServiceLocator().getTerraServiceSoap(); |
| 23 |
} |
| 24 |
catch (javax.xml.rpc.ServiceException jre) { |
| 25 |
throw new junit.framework.AssertionFailedError("JAX-RPC ServiceException caught: " + jre); |
| 26 |
} |
| 27 |
assertTrue("binding is null", binding != null); |
| 28 |
|
| 29 |
try { |
| 30 |
ArrayOfPlaceFacts value = null; |
| 31 |
value = binding.getPlaceList(new java.lang.String("Boston"), 5, true); |
| 32 |
PlaceFacts[] facts = value.getPlaceFacts(); |
| 33 |
for(int i=0;i<facts.length;i++){ |
| 34 |
System.out.println("City :" + facts[i].getPlace().getCity()); |
| 35 |
System.out.println("State :" + facts[i].getPlace().getState()); |
| 36 |
System.out.println("Country :" + facts[i].getPlace().getCountry()); |
| 37 |
System.out.println("Lat :" + facts[i].getCenter().getLon()); |
| 38 |
System.out.println("Long :" + facts[i].getCenter().getLat()); |
| 39 |
System.out.println("Theme :" + facts[i].getAvailableThemeMask()); |
| 40 |
System.out.println("PlaceType :" + facts[i].getPlaceTypeId().getValue()); |
| 41 |
System.out.println("Population:" + facts[i].getPopulation()); |
| 42 |
System.out.println("---------------------------"); |
| 43 |
} |
| 44 |
} |
| 45 |
catch (java.rmi.RemoteException re) { |
| 46 |
if (re instanceof AxisFault) { |
| 47 |
AxisFault fault = (AxisFault) re; |
| 48 |
if (fault.detail instanceof ConnectException || |
| 49 |
fault.getFaultCode().getLocalPart().equals("HTTP")) { |
| 50 |
System.err.println("TerraService HTTP error: " + fault); |
| 51 |
return; |
| 52 |
} |
| 53 |
} |
| 54 |
throw new junit.framework.AssertionFailedError("Remote Exception caught: " + re); |
| 55 |
} |
| 56 |
} |
| 57 |
} |