Java Demographics Examples

From CDYNE Wiki
Jump to navigation Jump to search

GetIncomeHouseValueByAddress

 1 import java.io.ByteArrayOutputStream;
 2 import java.io.InputStream;
 3 import java.net.MalformedURLException;
 4 import java.net.URL; 
 5 import java.util.Properties;
 6 import javax.xml.transform.OutputKeys;
 7 import javax.xml.transform.Source;
 8 import javax.xml.transform.Transformer;
 9 import javax.xml.transform.TransformerFactory;
10 import javax.xml.transform.stream.StreamResult;
11 import javax.xml.transform.stream.StreamSource;
12 
13 public class GetIncomeHouseValueByAddress {
14 
15     public static void main(String[] args) {
16        
17                try{		
18             URL url = new URL("http://ws.cdyne.com/DemographixWS/DemographixQuery.asmx/GetIncomeHouseValueByAddress?"
19                                + "AddressLine1=505+Independence+Parkway"
20                                + "&City=Chesapeake"
21                                + "&StateAbbrev=VA"
22                                + "&ZipCode=23320"
23                                + "&LicenseKey=YOUR LICENSE KEY");		
24     try{			
25     InputStream in = url.openStream(); 
26     StreamSource source = new StreamSource(in); 			
27     printResult(source);	
28 }catch(java.io.IOException e){			
29     e.printStackTrace();		
30 }		
31 }catch (MalformedURLException e){		
32     e.printStackTrace();	
33             }     
34     }     
35     private static void printResult(Source source) {        
36             try {            
37             ByteArrayOutputStream bos = new ByteArrayOutputStream();
38             StreamResult sr = new StreamResult(bos);
39             Transformer trans = TransformerFactory.newInstance().newTransformer();
40             Properties oprops = new Properties();
41             oprops.put(OutputKeys.OMIT_XML_DECLARATION, "yes");
42             trans.setOutputProperties(oprops);
43             trans.transform(source, sr);            
44             System.out.println("**** Response ******");            
45             System.out.println(bos.toString());   
46 
47             bos.close();
48             System.out.println();        
49     } catch (Exception e) {            
50             } 
51     }
52 }

GetLocationInformationByAddress

 1 import java.io.ByteArrayOutputStream;
 2 import java.io.InputStream;
 3 import java.net.MalformedURLException;
 4 import java.net.URL; 
 5 import java.util.Properties;
 6 import javax.xml.transform.OutputKeys;
 7 import javax.xml.transform.Source;
 8 import javax.xml.transform.Transformer;
 9 import javax.xml.transform.TransformerFactory;
10 import javax.xml.transform.stream.StreamResult;
11 import javax.xml.transform.stream.StreamSource;
12 
13 public class GetLocationInformationByAddress {
14 
15     public static void main(String[] args) {
16        
17                try{		
18             URL url = new URL("http://ws.cdyne.com/DemographixWS/DemographixQuery.asmx/GetPlaceIDbyAddress?"
19                                + "AddressLine1=505+Independece+Parkway"
20                                + "&City=Chesapeake"
21                                + "&StateAbbrev=VA"
22                                + "&ZipCode=23320"
23                                + "&LicenseKey=YOUR LICENSE KEY");		
24     try{			
25     InputStream in = url.openStream(); 
26     StreamSource source = new StreamSource(in); 			
27     printResult(source);	
28 }catch(java.io.IOException e){			
29     e.printStackTrace();		
30 }		
31 }catch (MalformedURLException e){		
32     e.printStackTrace();	
33             }     
34     }     
35     private static void printResult(Source source) {        
36             try {            
37             ByteArrayOutputStream bos = new ByteArrayOutputStream();
38             StreamResult sr = new StreamResult(bos);
39             Transformer trans = TransformerFactory.newInstance().newTransformer();
40             Properties oprops = new Properties();
41             oprops.put(OutputKeys.OMIT_XML_DECLARATION, "yes");
42             trans.setOutputProperties(oprops);
43             trans.transform(source, sr);            
44             System.out.println("**** Response ******");            
45             System.out.println(bos.toString());   
46 
47             bos.close();
48             System.out.println();        
49     } catch (Exception e) {            
50             } 
51     }
52 }

