• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Sending XML to a mobile phone

 
Raymond Ong
Ranch Hand
Posts: 46
  • Mark post as helpful
  • send pies
  • 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 ]
 
Mark Spritzler
ranger
Sheriff
Posts: 17278
6
IntelliJ IDE Mac Spring
  • Mark post as helpful
  • send pies
  • 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
  • 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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic