I am trying to connect to a servlet with my j2me application and this is not happening.
Case 1:
1) Deploy the servlet on the local computer.
2) Connect to the servlet on the local computer using the j2me application and wait for the servlet to return the value
3) J2ME gets the value from the servlet and displays it.
It works smoothly!
Case 2:
1) Deploy the servlet on the remote machine.
2) Connect to the servlet on the remote computer using the j2me application and wait until the servlet returns
3) J2me receives a "blank response" error message. Why?
Here is my code:
Case 1: MIDlet deployed on a local machine
HttpConnection c = (HttpConnection) Connector.open("http://localhost:8999/PercentileCalculator/PercentileCalculator");
c.setRequestProperty("User-Agent","Profile/MIDP-2.0, Configuration/CLDC-1.1");
c.setRequestProperty("Content-Language","en-US");
c.setRequestMethod(HttpConnection.POST);
DataOutputStream os = (DataOutputStream)c.openDataOutputStream();
os.writeUTF("100");
os.writeUTF("Test 1");
os.writeByte(12);
os.flush();
os.close();
DataInputStream is =(DataInputStream)c.openDataInputStream();
Case 2: MIDlet deployed to a remote computer
HttpConnection c = (HttpConnection) Connector.open("Url goes here");
c.setRequestProperty("User-Agent","Profile/MIDP-2.0, Configuration/CLDC-1.1");
c.setRequestProperty("Content-Language","en-US");
c.setRequestMethod(HttpConnection.POST);
DataOutputStream os = (DataOutputStream)c.openDataOutputStream();
os.writeUTF("100");
os.writeUTF("Test1");
os.writeByte(12);
os.flush(); -->Exception thrown here.
os.close();
DataInputStream is =(DataInputStream)c.openDataInputStream();
What could be the problem?
Update 1: 12.01AM 5 may Sunday
, . sql DB mysql , . , .
... . ?
2: 9.46 8
2 URL :
- www.google.com → google.. some XML-
- www.facebook.com → .., null-
- m.facebook.com → facebook... xml
- www.yahoo.com --- >
, xml, http. , ...
3 8.41am 14
- , j2me. URL- 2 - http://www.friend 'sURL.in- > ( )
http://www.mywebsiteURL.in →
, , - /-... .
4 22 2012
telmo , :
1)
#Fields: date time s-sitename s-computername s-ip cs-method cs-uri-stem cs-uri-query s-port cs-username c-ip cs- cs (User-Agent) cs ( Cookie) cs (Referer) cs-host sc-status sc-substatus sc-win32-status sc-bytes cs-bytes
2) ( 2 )
2012-05-21 04:39:06 W3SVC6826 BJJI-GLOBEDNS 67.227.164.68 GET /Servlet/PercentileCalculator - 80 - 116.203.33.229 HTTP/1.1 Mozilla/5.0+(Windows+NT+6.1;+WOW64)+AppleWebKit/536.5+(KHTML,+like+Gecko)+Chrome/19.0.1084.46+Safari/536.5 - - n10k.in 200 0 0 485 395 421
2012-05-21 04:39:08 W3SVC6826 BJJI-GLOBEDNS 67.227.164.68 GET /favicon.ico - 80 - 116.203.33.229 HTTP/1.1 Mozilla/5.0+(Windows+NT+6.1;+WOW64)+AppleWebKit/536.5+(KHTML,+like+Gecko)+Chrome/19.0.1084.46+Safari/536.5 - - n10k.in 200 0 0 17863 318 2203
3) ( ) ( 2 )
2012-05-21 04:43:17 W3SVC6826 BJJI-GLOBEDNS 67.227.164.68 POST /Servlet/PercentileCalculator - 80 - 116.203.33.229 HTTP/1.1 Profile/MIDP-1.0,+Configuration/CLDC-1.0 - - n10k.in 200 0 0 0 196 468
2012-05-21 04:43:25 W3SVC6826 BJJI-GLOBEDNS 67.227.164.68 POST /Servlet/PercentileCalculator - 80 - 116.203.33.229 HTTP/1.1 Profile/MIDP-1.0,+Configuration/CLDC-1.0 - - n10k.in 200 0 0 0 196 453
, , . , :
→ 200 0 0 17863 318 2203
→ 200 0 0 0 196 453
( SC → Bytes Sent) 0. , . - ?
5 1 2012 11.33
1) HTML , , .
2) PHP, , .
3) JSP .
4) , , .
5) , .
- , HTML-. . , .
protected void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
try{
response.setContentType("text/html");
reply = response.getWriter();
reply.println("<html><head><meta http-equiv=\"Content-Type\" content=\"text/html\"><title>Nikhil D</title></head><body>hmmm</body></html>");
reply.close();
reply.flush();
}
catch(Exception e)
{
}
, . , , /JSP. !
6: 13 2012
.