GetLocationInformationByLatitudeLongitude

 1 import java.io.ByteArrayOutputStream;
 2 import java.io.InputStream;
 3 import java.net.MalformedURLException;
 4 import java.net.URL; 
 5 import java.util.Properties;
 6 import javax.xml.transform.OutputKeys;
 7 import javax.xml.transform.Source;
 8 import javax.xml.transform.Transformer;
 9 import javax.xml.transform.TransformerFactory;
10 import javax.xml.transform.stream.StreamResult;
11 import javax.xml.transform.stream.StreamSource;
12 
13 public class GetLocationInformationByLatitudeLongitude {
14 
15     public static void main(String[] args) {
16        
17                try{		
18             URL url = new URL("http://ws.cdyne.com/DemographixWS/DemographixQuery.asmx/GetLocationInformationByLatitudeLongitude?"
19                                + "Latitude=36.761560"
20                                + "&Longitude=-76.259964"
21                                + "&LicenseKey=YOUR LICENSE KEY");		
22     try{			
23     InputStream in = url.openStream(); 
24     StreamSource source = new StreamSource(in); 			
25     printResult(source);	
26 }catch(java.io.IOException e){			
27     e.printStackTrace();		
28 }		
29 }catch (MalformedURLException e){		
30     e.printStackTrace();	
31             }     
32     }     
33     private static void printResult(Source source) {        
34             try {            
35             ByteArrayOutputStream bos = new ByteArrayOutputStream();
36             StreamResult sr = new StreamResult(bos);
37             Transformer trans = TransformerFactory.newInstance().newTransformer();
38             Properties oprops = new Properties();
39             oprops.put(OutputKeys.OMIT_XML_DECLARATION, "yes");
40             trans.setOutputProperties(oprops);
41             trans.transform(source, sr);            
42             System.out.println("**** Response ******");            
43             System.out.println(bos.toString());   
44 
45             bos.close();
46             System.out.println();        
47     } catch (Exception e) {            
48             } 
49     }
50 }

GetNeighborhoodAgeGenderFemaleInDataSet

 1 import java.net.URL; 
 2 import java.util.Properties;
 3 import javax.xml.transform.OutputKeys;
 4 import javax.xml.transform.Source;
 5 import javax.xml.transform.Transformer;
 6 import javax.xml.transform.TransformerFactory;
 7 import javax.xml.transform.stream.StreamResult;
 8 import javax.xml.transform.stream.StreamSource;
 9 
10 public class GetNeighborhoodAgeGenderFemaleInDataSet {
11 
12     public static void main(String[] args) {
13        
14                try{		
15             URL url = new URL("http://ws.cdyne.com/DemographixWS/DemographixQuery.asmx/GetNeighborhoodAgeGenderFemaleInDataSet?"
16                                + "StateAbbrev=VA"
17                                + "&PlaceID=0018466");		
18     try{			
19     InputStream in = url.openStream(); 
20     StreamSource source = new StreamSource(in); 			
21     printResult(source);	
22 }catch(java.io.IOException e){			
23     e.printStackTrace();		
24 }		
25 }catch (MalformedURLException e){		
26     e.printStackTrace();	
27             }     
28     }     
29     private static void printResult(Source source) {        
30             try {            
31             ByteArrayOutputStream bos = new ByteArrayOutputStream();
32             StreamResult sr = new StreamResult(bos);
33             Transformer trans = TransformerFactory.newInstance().newTransformer();
34             Properties oprops = new Properties();
35             oprops.put(OutputKeys.OMIT_XML_DECLARATION, "yes");
36             trans.setOutputProperties(oprops);
37             trans.transform(source, sr);            
38             System.out.println("**** Response ******");            
39             System.out.println(bos.toString());   
40 
41             bos.close();
42             System.out.println();        
43     } catch (Exception e) {            
44             }  
45     }
46 }

GetNeighborhoodAgeGenderMaleInDataSet

 1 import java.io.ByteArrayOutputStream;
 2 import java.io.InputStream;
 3 import java.net.MalformedURLException;
 4 import java.net.URL; 
 5 import java.util.Properties;
 6 import javax.xml.transform.OutputKeys;
 7 import javax.xml.transform.Source;
 8 import javax.xml.transform.Transformer;
 9 import javax.xml.transform.TransformerFactory;
