• Post Reply Bookmark Topic Watch Topic
  • New Topic

XmlEncoder with Applet  RSS feed

 
sreenath reddy
Ranch Hand
Posts: 415
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi

I am using an applet and data is sent from Applet to Server , and i am writing an object to Applets outputStream using XMLEncoder

connection = (HttpURLConnection)url.openConnection();
connection.setRequestMethod("POST");
connection.setDoOutput(true);
connection.setRequestProperty("Content-Type",
"application/text-xml");

outStream = connection.getOutputStream();
BufferedOutputStream buffOut = new BufferedOutputStream(outStream);
XMLEncoder encoder = new XMLEncoder(buffOut);
encoder.writeObject("3");
encoder.flush();
buffOut.flush();

And at the Server end when i get the Input Stream of the request , XMLDecoder is not able to parse giving an exception like
org.xml.sax.SAXParseException: Premature end of file.

When i tried to write that input stream to a file , i saw that the closing tags are missing

Can any one let me know if there is some setting that needs to be done while sending this (I had set the content type to text/xml also )
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!