i need to send the query to the website and get the result.
but for the following code, it returns
java.net.Connec tException: Connection refused
help required as i cant understand how to proceed further.
Thanks in advance
but for the following code, it returns
java.net.Connec tException: Connection refused
import java.io.Buffere dReader;
import java.io.InputSt ream;
import java.io.InputSt reamReader;
import java.net.URL;
public class Sample1 {
public static void main(String[] args) {
try {
String url = "http://www.xyz.cn/RNA";
String Query = "/>Example \nCUUGGGAAUGGCA AGGAAACCGUUACCA UUACUGAGUUUAGUA AUGGUAAUGGUUCUC UUGCUAUACCCAGA" ;
String request = url;
request = request + "?";
request = request + Query;
URL serviceURL = new URL(request);
InputStream is = serviceURL.open Stream();
//InputStreamRead er isr = new InputStreamRead er(is,"UTF-8");
InputStreamRead er isr = new InputStreamRead er(is);
BufferedReader br = new BufferedReader( isr);
StringBuffer response = new StringBuffer();
String nextLineFromSer vice = br.readLine();
while (nextLineFromSe rvice != null) {
response.append (nextLineFromSe rvice);
nextLineFromSer vice = br.readLine();
}
System.out.prin tln(response);
}
catch (Exception e) {
System.out.prin tln(e);
}
}
}
import java.io.InputSt ream;
import java.io.InputSt reamReader;
import java.net.URL;
public class Sample1 {
public static void main(String[] args) {
try {
String url = "http://www.xyz.cn/RNA";
String Query = "/>Example \nCUUGGGAAUGGCA AGGAAACCGUUACCA UUACUGAGUUUAGUA AUGGUAAUGGUUCUC UUGCUAUACCCAGA" ;
String request = url;
request = request + "?";
request = request + Query;
URL serviceURL = new URL(request);
InputStream is = serviceURL.open Stream();
//InputStreamRead er isr = new InputStreamRead er(is,"UTF-8");
InputStreamRead er isr = new InputStreamRead er(is);
BufferedReader br = new BufferedReader( isr);
StringBuffer response = new StringBuffer();
String nextLineFromSer vice = br.readLine();
while (nextLineFromSe rvice != null) {
response.append (nextLineFromSe rvice);
nextLineFromSer vice = br.readLine();
}
System.out.prin tln(response);
}
catch (Exception e) {
System.out.prin tln(e);
}
}
}
Thanks in advance
Comment