aspose file tools*
The moose likes Web Services and the fly likes ERROR!! SAXParseException: Premature end of file. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Web Services
Bookmark "ERROR!! SAXParseException: Premature end of file." Watch "ERROR!! SAXParseException: Premature end of file." New topic
Author

ERROR!! SAXParseException: Premature end of file.

Harathi Rao
Ranch Hand

Joined: Oct 31, 2004
Posts: 42
I get the error
when i try to retrive the results which returns a List from my service method at clent side.

where the getUsers() returns a List


In the tomcat console i get


where is the problem? Any kind os help !!

Thanks in advance,
Harathi Rao
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41843
    
  63
Axis can't just serialize an object it doesn't know (like Contact). You need to provide a serializer/deserializer - have you done that? If yes, then it would seem that it isn't registered properly.
If you don't have one, look into whether you can use the built-in BeanSerializer. It can serialize objects that adhere to the Java Bean pattern.


Ping & DNS - my free Android networking tools app
Harathi Rao
Ranch Hand

Joined: Oct 31, 2004
Posts: 42
hi thanks for the reply,
but the class Contact is returning a List in this fashion




getUsers() returns a List



Is the List object not recognised by Axis?
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41843
    
  63
The error message says that it is trying to serialize the Contact class, so you might want to check your code if you are specifying that somewhere.

Looking at the two code snippets, it seems that the server sends a list, while the client seems to expect an array, so there's a problem right there. You can consult this article on how to serialize collections (basically, since List is unknown to SOAP, as arrays).
Harathi Rao
Ranch Hand

Joined: Oct 31, 2004
Posts: 42
I was able to solve the problem when i tried to wrap the List in to a bean and have a bean mapping in the wsdd. which goes like this...



Thanks for the article it was very useful to me.

Harathi
Rikky Hasibuan
Greenhorn

Joined: May 21, 2009
Posts: 5
Harathi Rao wrote:





Could you please to tell us, where did you put the snip code above exactly???
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: ERROR!! SAXParseException: Premature end of file.