10 import javax.xml.transform.stream.StreamResult;
11 import javax.xml.transform.stream.StreamSource;
12 
13 public class GetNeighborhoodAgeGenderMaleInDataSet {
14 
15     public static void main(String[] args) {
16        
17                try{		
18             URL url = new URL("http://ws.cdyne.com/DemographixWS/DemographixQuery.asmx/GetNeighborhoodAgeGenderMaleInDataSet?"
19                                + "StateAbbrev=VA"
20                                + "&PlaceID=0018466");		
21     try{			
22     InputStream in = url.openStream(); 
23     StreamSource source = new StreamSource(in); 			
24     printResult(source);	
25 }catch(java.io.IOException e){			
26     e.printStackTrace();		
27 }		
28 }catch (MalformedURLException e){		
29     e.printStackTrace();	
30             }     
31     }     
32     private static void printResult(Source source) {        
33             try {            
34             ByteArrayOutputStream bos = new ByteArrayOutputStream();
35             StreamResult sr = new StreamResult(bos);
36             Transformer trans = TransformerFactory.newInstance().newTransformer();
37             Properties oprops = new Properties();
38             oprops.put(OutputKeys.OMIT_XML_DECLARATION, "yes");
39             trans.setOutputProperties(oprops);
40             trans.transform(source, sr);            
41             System.out.println("**** Response ******");            
42             System.out.println(bos.toString());   
43 
44             bos.close();
45             System.out.println();        
46     } catch (Exception e) {            
47             }    
48     }
49 }

GetNeighborhoodAgeInDataSet

 1 import java.io.ByteArrayOutputStream;
 2 import java.io.InputStream;
 3 import java.net.MalformedURLException;
 4 import java.net.URL; 
 5 import java.util.Properties;
 6 import javax.xml.transform.OutputKeys;
 7 import javax.xml.transform.Source;
 8 import javax.xml.transform.Transformer;
 9 import javax.xml.transform.TransformerFactory;
10 import javax.xml.transform.stream.StreamResult;
11 import javax.xml.transform.stream.StreamSource;
12 
13 public class GetNeighborhoodAgeInDataSet {
14 
15     public static void main(String[] args) {
16        
17                try{		
18             URL url = new URL("http://ws.cdyne.com/DemographixWS/DemographixQuery.asmx/GetNeighborhoodAgeInDataSet?"
19                                + "StateAbbrev=VA"
20                                + "&PlaceID=0018466");		
21     try{			
22     InputStream in = url.openStream(); 
23     StreamSource source = new StreamSource(in); 			
24     printResult(source);	
25 }catch(java.io.IOException e){			
26     e.printStackTrace();		
27 }		
28 }catch (MalformedURLException e){		
29     e.printStackTrace();	
30             }     
31     }     
32     private static void printResult(Source source) {        
33             try {            
34             ByteArrayOutputStream bos = new ByteArrayOutputStream();
35             StreamResult sr = new StreamResult(bos);
36             Transformer trans = TransformerFactory.newInstance().newTransformer();
37             Properties oprops = new Properties();
38             oprops.put(OutputKeys.OMIT_XML_DECLARATION, "yes");
39             trans.setOutputProperties(oprops);
40             trans.transform(source, sr);            
41             System.out.println("**** Response ******");            
42             System.out.println(bos.toString());   
43 
44             bos.close();
45             System.out.println();        
46     } catch (Exception e) {            
47             }    
48     }
49 }

GetNeighborhoodLinguisticIsolation

 1 import java.io.ByteArrayOutputStream;
 2 import java.io.InputStream;
 3 import java.net.MalformedURLException;
 4 import java.net.URL; 
 5 import java.util.Properties;
 6 import javax.xml.transform.OutputKeys;
 7 import javax.xml.transform.Source;
 8 import javax.xml.transform.Transformer;
 9 import javax.xml.transform.TransformerFactory;
