aspose file tools
The moose likes Java Micro Edition and the fly likes Sending XML to a mobile phone Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Mobile » Java Micro Edition
Reply Bookmark "Sending XML to a mobile phone" Watch "Sending XML to a mobile phone" New topic
Author

Sending XML to a mobile phone

Raymond Ong
Ranch Hand

Joined: Jul 17, 2005
Posts: 46
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

Joined: Feb 05, 2001
Posts: 17234
    
    1

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


Perfect World Programming, LLC - Two Laptop Bag - Tube Organizer
How to Ask Questions the Smart Way FAQ
Raymond Ong
Ranch Hand

Joined: Jul 17, 2005
Posts: 46
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.
 
I agree. Here's the link: http://zeroturnaround.com/jrebel - it saves me about five hours per week
 
subject: Sending XML to a mobile phone
 
Similar Threads
Error while using TransformerHandler
The character '' is an invalid XML character exception getting while export data in XML file
Servlet returning an XML
How to read and write the data in XML file
How to convert a text file into an xml?