This week's book giveaway is in the Mac OS forum.
We're giving away four copies of a choice of "Take Control of Upgrading to Yosemite" or "Take Control of Automating Your Mac" and have Joe Kissell on-line!
See this thread 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


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!!
 
GeeCON Prague 2014
 
subject: is method return type needs to implement the Serializable interface in webservice?