10 import javax.xml.transform.stream.StreamResult;
11 import javax.xml.transform.stream.StreamSource;
12 
13 public class GetNeighborhoodLinguisticIsolation {
14 
15     public static void main(String[] args) {
16        
17                try{		
18             URL url = new URL("http://ws.cdyne.com/DemographixWS/DemographixQuery.asmx/GetNeighborhoodLinguisticIsolation?"
19                                + "StateAbbr=VA"
20                                + "&PlaceID=0018466");		
21     try{			
22     InputStream in = url.openStream(); 
23     StreamSource source = new StreamSource(in); 			
24     printResult(source);	
25 }catch(java.io.IOException e){			
26     e.printStackTrace();		
27 }		
28 }catch (MalformedURLException e){		
29     e.printStackTrace();	
30             }     
31     }     
32     private static void printResult(Source source) {        
33             try {            
34             ByteArrayOutputStream bos = new ByteArrayOutputStream();
35             StreamResult sr = new StreamResult(bos);
36             Transformer trans = TransformerFactory.newInstance().newTransformer();
37             Properties oprops = new Properties();
38             oprops.put(OutputKeys.OMIT_XML_DECLARATION, "yes");
39             trans.setOutputProperties(oprops);
40             trans.transform(source, sr);            
41             System.out.println("**** Response ******");            
42             System.out.println(bos.toString());   
43 
44             bos.close();
45             System.out.println();        
46     } catch (Exception e) {            
47             }   
48     }
49 }

GetNeighborhoodPlaceofBirthbyCitizenshipStatusInDataset

 1 import java.io.ByteArrayOutputStream;
 2 import java.io.InputStream;
 3 import java.net.MalformedURLException;
 4 import java.net.URL; 
 5 import java.util.Properties;
 6 import javax.xml.transform.OutputKeys;
 7 import javax.xml.transform.Source;
 8 import javax.xml.transform.Transformer;
 9 import javax.xml.transform.TransformerFactory;
10 import javax.xml.transform.stream.StreamResult;
11 import javax.xml.transform.stream.StreamSource;
12 
13 public class GetNeighborhoodPlaceofBirthbyCitizenshipStatusInDataset {
14 
15     public static void main(String[] args) {
16        
17                try{		
18             URL url = new URL("http://ws.cdyne.com/DemographixWS/DemographixQuery.asmx/GetNeighborhoodPlaceofBirthbyCitizenshipStatusInDataset?"
19                                + "StateAbbr=VA"
20                                + "&PlaceID=0018466");		
21     try{			
22     InputStream in = url.openStream(); 
23     StreamSource source = new StreamSource(in); 			
24     printResult(source);	
25 }catch(java.io.IOException e){			
26     e.printStackTrace();		
27 }		
28 }catch (MalformedURLException e){		
29     e.printStackTrace();	
30             }     
31     }     
32     private static void printResult(Source source) {        
33             try {            
34             ByteArrayOutputStream bos = new ByteArrayOutputStream();
35             StreamResult sr = new StreamResult(bos);
36             Transformer trans = TransformerFactory.newInstance().newTransformer();
37             Properties oprops = new Properties();
38             oprops.put(OutputKeys.OMIT_XML_DECLARATION, "yes");
39             trans.setOutputProperties(oprops);
40             trans.transform(source, sr);            
41             System.out.println("**** Response ******");            
42             System.out.println(bos.toString());   
43 
44             bos.close();
45             System.out.println();        
46     } catch (Exception e) {            
47             } 
48     }
49 }

GetNeighborhoodRealtyValueInDataSet

 1 import java.io.ByteArrayOutputStream;
 2 import java.io.InputStream;
 3 import java.net.MalformedURLException;
 4 import java.net.URL; 
 5 import java.util.Properties;
 6 import javax.xml.transform.OutputKeys;
 7 import javax.xml.transform.Source;
 8 import javax.xml.transform.Transformer;
 9 import javax.xml.transform.TransformerFactory;
