This week's book giveaways are in the Java EE and JavaScript forums.
We're giving away four copies each of The Java EE 7 Tutorial Volume 1 or Volume 2(winners choice) and jQuery UI in Action and have the authors on-line!
See this thread and this one for details.
The moose likes Web Services and the fly likes is method return type needs to implement the Serializable interface in webservice? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Java » Web Services
Bookmark "is method return type needs to implement the Serializable interface in webservice?" Watch "is method return type needs to implement the Serializable interface in webservice?" New topic
Author

is method return type needs to implement the Serializable interface in webservice?

philber fang
Greenhorn

Joined: Dec 30, 2004
Posts: 12
I know that all parameters in the service method needs to implements the Serializable, but not sure about the return data of the method?

I need to create a webservice method which would retruns a pdf file, there are a couple of different ways of doing this, one is that I'll open the pdf file and return an inputStream to the client, and the client can read from the stream. But the question is, the inputStream(or BufferInputStream) doesn't implement the Serialization, is it needed?

Or any other ways, return a byte array?

Thanks in advance.
Balaji Loganathan
author and deputy
Bartender

Joined: Jul 13, 2001
Posts: 3150
Originally posted by philber fang:
return a byte array?

Inputstream is not serializable, and not interoperable.
bytearray is good choice.
philber fang
Greenhorn

Joined: Dec 30, 2004
Posts: 12
Originally posted by Balaji Loganathan:

Inputstream is not serializable, and not interoperable.
bytearray is good choice.


Thanks a lot for your reply Balaji, so you mean the return type needs to implement the Serializable interface.

But I don't understand, what do you mean by "not interoperable"?

thanks
Balaji Loganathan
author and deputy
Bartender

Joined: Jul 13, 2001
Posts: 3150
Originally posted by philber fang:


Thanks a lot for your reply Balaji, so you mean the return type needs to implement the Serializable interface.

But I don't understand, what do you mean by "not interoperable"?

thanks


Interopearability in the sense of communicating soap messages between various platform like php, java, .net etc.,

If you use the primitive data types(like int, byte, string, char) then most the serialization process is taken care by sofware solution provider itself(for example axis, .netframework). For other types you have explicitly configure your applicaiton in the deployment descriptor and so on.
philber fang
Greenhorn

Joined: Dec 30, 2004
Posts: 12
I got it, Thanks a lot, Balaji!!
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: is method return type needs to implement the Serializable interface in webservice?