I am writting a MIDlet that is supposed to send an HTTP POST to a server through a wap gw.
The target phone is a Nokia 6600 (MIDP2.0 and WAP2.0).
First, I have done that :
- I have my configured my APN and the WAP GW address with port 8080
- the application opens a connector on "http://@IPserver/myfolder/"
- it sends the HTTP POST msg using this connection
It works, the server answers me an HTTP 200 OK but my message does not go to the server through the wap gateway !!!
The phone ignores the wap gw I have given.
I supposed this is due to the fact that the Nokia 6600 is WAP2.0 : a TCP-IP stack is implemented so the presence of a wap gateway is useless.
However, my application really needs to send HTTP messages through the gateway for special needs.
I found the following solution but it is not really practical.
Instead of using the class "HttpConnection", my application does the following steps :
- it opens a connector on socket://@IP_WAP_GW:8080
- it builds an well-formed http post message (without using the class "HttpConnection"), with the server URL in the header
- it writes the http msg on the socket
It works too (an HTTP 200 OK is returned by the server), but in this case, obviously, the msg is sent through the wap gateway.
However, it is more complicated to process that way, especially for building the http header which is done more easily with the class "HttpConnection".
Could anyone tell me why I don't succeed to do that with the class "HttpConnection" ? and if there is a way to force the message to be sent through the wap gateway while using the class "HttpConnection" ?
Thank you very much for your answers.
(I'm french, sorry if my english is not that good)
If you haven't told your phone not to ask access to network each time or if your midlet is not signed, it's normal that the phone asks you to select an access point.
But I don't see why the connection does not work in your case. Check that you select the good access point. The problem can also come from the fact that you use a private IP adress or that the port 8080 is not the good one (try 80).
I have the same problem as u r facing. I have implemented in a similar way using socket connection. I don' know a better way to do this.
I am facing one more problem. Plz let me know if u could help me in it.
this idea works fine for nokia phones but when i tried with sony ericsson mobile i didin't get any response from the server. What could be the problem. Plz let me know