Skip to main content

java.io.IOException: Error in HTTP operation

19 replies [Last post]
bhakki
Offline
Joined: 2009-09-09

Hi,

Anyone facing this exception?
java.io.IOException: Error in HTTP operation

Its occurs when im using httpconnection.

Regards,
Bharath.C

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
Mixa

In my app I do not encode data being sent through POST. Do you use
"multipart/form-data" in setRequestProperty("Content-Type",...)?

Mike

On Wed, Jun 16, 2010 at 5:17 PM, wrote:
> Thanks mixa.
>
> Access point activated properly.
> At begin login validation working fine through httpconnection.
> After that i could post the encoded url.
> That url contains xml formatted string with url address.
> Is this encoded problem?
>
>
> Regards,
> Bharath.
> [Message sent by forum member 'bhakki']
>
> http://forums.java.net/jive/thread.jspa?messageID=474490
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@lwuit.dev.java.net
> For additional commands, e-mail: users-help@lwuit.dev.java.net
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@lwuit.dev.java.net
For additional commands, e-mail: users-help@lwuit.dev.java.net

bhakki
Offline
Joined: 2009-09-09

If I using Content-Type as multipart/form-data i got this exception

java.lang.IllegalArgumentException: Space character in URL

Thats why i encoding the url.

Is anything wrong?

Mixa

do you specify "application/x-www-form-urlencoded" ctype then?

On Wed, Jun 16, 2010 at 6:29 PM, wrote:
> If I using Content-Type as multipart/form-data i got this exception
>
> java.lang.IllegalArgumentException: Space character in URL
>
> Thats why i encoding the url.
>
> Is anything wrong?
> [Message sent by forum member 'bhakki']
>
> http://forums.java.net/jive/thread.jspa?messageID=474506
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@lwuit.dev.java.net
> For additional commands, e-mail: users-help@lwuit.dev.java.net
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@lwuit.dev.java.net
For additional commands, e-mail: users-help@lwuit.dev.java.net

Mixa

Actually I use multipart/form-data and do not have problems, sending
both form field values and uploading files (jpegs), and haven't seen
problems like yours yet. May be because I just never tried it on
problem phones.

For application/x-www-form-urlencoded it seems OK to use urlencoding,
like you did.

Please have a look at
http://www.w3.org/TR/html401/interact/forms.html#h-17.13.4.2 with
description of multipart/form-data - you may want to try specifying
content type for parts, which should be text/plain by default (so it's
strange why you get "Space character in URL" exception when not
specifying urlencoded).

High chances are that you do something wrong, double check your code.
What ctype do you specify in request header when "it works on other
devices"? application/x-www-form-urlencoded or none?

Mike

On Wed, Jun 16, 2010 at 6:52 PM, Mixa wrote:
> do you specify "application/x-www-form-urlencoded" ctype then?
>
> On Wed, Jun 16, 2010 at 6:29 PM,   wrote:
>> If I using Content-Type as multipart/form-data i got this exception
>>
>> java.lang.IllegalArgumentException: Space character in URL
>>
>> Thats why i encoding the url.
>>
>> Is anything wrong?
>> [Message sent by forum member 'bhakki']
>>
>> http://forums.java.net/jive/thread.jspa?messageID=474506
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@lwuit.dev.java.net
>> For additional commands, e-mail: users-help@lwuit.dev.java.net
>>
>>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@lwuit.dev.java.net
For additional commands, e-mail: users-help@lwuit.dev.java.net

bhakki
Offline
Joined: 2009-09-09

Thanks again Mixa. :)
Normally text/plain c-type will working on all other emulators and s60 mobiles.
But particularly its not working on s40 mobiles. :(
I was specified text/plain, multipart/form-data, application/x-www-form-urlencoded for s40 mobiles.
But problem was still the same and it will be working on other mobiles whatever mention in c-type.

Regards,
Bharath.

Mixa

Hi,

Check if you do not use special characters (the space) in the URL (not
in post data) - I remember I had an issue like that when used them in
URL - some phones 'eat' it OK (probably doing urlencoding internally)
but some generated an error, I do not remember exactly which one, but
it could be your case.

Mike

On Thu, Jun 17, 2010 at 11:44 AM, wrote:
> Thanks again Mixa. :)
> Normally text/plain c-type will working on all other emulators and s60 mobiles.
> But particularly its not working on s40 mobiles. :(
> I was specified text/plain, multipart/form-data, application/x-www-form-urlencoded for s40 mobiles.
> But problem was still the same and it will be working on other mobiles whatever mention in c-type.
>
>
>
> Regards,
> Bharath.
> [Message sent by forum member 'bhakki']
>
> http://forums.java.net/jive/thread.jspa?messageID=474622
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@lwuit.dev.java.net
> For additional commands, e-mail: users-help@lwuit.dev.java.net
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@lwuit.dev.java.net
For additional commands, e-mail: users-help@lwuit.dev.java.net

bhakki
Offline
Joined: 2009-09-09

Hi all,

Thanks for everyone. :)
My problem was solved.
Its encoding problem.
Now its working. :)