10 import javax.xml.transform.stream.StreamResult;
11 import javax.xml.transform.stream.StreamSource;
12 
13 public class GetNeighborhoodRealtyValueInDataSet {
14 
15     public static void main(String[] args) {
16        
17                try{		
18             URL url = new URL("http://ws.cdyne.com/DemographixWS/DemographixQuery.asmx/GetNeighborhoodRealtyValueInDataSet?"
19                                + "StateAbbrev=VA"
20                                + "&PlaceID=0018466");		
21     try{			
22     InputStream in = url.openStream(); 
23     StreamSource source = new StreamSource(in); 			
24     printResult(source);	
25 }catch(java.io.IOException e){			
26     e.printStackTrace();		
27 }		
28 }catch (MalformedURLException e){		
29     e.printStackTrace();	
30             }     
31     }     
32     private static void printResult(Source source) {        
33             try {            
34             ByteArrayOutputStream bos = new ByteArrayOutputStream();
35             StreamResult sr = new StreamResult(bos);
36             Transformer trans = TransformerFactory.newInstance().newTransformer();
37             Properties oprops = new Properties();
38             oprops.put(OutputKeys.OMIT_XML_DECLARATION, "yes");
39             trans.setOutputProperties(oprops);
40             trans.transform(source, sr);            
41             System.out.println("**** Response ******");            
42             System.out.println(bos.toString());   
43 
44             bos.close();
45             System.out.println();        
46     } catch (Exception e) {            
47             } 
48     }
49 }

GetNeighborhoodVehiclesPerHouseholdInDataset

 1 import java.io.ByteArrayOutputStream;
 2 import java.io.InputStream;
 3 import java.net.MalformedURLException;
 4 import java.net.URL; 
 5 import java.util.Properties;
 6 import javax.xml.transform.OutputKeys;
 7 import javax.xml.transform.Source;
 8 import javax.xml.transform.Transformer;
 9 import javax.xml.transform.TransformerFactory;
10 import javax.xml.transform.stream.StreamResult;
11 import javax.xml.transform.stream.StreamSource;
12 
13 public class GetNeighborhoodVehiclesPerHouseholdInDataset {
14 
15     public static void main(String[] args) {
16        
17                try{		
18             URL url = new URL("http://ws.cdyne.com/DemographixWS/DemographixQuery.asmx/GetNeighborhoodVehiclesPerHouseholdInDataset?"
19                                + "StateAbbr=VA"
20                                + "&PlaceID=0018466");		
21     try{			
22     InputStream in = url.openStream(); 
23     StreamSource source = new StreamSource(in); 			
24     printResult(source);	
25 }catch(java.io.IOException e){			
26     e.printStackTrace();		
27 }		
28 }catch (MalformedURLException e){		
29     e.printStackTrace();	
30             }     
31     }     
32     private static void printResult(Source source) {        
33             try {            
34             ByteArrayOutputStream bos = new ByteArrayOutputStream();
35             StreamResult sr = new StreamResult(bos);
36             Transformer trans = TransformerFactory.newInstance().newTransformer();
37             Properties oprops = new Properties();
38             oprops.put(OutputKeys.OMIT_XML_DECLARATION, "yes");
39             trans.setOutputProperties(oprops);
40             trans.transform(source, sr);            
41             System.out.println("**** Response ******");            
42             System.out.println(bos.toString());   
43 
44             bos.close();
45             System.out.println();        
46     } catch (Exception e) {            
47             } 
48     }
49 }

GetNeighborhoodYearStructuresBuilt

 1 import java.io.ByteArrayOutputStream;
 2 import java.io.InputStream;
 3 import java.net.MalformedURLException;
 4 import java.net.URL; 
 5 import java.util.Properties;
 6 import javax.xml.transform.OutputKeys;
 7 import javax.xml.transform.Source;
 8 import javax.xml.transform.Transformer;
 9 import javax.xml.transform.TransformerFactory;
10 import javax.xml.transform.stream.StreamResult;
11 import javax.xml.transform.stream.StreamSource;
12 
13 public class GetNeighborhoodYearStructuresBuilt {
14 
15     public static void main(String[] args) {
16        
17                try{		
18             URL url = new URL("http://ws.cdyne.com/DemographixWS/DemographixQuery.asmx/GetNeighborhoodYearStructuresBuilt?"
19                                + "StateAbbr=VA"
20                                + "&PlaceID=0018466");		
21     try{			
22     InputStream in = url.openStream(); 
23     StreamSource source = new StreamSource(in); 			
24     printResult(source);	
25 }catch(java.io.IOException e){			
26     e.printStackTrace();		
27 }		
28 }catch (MalformedURLException e){		
29     e.printStackTrace();	
30             }     
31     }     
32     private static void printResult(Source source) {        
33             try {            
34             ByteArrayOutputStream bos = new ByteArrayOutputStream();
35             StreamResult sr = new StreamResult(bos);
36             Transformer trans = TransformerFactory.newInstance().newTransformer();
37             Properties oprops = new Properties();
38             oprops.put(OutputKeys.OMIT_XML_DECLARATION, "yes");
39             trans.setOutputProperties(oprops);
40             trans.transform(source, sr);            
41             System.out.println("**** Response ******");            
42             System.out.println(bos.toString());   
43 
44             bos.close();
45             System.out.println();        
46     } catch (Exception e) {            
47             } 
48     }
49 }

