tag:blogger.com,1999:blog-8214401912480503366.post7392478535114551385..comments2023-08-10T13:35:15.093+02:00Comments on My life with Android :-): Client-server communication with JSONGabor Pallerhttp://www.blogger.com/profile/14307475522972458932noreply@blogger.comBlogger11125tag:blogger.com,1999:blog-8214401912480503366.post-6614815830092115892014-05-25T18:50:00.217+02:002014-05-25T18:50:00.217+02:00hey,
it was really a good read, thank you. lately...hey,<br /><br />it was really a good read, thank you. lately, I've reversed client - server communication but in online game, would you mind to come and leave your comment? here is a link:<br /><br />http://blog.szulak.org/dev/reversing-client-and-server-communication-in-tibia/<br /><br />regards,<br />szulakAnonymousnoreply@blogger.comtag:blogger.com,1999:blog-8214401912480503366.post-22797946772886114642012-01-02T03:45:46.770+01:002012-01-02T03:45:46.770+01:00This comment has been removed by the author.EThttps://www.blogger.com/profile/00043076722971225938noreply@blogger.comtag:blogger.com,1999:blog-8214401912480503366.post-56094906138971528872011-11-11T17:21:42.904+01:002011-11-11T17:21:42.904+01:00very good tutorial and can hopefully help me in bu...very good tutorial and can hopefully help me in building json in the application that I created for this lecture. thank youandryhttp://library.gunadarma.ac.id/noreply@blogger.comtag:blogger.com,1999:blog-8214401912480503366.post-58511577345999813832011-03-17T15:36:59.494+01:002011-03-17T15:36:59.494+01:00Anthony, this project was not created with Eclipse...Anthony, this project was not created with Eclipse. Use File/Import in Eclipse to import it into your workspace (or leave it as it is, you just need to type "ant" to compile it).Gabor Pallerhttps://www.blogger.com/profile/14307475522972458932noreply@blogger.comtag:blogger.com,1999:blog-8214401912480503366.post-69993138402444007652011-03-16T20:50:15.269+01:002011-03-16T20:50:15.269+01:00Gabor Paller,
Im trying to create a client-server...Gabor Paller,<br /><br />Im trying to create a client-server application in which the mobile client sends GPS points to the server.<br /><br />Resources on client-server methods for android are often very different to each other and was hoping to use your this post as some enlightenment.<br /><br />However, after unzipping Eclipse does not notice the client directory as a project!<br /><br />Any ideas ?<br /><br />Thank you,<br />AnthonyUnknownhttps://www.blogger.com/profile/07376137783164063953noreply@blogger.comtag:blogger.com,1999:blog-8214401912480503366.post-42125707912707462232011-01-24T21:57:42.475+01:002011-01-24T21:57:42.475+01:00Sorry, Chinmaya, I have no idea what went wrong. C...Sorry, Chinmaya, I have no idea what went wrong. Could you maybe capture a succesful login (with e.g. wireshark) and compare it with whatever your android program produces?Gabor Pallerhttps://www.blogger.com/profile/14307475522972458932noreply@blogger.comtag:blogger.com,1999:blog-8214401912480503366.post-22941714325493883132011-01-24T07:36:43.997+01:002011-01-24T07:36:43.997+01:00Now I have changed it to get type still its not wo...Now I have changed it to get type still its not working<br /><br /><br />JSONArray elements = new JSONArray();<br />JSONObject obj = new JSONObject();<br />obj.put("emailid", "ratheeshcp@xyz.com");<br />obj.put("password", "123456789");<br /><br />elements.put(obj);<br /><br />DefaultHttpClient httpClient = new DefaultHttpClient();<br /><br />HttpGet get = new HttpGet( "http://xyz/userLogin.html");<br />HttpParams params = get.getParams();<br /> params.setParameter("emailid", "ratheeshcp@xyz.com");<br /> params.setParameter("password", "123456789");<br />HttpResponse resp = httpClient.execute( get );<br />InputStream is = resp.getEntity().getContent();<br />BufferedReader br = new BufferedReader(new InputStreamReader(is));<br /><br />String line = br.readLine();<br />System.out.println(line);<br /><br /><br /><br />Even if I am sending as url also it is not working<br /><br />HttpGet get = new HttpGet("http://xyz/userLogin.html?json="+elements.toString());Chinmayahttps://www.blogger.com/profile/03408915066227907814noreply@blogger.comtag:blogger.com,1999:blog-8214401912480503366.post-6873045435107955832011-01-24T05:54:16.710+01:002011-01-24T05:54:16.710+01:00Thanks Gabor Paller.
Can u modify the code for th...Thanks Gabor Paller.<br /><br />Can u modify the code for this in application so that I can get getter Idea.Chinmayahttps://www.blogger.com/profile/03408915066227907814noreply@blogger.comtag:blogger.com,1999:blog-8214401912480503366.post-62491132094671939492011-01-21T15:14:49.304+01:002011-01-21T15:14:49.304+01:00I can see two problems:
"[{"password&qu...I can see two problems:<br /><br />"[{"password":"123456789", "emailid":"ratheeshcp@xyz.com"}]"<br /><br />This is a JSON array with 1 element (a JSON struct). I cannot see that JSON array in your code, only the JSON struct (that you should add to the array)<br /><br />"post.setEntity( new StringEntity(request) ); "<br /><br />It seemed to me that your JSON entity should be added as a GET parameter but here you created a POST request. Depending on the server, this may be wrong.<br /><br />Also, if you indeed want to transfer JSON objects in GET requests, you need to URL encode them.Gabor Pallerhttps://www.blogger.com/profile/14307475522972458932noreply@blogger.comtag:blogger.com,1999:blog-8214401912480503366.post-70772830512942904122011-01-21T12:42:52.681+01:002011-01-21T12:42:52.681+01:00Hi All
I am working on a project which requires h...Hi All<br /><br />I am working on a project which requires httpRequest in the Form of JSOn and It Give Response in the JSON format<br /><br />My Url is: http://xyz/userLogin.html?json=[{"password":"123456789", "emailid":"ratheeshcp@xyz.com"}]<br /><br />Response: {"login":{"loginmsg":"successful","userid":"3","user_type":"Admin"}}<br /><br />for this I am writing code like this:<br /><br />JSONArray elements = new JSONArray();<br />try {<br /><br />JSONObject obj = new JSONObject();<br />obj.put("emailid", "ratheeshcp@xyz.com");<br />obj.put("password", "123456789");<br /><br />elements.put(obj);<br /><br />String request = elements.toString();<br />System.out.println(request);<br />DefaultHttpClient httpClient = new DefaultHttpClient();<br />HttpParams params = httpClient.getParams();<br />HttpConnectionParams.setConnectionTimeout(params, REGISTRATION_TIMEOUT);<br />HttpConnectionParams.setSoTimeout(params, REGISTRATION_TIMEOUT);<br />ConnManagerParams.setTimeout(params, REGISTRATION_TIMEOUT);<br />HttpPost post = new HttpPost( "http://xyz/userLogin.html?");<br />// post.addHeader( "Content-Type", "text/vnd.com.json.req" );<br />post.setEntity( new StringEntity(request) );<br />HttpResponse resp = httpClient.execute( post );<br />InputStream is = resp.getEntity().getContent();<br />BufferedReader br = new BufferedReader(new InputStreamReader(is));<br /><br />String line = br.readLine();<br />System.out.println(line);<br /><br />} catch( Exception ex ) {<br />ex.printStackTrace();<br />}<br />....................<br /><br />When I am running this code I am getting<br /><br /><br />{"login":{"loginmsg":"The username or password you entered is incorrect."}}<br /><br />as response<br /><br /><br />Can Any One help me in that.Chinmayahttps://www.blogger.com/profile/03408915066227907814noreply@blogger.comtag:blogger.com,1999:blog-8214401912480503366.post-28167128170281972592011-01-21T12:29:07.945+01:002011-01-21T12:29:07.945+01:00My Url is: http://xyz/userLogin.html?json=[{"...My Url is: http://xyz/userLogin.html?json=[{"password":"123456789", "emailid":"ratheeshcp@xyz.com"}]<br /><br />Response: {"login":{"loginmsg":"successful","userid":"3","user_type":"Admin"}}<br /><br />for this I am writing code like this:<br /><br /> JSONArray elements = new JSONArray();<br /> try {<br /> <br /> JSONObject obj = new JSONObject();<br /> obj.put("emailid", "ratheeshcp@xyz.com");<br /> obj.put("password", "123456789");<br /> <br /> elements.put(obj);<br /> <br /> String request = elements.toString();<br /> System.out.println(request);<br /> DefaultHttpClient httpClient = new DefaultHttpClient();<br /> HttpParams params = httpClient.getParams();<br /> HttpConnectionParams.setConnectionTimeout(params, REGISTRATION_TIMEOUT);<br /> HttpConnectionParams.setSoTimeout(params, REGISTRATION_TIMEOUT);<br /> ConnManagerParams.setTimeout(params, REGISTRATION_TIMEOUT);<br /> HttpPost post = new HttpPost( "http://xyz/userLogin.html?");<br /> // post.addHeader( "Content-Type", "text/vnd.com.json.req" );<br /> post.setEntity( new StringEntity(request) ); <br /> HttpResponse resp = httpClient.execute( post );<br /> InputStream is = resp.getEntity().getContent();<br /> BufferedReader br = new BufferedReader(new InputStreamReader(is));<br /> <br /> String line = br.readLine();<br /> System.out.println(line);<br /> <br /> } catch( Exception ex ) {<br /> ex.printStackTrace();<br /> }<br />....................<br /><br />When I am running this code I am getting <br /><br /><br />{"login":{"loginmsg":"The username or password you entered is incorrect."}}<br /><br />as response<br /><br /><br />CAn Any One help me in that.<br /><br /><br />Thanks in Advance.Chinmayahttps://www.blogger.com/profile/03408915066227907814noreply@blogger.com