Re: Exchanging information
- From: Roedy Green <see_website@xxxxxxxxxxxxxxxxxxxx>
- Date: Sat, 28 Jul 2007 07:47:19 GMT
On Fri, 27 Jul 2007 19:31:19 GMT, Haggis McMutton
<haggis@xxxxxxxxxxxxx> wrote, quoted or indirectly quoted someone who
said :
I want to extend this to something a bit more advanced. I was thinking of
using XML but someone said I should use SOAP, but that uses HTTP which
seems to complicate things. Any ideas on the best way to do this?
The problem with a roll your own protocol is you are constantly
tinkering with it. It is endless busywork adding new fields and
adjusting the "parser". It gets hairy as soon as you have any sort of
nested or array data.
The problem with serialised objects is both ends have to be running
the exact same version of the class files. On the plus side, if you
compress the stream, you get a quite compact binary stream. You can
send arbitrary trees of data, without any coding. On the downside, it
is very easy to send all kinds of crap tacked onto your tree you did
not intend. I like to look at my streams with a hex editor to see
what classes are in there. If I see any I did not expect I know I have
inadvertently included something.
One trick I have taken in putting the serial UID of the most crucial
class in the Long at the head of the stream. You can always read
this, then give a reasonable error message if it is not what you
expected.
The biggest problem with serialised objects is they go stale the
instant you change your source code. They are not good for long term
storage. You must be able to recreate them after source code changes.
Writing code to upgrade a object file is quite tricky.
SOAP helps you waste bandwidth if you have invested in companies like
AT&T and Cisco. Amazon offers a SOAP interface which can be
considered somewhat language agnostic. It can't see any advantage to
a pure Java implementation.
--
Roedy Green Canadian Mind Products
The Java Glossary
http://mindprod.com
.
- References:
- Exchanging information
- From: Haggis McMutton
- Exchanging information
- Prev by Date: Re: Exchanging information
- Next by Date: Re: JMF and client side Applet problem
- Previous by thread: Re: Exchanging information
- Next by thread: Pixelgrabber and Vectors, changes not happening.
- Index(es):
Relevant Pages
|