Regards,
Bharath.

Mixa

Though I do not think it applies to S40 phones - you can try to call
flush() on output stream (or not to call, if already call it) - I
heard it matters on some phones.

Mike

On Tue, Jun 15, 2010 at 5:35 PM, wrote:
> Im using POST method only.
> But still the same.
> It will work on s40 emulators.
> But Its not working on real s40 mobiles.
> [Message sent by forum member 'bhakki']
>
> http://forums.java.net/jive/thread.jspa?messageID=474335
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@lwuit.dev.java.net
> For additional commands, e-mail: users-help@lwuit.dev.java.net
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@lwuit.dev.java.net
For additional commands, e-mail: users-help@lwuit.dev.java.net

mahdi_hijazi
Offline
Joined: 2010-01-15

Ok, sometimes the first attempt for connecting the internet failed, so I use multiple attempts to connect the internet before quiting and displaying error to the user. This solve me some problems on some devices.

bhakki
Offline
Joined: 2009-09-09

Here i post the bulk data as xml string format with url and i did encode the url.
somebody said to change the request attributes for httpconnection.
So I used Content-Type,Content-Length,Accept-Language and set the RequestMethod is HttpConnection.POST.

Is anything wrong?

Regards,
Bharath

Mixa

forum.nokia.com is the best place to ask such questions. Searching
there shows plenty of entries:
http://www.forum.nokia.com/basic-search/search.xhtml?view=ebs&hv=fn:topi...

They say that it is most likely problem of access point settings which
differ on S40.

Regards, Mike
[code]
/* ----------------------
* J2ME consulting/development:
* gmixaz[@]gmail[.]com ICQ 50059348
*/
[/code]

On Wed, Jun 16, 2010 at 10:12 AM, wrote:
> Here i post the bulk data as xml string format with url and i did encode the url.
> somebody said to change the request attributes for httpconnection.
> So I used Content-Type,Content-Length,Accept-Language and set the RequestMethod is HttpConnection.POST.
>
>
> Is anything wrong?
>
>
> Regards,
> Bharath
> [Message sent by forum member 'bhakki']
>
> http://forums.java.net/jive/thread.jspa?messageID=474429
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@lwuit.dev.java.net
> For additional commands, e-mail: users-help@lwuit.dev.java.net
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@lwuit.dev.java.net
For additional commands, e-mail: users-help@lwuit.dev.java.net

bhakki
Offline
Joined: 2009-09-09

Thanks mixa.

Access point activated properly.
At begin login validation working fine through httpconnection.
After that i could post the encoded url.
That url contains xml formatted string with url address.
Is this encoded problem?

Regards,
Bharath.

mahdi_hijazi
Offline
Joined: 2010-01-15

You don't concatenate the xml data with the connection url. do you?

if you do, make sure you post the data using the output stream.

mahdi_hijazi
Offline
Joined: 2010-01-15

some code will be helpful, maybe you didn't configure the internet settings correctly, maybe you don't have enough credit or the network is down!!

bhakki
Offline
Joined: 2009-09-09

Hi,

Its occurring only on s40 mobiles only.
In my application i verified the login validation through httpconnection, its working fine.

But after login i could posted the some values as XML format with the URL.
Here i got the this exception.
Its working fine for s60 mobiles, emulators...

mahdi_hijazi
Offline
Joined: 2010-01-15

if you are sending a lot of data use HTTP POST not HTTP GET method.

bhakki
Offline
Joined: 2009-09-09

Im using POST method only.
But still the same.
It will work on s40 emulators.
But Its not working on real s40 mobiles.

ghady_rayess
Offline
Joined: 2009-01-09

You need to be using GPRS and not WAP with s40 devices.

I don't know why Nokia are self sabotaging themselves!

bhakki
Offline
Joined: 2009-09-09

I'm using GPRS connection.
I don't know why its happening on s40 devices.
Is any other solution?