(keitai-l) Re: Http POST for I-mode Devices

From: Zev Blut <zev_at_atc.yamatake.co.jp>
Date: 10/11/01
Message-ID: <003701c151fa$8927df10$da1414ac@taishakurhq>
Hello,

You are both getting close to the proper answer.

After the:
 conn.setRequestMethod(HttpConnection.POST);

You need to set the Request property to something like:


conn.setRequestProperty("Content-Type","application/x-www-form-urlencoded");

or

conn.setRequestProperty("Content-Type","text/plain");

Then follow the sequence below and you should be good to go!

Zev

----- Original Message -----
From: "Jeudy, Olivier [AUDT]" <olivier.jeudy@nssmb.com>
To: <keitai-l@appelsiini.net>
Sent: Thursday, October 11, 2001 10:37 AM
Subject: (keitai-l) Re: Http POST for I-mode Devices


> 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/ ]
>
>


[ Need archives? How to unsubscribe? http://www.appelsiini.net/keitai-l/ ]
Received on Thu Oct 11 04:57:52 2001