Gemalto is now part of the Thales Group, find out more.

You are here

EHS5-E problem with HTTP POST request | Thales IoT Developer Community

January 18, 2018 - 8:58am, 1120 views

Hi all. I faced with the following problem during sending HTTP POST request.

I got the message from server "302 The document has moved"  during POST. I use python and php om remote side. Both script did this message and both scripts works properly with requests from other devices (curl, web-form).

I use native Java code without any AT-command. The code with Java is more reliable and controlled.

My code:

 String url = "****=gupload&contr=dix999";

HttpConnection conn = (HttpConnection);
conn.setRequestProperty("Content-Type", "application/x-www-form-urlencoded");
OutputStream os = conn.openOutputStream();
int code = conn.getResponseCode();

Here I got 302 message in "code" variable.

Googling I found such errors with possible redirections on remote web server.   But I don't have redirection to HTTPS on my server. For such messages I must enable to foloow redirect but JavaME doesn't have this option.

But JavaSE has class HTTPUrlConnection instead of HTTPConnection. It has the method


What should I do for EHS-5? Has anybody the experience to send POST HTTP request with Java?
Thank you