[JDEV] How to evolve a namespace or protocol?

Scott J Brickner sjb at instruction.com
Tue Mar 18 07:22:10 CST 2003


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

This is a general issue you have to deal with for any XML-based protocol.

Basically, when you define your original protocol, you have to build 
upgradeability into it by specifying how senders and receivers should deal 
with XML they don't recognize.

Typically, the rule is "if you don't know what it means, ignore it", which is 
the rule that Jabber includes - tags in a namespace you don't recognize 
should be ignored. If you recognize the namespace, but not the tag, it 
becomes a bit namespace dependent, and you really should be clear about the 
right behavior in your original protocol definition, but it's usually safe to 
just ignore it.

There are scenarios where this isn't quite enough - where you want to define a 
new tag that must *not* be ignored. The most widely used convention for this 
is to define a boolean attribute in the original protocol definition, 
"mustUnderstand". A receiver that sees a tag it doesn't recognize, but which 
carries the mustUnderstand='true' attribute should take some kind of error 
action (again, this should be clarified in the original protocol definition). 
This is taken from SOAP (http://www.w3.org/TR/SOAP section 4.2.3) as a 
real-world example.

In Jabber, clients are expected to ignore tags in namespaces they don't 
recognize. If you use the above rules for namespaces you define, then you can 
make a lot (maybe most) changes to your protocol in an upward compatible way.

It's also sometimes useful for communicating peers to know what version of the 
(upward-compatible) protocol the other side supports. This is commonly done 
by defining a "protocolVersion" attribute that can be attached to the 
top-level tags in your namespace.

Finally, you may come across a scenario where you just can't fit your protocol 
changes into this framework. In that case, the only safe way to communicate 
this is to change the namespace URI, which effectively means you're defining 
an entirely new protocol. Old code won't work with the new code at all.

On Monday 17 March 2003 01:23 pm, chelck at ebs.com wrote:
> A general question. Suppose I define a new message protocol and a new name
> space. I modify my Jabber server and clients to handle this protocol. I
> distribute the new client to all my customers. Later on I decide to change
> my protocol, how do I do this without breaking the existing clients in the
> field?
>
> I assume I use version numbers of some sort, but I'm not sure where or how.
> Will my message have to contain multiple versions of the same data?
>
> A real world example would be helpful.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.7 (GNU/Linux)

iD8DBQE+dx2IJX83ImdnXzwRAgr7AKDjyXpRLYf5Vr/Jw7hvbl7MRDgtLwCdEgA3
1WdLmeSoi0DZJzytlyawJcA=
=hcZg
-----END PGP SIGNATURE-----



More information about the JDev mailing list