Hi folks,

Hi have an J2ME application that should get some data in a simple form and send them to an external php application.

Everything was working fine. But now, misteriously, it just stops to send data (!).:confused:

There was a change on the server - but I've never heard that there was some incompatibility with j2me and linux+apache+php...

Another thing was I upgrade to Netbeans 6.5.1.

I've lost 3 whole days looking for the problem, and nothing... Please, guys, I do really need some help!

Watching by Netbeans debugger, all data are fine, and variables, just before the POST, are with right values - but it simply does not POST the data to php (on php app, seems that nothing was sent, but on Apache LOG, I can see that there were a call...).

Could by any bad configuration on Netbeans Project? I tried to change many different things, but nothing works!

Following is part of the code - maybe somebody could see a thing I could not (please, help me!!!):

1. public class HttpHandler extends Thread {
2.
3.
4. String url="hxxp://w w w. someserver. com.br/sistema/java/j2me_rec.php";
5. protected StringBuffer buff=new StringBuffer();
6. String rep=null;
7. public String sendData=null;
8. HttpListener hListener = null;
9.
10. public HttpHandler(HttpListener h){
11. hListener = h;
12. }
13.
14. synchronized public void run(){
15. try{
16. HttpConnection hc = (HttpConnection)Connector.open(url);
17. hc.setRequestMethod(HttpConnection.POST);
18. hc.setRequestProperty("User-Agent", "Profile/MIDP-1.0 Configuration/CLDC-1.0");
19. //hc.setRequestProperty("User-Agent", "Profile/MIDP-2.0 Configuration/CLDC-1.1");
20. hc.setRequestProperty("Content-Type", "application/x-www-form-urlencoded");
21. DataOutputStream dos=hc.openDataOutputStream();
22. dos.write(sendData.getBytes());
23. dos.flush();
24. dos.close();
25.
26. if (hc.getResponseCode()==hc.HTTP_OK) {
27. // You have successfully connected.
28. DataInputStream dis = hc.openDataInputStream();
29. // Now Process your request.
30. int ch = dis.read();
31. while (ch!=-1){
32. buff.append((char)ch);
33. ch = dis.read();
34. }
35. rep=buff.toString();
36. hListener.processRequest(rep);
37. dis.close();
38. }
39. }catch(SecurityException se){
40. se.printStackTrace();
41. }
42. catch(IOException ioe){
43. System.out.println(ioe.getMessage());
44. }
45. }
46. }