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)