Arif,
Bonjour!
Try this! (modification in Bold)
HttpConnection conn = null;
OutputStream os = null;
conn =
(HttpConnection)javax.microedition.io.Connector.open(url,Connector.READ_WRIT
E,true);
conn.setRequestMethod(HttpConnection.POST);
os = conn.openOutputStream();
os.write((2).getBytes());
os.flush();
os.close();
conn.connect();
conn.close();
Tell me how it goes. The "READ_WRITE" is optional but you might be better
off using it.
Olivier
-----Original Message-----
From: Arif Rajan [mailto:arajaca@yahoo.ca]
Sent: Thursday, October 11, 2001 2:40 AM
To: mailing-list
Subject: (keitai-l) Http POST for I-mode Devices
Hi,
I'm having some trouble sending data from an I-Appli
through the network to a servlet using Http POST.
Here is the code I am using:
HttpConnection conn = null;
OutputStream os = null;
conn =
(HttpConnection)javax.microedition.io.Connector.open(url,Connector.WRITE,tru
e);
conn.setRequestMethod(HttpConnection.POST);
os = conn.openOutputStream();
os.write(2);
os.flush();
os.close();
conn.connect();
conn.close();
When testing on the F503i, P503i and P503iS, there is
a com.nttdocomo.io.ConnectionException thrown when
trying to connect (conn.connect()). The status for
this ConnectionException is ILLEGAL_STATE. When I try
the same code on the SO503i, the connection is made,
but the POST is empty. There are no problems when
using this code with the D503i, N503i and N503iS.
I have also tried this code using openDataOutputStream
(), yielding the same results.
Any ideas on why this may happen or suggestions on a
different method for sending data would be greatly
appreciated.
Thanks,
Arif
_______________________________________________________
Do You Yahoo!?
Get your free @yahoo.ca address at http://mail.yahoo.ca
[ Need archives? How to unsubscribe?
http://www.appelsiini.net/keitai-l/ ]
[ Need archives? How to unsubscribe? http://www.appelsiini.net/keitai-l/ ]
Received on Thu Oct 11 04:26:31 2001