GetPlaceIDbyAddress

 1 import java.io.ByteArrayOutputStream;
 2 import java.io.InputStream;
 3 import java.net.MalformedURLException;
 4 import java.net.URL; 
 5 import java.util.Properties;
 6 import javax.xml.transform.OutputKeys;
 7 import javax.xml.transform.Source;
 8 import javax.xml.transform.Transformer;
 9 import javax.xml.transform.TransformerFactory;
10 import javax.xml.transform.stream.StreamResult;
11 import javax.xml.transform.stream.StreamSource;
12 
13 public class GetPlaceIDbyAddress {
14 
15     public static void main(String[] args) {
16        
17                try{		
18             URL url = new URL("http://ws.cdyne.com/DemographixWS/DemographixQuery.asmx/GetPlaceIDbyAddress?"
19                                + "AddressLine1=505+Independence+Parkway"
20                                + "&City=Chesapeake"
21                                + "&StateAbbrev=VA"
22                                + "&ZipCode=23320"
23                                + "&LicenseKey=YOUR LICENSE KEY");		
24     try{			
25     InputStream in = url.openStream(); 
26     StreamSource source = new StreamSource(in); 			
27     printResult(source);	
28 }catch(java.io.IOException e){			
29     e.printStackTrace();		
30 }		
31 }catch (MalformedURLException e){		
32     e.printStackTrace();	
33             }     
34     }     
35     private static void printResult(Source source) {        
36             try {            
37             ByteArrayOutputStream bos = new ByteArrayOutputStream();
38             StreamResult sr = new StreamResult(bos);
39             Transformer trans = TransformerFactory.newInstance().newTransformer();
40             Properties oprops = new Properties();
41             oprops.put(OutputKeys.OMIT_XML_DECLARATION, "yes");
42             trans.setOutputProperties(oprops);
43             trans.transform(source, sr);            
44             System.out.println("**** Response ******");            
45             System.out.println(bos.toString());   
46 
47             bos.close();
48             System.out.println();        
49     } catch (Exception e) {            
50             } 
51     }
52 }

GetPlaceIDbyCensusTractAndBlock

 1 import java.io.ByteArrayOutputStream;
 2 import java.io.InputStream;
 3 import java.net.MalformedURLException;
 4 import java.net.URL; 
 5 import java.util.Properties;
 6 import javax.xml.transform.OutputKeys;
 7 import javax.xml.transform.Source;
 8 import javax.xml.transform.Transformer;
 9 import javax.xml.transform.TransformerFactory;
10 import javax.xml.transform.stream.StreamResult;
11 import javax.xml.transform.stream.StreamSource;
12 
13 public class GetPlaceIDbyCensusTractAndBlock {
14 
15     public static void main(String[] args) {
16        
17                try{		
18             URL url = new URL("http://ws.cdyne.com/DemographixWS/DemographixQuery.asmx/GetPlaceIDbyCensusTractAndBlock?"
19                                + "&StateAbbrev=VA"
20                                + "&CensusTract=0209.01"
21                                + "&CensusBlock=2001"
22                                + "&LicenseKey=YOUR LICENSE KEY");		
23     try{			
24     InputStream in = url.openStream(); 
25     StreamSource source = new StreamSource(in); 			
26     printResult(source);	
27 }catch(java.io.IOException e){			
28     e.printStackTrace();		
29 }		
30 }catch (MalformedURLException e){		
31     e.printStackTrace();	
32             }     
33     }     
34     private static void printResult(Source source) {        
35             try {            
36             ByteArrayOutputStream bos = new ByteArrayOutputStream();
37             StreamResult sr = new StreamResult(bos);
38             Transformer trans = TransformerFactory.newInstance().newTransformer();
39             Properties oprops = new Properties();
40             oprops.put(OutputKeys.OMIT_XML_DECLARATION, "yes");
41             trans.setOutputProperties(oprops);
42             trans.transform(source, sr);            
43             System.out.println("**** Response ******");            
44             System.out.println(bos.toString());   
45 
46             bos.close();
47             System.out.println();        
48     } catch (Exception e) {            
49             } 
50     }
51 }

