hi
i am trying to send http request to kannel through a java program,it is
recieved by kannel as shown in log trace with an error status 400 - invalid
content type, in the java program i am encoding the cgi variables i.e
user,password,to and text to be passed to kannel in UTF-8 format but it is
not working please guide.


*java program -*
String data = URLEncoder.encode("user","UTF-8") + "=" +
URLEncoder.encode("test","UTF-8");
data += "&" + URLEncoder.encode("pass", "UTF-8") + "=" +
URLEncoder.encode("test", "UTF-8");
data += "&" + URLEncoder.encode("to", "UTF-8") + "=" +
URLEncoder.encode("99999", "UTF-8");
data += "&" + URLEncoder.encode("text", "UTF-8") + "=" +
URLEncoder.encode("test", "UTF-8");
//Send data
URL url = new URL("http://localhost:13013/cgi-bin/sendsms?";);
URLConnection conn = url.openConnection();
conn.setDoOutput(true);
OutputStreamWriter wr = new OutputStreamWriter(conn.getOutputStream());
wr.write(data);


*kannel bearerbox log trace

*2010-10-23 12:46:52 [6490] [4] DEBUG: HTTP: Creating HTTPClient for
`127.0.0.1'.
2010-10-23 12:46:52 [6490] [4] DEBUG: HTTP: Created HTTPClient area
0x9cf1a28.
*2010-10-23 12:46:52 [6490] [5] INFO: smsbox: Got HTTP request
</cgi-bin/sendsms> from <127.0.0.1>
2010-10-23 12:46:52 [6490] [5] DEBUG: Status: 400 Answer: <Invalid
content-type>*
2010-10-23 12:46:52 [6490] [5] DEBUG: HTTP: Resetting HTTPClient for
`127.0.0.1'.
2010-10-23 12:46:52 [6490] [3] DEBUG: HTTP: Destroying HTTPClient area
0x9cf1a28.
2010-10-23 12:46:52 [6490] [3] DEBUG: HTTP: Destroying HTTPClient for
`127.0.0.1'.

Reply via email to