mirror of
https://gitlab.com/harald.mueller/aktuelle.kurse.git
synced 2024-11-30 21:51:56 +01:00
34 lines
830 B
Java
34 lines
830 B
Java
import java.io.BufferedReader;
|
|
import java.io.InputStreamReader;
|
|
import java.net.URL;
|
|
import java.net.URLConnection;
|
|
|
|
|
|
public class ConnectionSample {
|
|
|
|
/**
|
|
* @param args
|
|
*/
|
|
public static void main(String[] args) throws Exception {
|
|
|
|
|
|
//word we want to search for:
|
|
String word = "apple";
|
|
|
|
//call web-service and get input stream result:
|
|
URL url = new URL("http://services.aonaware.com/" +
|
|
"DictService/DictService.asmx/Define?word="+ word);
|
|
URLConnection yc = url.openConnection();
|
|
|
|
//test and show result as String:
|
|
BufferedReader in = new BufferedReader
|
|
(new InputStreamReader(yc.getInputStream()));
|
|
String inputLine;
|
|
while ((inputLine = in.readLine()) != null)
|
|
System.out.println(inputLine);
|
|
in.close();
|
|
|
|
}
|
|
|
|
}
|