GetSummaryInformationByPlaceID

 1 import java.io.ByteArrayOutputStream;
 2 import java.io.InputStream;
 3 import java.net.MalformedURLException;
 4 import java.net.URL; 
 5 import java.util.Properties;
 6 import javax.xml.transform.OutputKeys;
 7 import javax.xml.transform.Source;
 8 import javax.xml.transform.Transformer;
 9 import javax.xml.transform.TransformerFactory;
10 import javax.xml.transform.stream.StreamResult;
11 import javax.xml.transform.stream.StreamSource;
12 
13 public class GetSummaryInformationByPlaceID {
14 
15     public static void main(String[] args) {
16        
17                try{		
18             URL url = new URL("http://ws.cdyne.com/DemographixWS/DemographixQuery.asmx/GetSummaryInformationByPlaceID?"
19                                + "StateAbbrev=VA"
20                                + "&PlaceID=0018466");		
21     try{			
22     InputStream in = url.openStream(); 
23     StreamSource source = new StreamSource(in); 			
24     printResult(source);	
25 }catch(java.io.IOException e){			
26     e.printStackTrace();		
27 }		
28 }catch (MalformedURLException e){		
29     e.printStackTrace();	
30             }     
31     }     
32     private static void printResult(Source source) {        
33             try {            
34             ByteArrayOutputStream bos = new ByteArrayOutputStream();
35             StreamResult sr = new StreamResult(bos);
36             Transformer trans = TransformerFactory.newInstance().newTransformer();
37             Properties oprops = new Properties();
38             oprops.put(OutputKeys.OMIT_XML_DECLARATION, "yes");
39             trans.setOutputProperties(oprops);
40             trans.transform(source, sr);            
41             System.out.println("**** Response ******");            
42             System.out.println(bos.toString());   
43 
44             bos.close();
45             System.out.println();        
46     } catch (Exception e) {            
47             } 
48     }
49 }

GetVersion

 1 import java.io.ByteArrayOutputStream;
 2 import java.io.InputStream;
 3 import java.net.MalformedURLException;
 4 import java.net.URL; 
 5 import java.util.Properties;
 6 import javax.xml.transform.OutputKeys;
 7 import javax.xml.transform.Source;
 8 import javax.xml.transform.Transformer;
 9 import javax.xml.transform.TransformerFactory;
10 import javax.xml.transform.stream.StreamResult;
11 import javax.xml.transform.stream.StreamSource;
12 
13 public class GetVersion {
14 
15     public static void main(String[] args) {
16        
17                try{		
18             URL url = new URL("http://ws.cdyne.com/DemographixWS/DemographixQuery.asmx/GetVersion");		
19     try{			
20     InputStream in = url.openStream(); 
21     StreamSource source = new StreamSource(in); 			
22     printResult(source);	
23 }catch(java.io.IOException e){			
24     e.printStackTrace();		
25 }		
26 }catch (MalformedURLException e){		
27     e.printStackTrace();	
28             }     
29     }     
30     private static void printResult(Source source) {        
31             try {            
32             ByteArrayOutputStream bos = new ByteArrayOutputStream();
33             StreamResult sr = new StreamResult(bos);
34             Transformer trans = TransformerFactory.newInstance().newTransformer();
35             Properties oprops = new Properties();
36             oprops.put(OutputKeys.OMIT_XML_DECLARATION, "yes");
37             trans.setOutputProperties(oprops);
38             trans.transform(source, sr);            
39             System.out.println("**** Response ******");            
40             System.out.println(bos.toString());   
41 
42             bos.close();
43             System.out.println();        
44     } catch (Exception e) {            
45             } 
46     }
47 }