[Solved] How to get response from server to emulator ?

Put your problem here if it does not fit any of the other categories.

[Solved] How to get response from server to emulator ?

Postby nisha » Wed Feb 20, 2008 2:27 pm

Hi plusminus,

Thanks a lot,i got it... hey i got one more doubt :cry: .. i am able to connect to server and send user name and pwd to server and authenticate it ......... but how to get back the status to client like login succesful or login failed.. Can you plz send me some same code for it...

Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1. String URL = "http://192.168.157.35:8080/myown/Login.do?username="+username+"&password="+password+"";
  2.  
  3.             String result = null;
  4.  
  5.             HttpClient httpClient = new HttpClient();
  6.  
  7.             GetMethod getMethod = new GetMethod(URL);
  8.  
  9.          
  10.  
  11.             try
  12.  
  13.             {
  14.  
  15.               httpClient.executeMethod( getMethod );
  16.  
  17.             }
Parsed in 0.032 seconds, using GeSHi 1.0.8.4

Like this i am sending username and password to server and getting authenticated.. now hoe to get back the response like succes or failure of login...

Regards and Thanks,
Nisha
nisha
Experienced Developer
Experienced Developer
 
Posts: 80
Joined: Fri Feb 15, 2008 7:52 am

Top

Postby plusminus » Wed Feb 20, 2008 4:36 pm

Hello nisha,

Have a look at the :src: Doing HTTP Post with Android-Tutorial.

Regards,
plusminus
Image
Image | Android Development Community / Tutorials
User avatar
plusminus
Site Admin
Site Admin
 
Posts: 2688
Joined: Wed Nov 14, 2007 8:37 pm
Location: Schriesheim, Germany

response from server to emulator

Postby nisha » Thu Feb 21, 2008 6:33 am

hi Plusminus,

I got it... i used the following code in j2ee i.e server side...

Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1.                 if(returnStatus==true)
  2.  
  3.                 {
  4.  
  5.                         response.setStatus(response.SC_OK);
  6.  
  7.                 }
  8.  
  9.                 else{
  10.  
  11.                         response.setStatus(response.SC_NOT_FOUND);
  12.  
  13.                 }
Parsed in 0.031 seconds, using GeSHi 1.0.8.4

Thanks a lot...
Regards,
nisha :D
nisha
Experienced Developer
Experienced Developer
 
Posts: 80
Joined: Fri Feb 15, 2008 7:52 am

Postby kiran » Thu Mar 06, 2008 10:48 am

hi nisha

can u share the code.

Thanks & Regards,
Kiran.
:) smile it is the key that fits the lock of everybody's heart
User avatar
kiran
Experienced Developer
Experienced Developer
 
Posts: 78
Joined: Thu Nov 22, 2007 11:36 am
Location: India

Top

Return to Other Coding-Problems

Who is online

Users browsing this forum: MSNbot Media and 20 guests