views:

163

answers:

2

When using an IPC library, it is important that it provides the possibility that both client and server can communicate even when their version of the API differs. As I'm considering using SOAP for our client/server application, I wonder whether a SOAP/WSDL solution can deal with API changes well.

For example:

  • Adding parameters to existing functions
  • Adding variables to existing structs that are used in existing functions
  • Removing functions
  • Removing parameters from existing functions
  • Removing variables from existing structs that are used in existing functions
  • Changing the type of a parameter used in an existing function
  • Changing the order of parameters in an existing function
  • Changing the order of composite parts in an existing struct
  • Renaming existing functions
  • Renaming parameters

Note: by "struct" I mean a composite type

+2  A: 

It doesn't. You'll have to manage that manually somehow. Typically by creating a new interface as you introduce major/breaking changes.

More generally speaking, this is an architectural problem, rather than a technical one. Once an interface is published, you really need to think about how to handle changes.

troelskn
+2  A: 

AFAIK there is not such stuff as per the SOAP/WSDL standard. But tools exists to cope with such issues. For instance, in Glassfish you can specify XSL stylesheet to transform the request/response of a web service. Other solution such as Oracle SOA suite offer much more elaborated tools to manage versioning of web service and integration of component together. Message can be routed automatically to different version of a web service and/or transformed. You will need to check what your target infrastructure offers.

EDIT:

XML and XSD is more flexible regarding evolution of the schema than types and serialization in object-oriented languages. Some stuff can be made backward compatible by simply declaring them as optional, e.g.

  • Adding parameters to existing functions - if a parameter is optional, you get a null value if the client doesn't send it
  • Adding variables to existing structure that are used in existing functions - if the value is optional, you get null if the client doesn't provide it
  • Removing functions - no magic here
  • Removing parameters from existing functions - parameters sent by the client will be superfluous according to the new definition and will be omitted
  • Removing variables from existing structure that are used in existing functions - I don't know in this case
  • Changing the type of a parameter used in an existing function - that depends on the change. For a simple type the serialization/deserialization may still work, e.g. String to int.

Note that I'm not 100% sure of the list. But a few tests can show you what works and what doesn't. The point is that XML is sent over the wire, so it gives some flexibility.

ewernli
"no magic here": You're right :D
Dimitri C.
Thanks a lot for your answer! However, I suddenly realized I forgot to mention two additional cases: renaming functions and renaming parameters. Do you know what happens in those cases?
Dimitri C.
In this case the XML will be incompatible, so it won't work. I think you will need to transform the message, e.g. with XSLT.
ewernli
But if you swap the order of two parameters, your web service is still compatible, which would not be the case of the Java or .NET interface.
ewernli
"swap the order of two parameters": indeed; another one I forgot to mention :s
Dimitri C.
You are only talking about the "newer" side of the API, how about the "older"? Is there a practice for a SOAP endpoint handling additional unknown tags in a request (or SOAP client and response)?
Mirvnillith
@Mirvnillith There's a symmetry between old and new API: what's added on one side can be considered as removed on the other, and vice versa. So, the old API that need to handle unknown tag corresponds to point 4) Removal of parameters. That's implementation specific, but some implementation will simply ignore them.
ewernli