dimanche 29 mars 2015

Connecting Android device to Oracle WebLogic 9.4 server

I'm trying to implement a RESTful service for my Android app and I've decided to use Oracle WebLogic to act as a server on my PC. I have the phone and PC connected to the same LAN and ports 7001 and 80 on my PC allow TCP connections with other devices. I have tried the following solution(in AsyncTask):



protected Void doInBackground(String... params) {
String url = "http://ift.tt/1BUseLT";

queryResult = new ArrayList<String>();

try {
URL uri = new URL(url);
HttpURLConnection urlConnection = (HttpURLConnection) uri
.openConnection();
InputStream in = new BufferedInputStream(
urlConnection.getInputStream());

Scanner scan = new Scanner(in);

while (scan.hasNext()) {
queryResult.add(scan.nextLine());
}

scan.close();

urlConnection.disconnect();
} catch (Exception ex) {
ex.printStackTrace();
}
return null;
}


The IP address is the address of my PC(ipconfig), CookBook is the dynamic web project that is being hosted on my server. When I input this URL in my browser(both on PC and on Android web browser) I get the correct results, but when I try to connect to it this way, the getInputStream() method executes forever(no exceptions). Also, if I replace the URL with something I know it works, like "http://ift.tt/fyw30c", it works normally, I get the HTML of the site at the given URL. What am I overlooking here?





Aucun commentaire:

Enregistrer un commentaire