Win a copy of Terraform in Action this week in the Cloud 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • Rob Spoor
  • Bear Bibeault
Saloon Keepers:
  • Jesse Silverman
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • Al Hobbs
  • salvin francis

Sending XML to a mobile phone

 
Ranch Hand
Posts: 46
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

I have made a servlet that sends an XML data via an HttpServletResponse object. With this approach I can send the XML data to a browser or an HttpClient object which uses the getResponseBody() method. Problem is, it does not work with the MIDP2 HttpConnection object using the openInputStream(). Has anyone tried sending XML data to a mobile phone?

Please see code below for doPost().

Thanks a lot.



code based on : http://www.javazoom.net/services/newsletter/xmlgeneration.html
[ November 08, 2005: Message edited by: Raymond Ong ]
 
ranger
Posts: 17346
11
Mac IntelliJ IDE Spring
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Well for J2ME calling a Servlet, the out.write() would be the straight XML String. Meaning you don't add the XML Object to the HTTPResponse Object, but it is the response itself. I have done this many times with URLConnection and J2ME.

Personally when it comes to this, I just send straight text and forget about the XML. It all depends on the size of the data being sent back. Most of the time I try to keep it really small so there is less time.

Mark
 
Raymond Ong
Ranch Hand
Posts: 46
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Since I really can't get my previous code to work, looks like i'm gonna stick to sending plain text xml.

Thanks a lot.
 
You showed up just in time for the waffles! And this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
reply
    Bookmark Topic Watch Topic
  • New Topic