Win a copy of Learning OpenStack Networking: Build a solid foundation in virtual networking technologies for OpenStack-based clouds this week in the Cloud/Virtualization forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
  • Liutauras Vilda
  • Campbell Ritchie
  • Tim Cooke
  • Bear Bibeault
  • Devaka Cooray
  • Jeanne Boyarsky
  • Knute Snortum
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Ganesh Patekar
  • Stephan van Hulst
  • Pete Letkeman
  • Carey Brown
  • Tim Holloway
  • Ron McLeod
  • Vijitha Kumara

HTTP Post on UMTS stops  RSS feed

Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi there I modified the code from this thread to suit the needs of J2ME:

Modifications I made:

* Use instead of URLConnection
* Use String.getBytes() as DataOutputStream.writeBytes(String s) is not available in MIDP
* Use FileConnection from JSR-75 FileConnection API

I use it like this:

While the code seems to work well with GPRS, I experienced problems with UMTS.
Here are my test results:

||Java Plattform||JP-8JP-8JP-8JP-8JP-8JP-8
||Filesize (Byte)||1.428.0771.428.0771.428.0771.428.0771.428.0781.428.079
||Upload (Byte)||completecompletecompletecomplete184320 (113664)627712 (199680)

The problem of partial upload seems only to exist with larger Files (not sure where exactly the lower bound is).

I hope this was not too much information for a start, but I am currently quite desperate about this bug.
I could really use some help here. I will also provide you with the results of a test on Nokia S60 phones
and the results of SE on device debugging.

[ April 03, 2008: Message edited by: Tilman Bender ]
Sorry could not manage to get my results formatted any better.
[ April 03, 2008: Message edited by: Tilman Bender ]
Tilman Bender
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The issue was solved by a firmware upgrade
Must have been a problem with JP-8. Works as expected on JP-8.2 now.

Java PlattformJP-8.2JP-8.2
Carrier VodafoneVodafone
Filesize (Byte)1.428.0771.428.077
Upload (Byte)completecomplete

Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Tim,
I am trying to do http post with multipart/related content type. I wrote the code but it always gives exception when binary data starts to be written. can you look at see what is wrong? Thanks

c = (HttpConnection);
String axml="<?xml version='1.0'?><entry xmlns='' " +
"xmlns:media='' xmlns:yt=''>" +
" <media:group> <media:title type='plain'>Bad Wedding Toast</media:title>" +
" <media escription type='plain'> I gave a bad toast at my friend's wedding." +
" </media escription> <media:category" +
" scheme=''>People" +
" </media:category> <media:keywords>toast, wedding</media:keywords>" +
" </media:group></entry>";
// Set the request method and headers
c.setRequestProperty("Host", "");
c.setRequestProperty("Authorization", "GoogleLogin auth="+appM.utubeAuth);
c.setRequestProperty("X-GData-Client", appM.clientid);
c.setRequestProperty("X-GData-Key", "key="+appM.developerkey);
c.setRequestProperty("Slug", "myvideo.3gp");
c.setRequestProperty("Content-Type", "multipart/related; boundary="+BOUNDARY);
// String consize=new String()

String message1 = "";
message1 += "--"+BOUNDARY + CrLf;
message1 += "Content-Type: application/atom+xml; charset=UTF-8" + CrLf+ CrLf;
message1 += axml;
message1 += CrLf+"--"+BOUNDARY + CrLf;
message1 += "Content-Type: video/3gpp" + CrLf;
message1 += "Content-Transfer-Encoding: binary" + CrLf+ CrLf;
// the image is sent between the messages in the multipart message.

String message2 = "";
message2 += CrLf+"--"+BOUNDARY + "--";

String contlen=(new Long(appM.blockSize[2]+message1.length()+message2.length())).toString();
c.setRequestProperty("Content-Length", contlen);

c.setRequestProperty("Connection", "close");
os = c.openOutputStream();

// os.write(appM.anim[2]);
int index = 0;
int size = 1024;
System.out.println("write:" + index);
size = appM.anim[2].length - index;
os.write(appM.anim[2], index, size);

Posts: 19725
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What's the exception?
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!