Statefull CRM API?
We've been wrestling with the whole "what happens if" problem since long
before we started coding V1. That's part of the reason that we ended up
using XML strings as parameters. It's not a great solution from a
programming and type-safety standpoint, but it does work.
Here's my take on the subject. If your customer has made a schema
modification either before of after you've built an add-on component then
there's a 0% chance that your code depends on it or else you would have
added the modification. The way the XML serializers work today is that
they'll ignore any additional attributes (unless you add an xs:any element
to the schemas, in which case the extras will end up in a language- and
framework-dependent collection of unknown elements). This is good news for
both the client and the server code.
Assume for now we have a programming environment like the sample code where
the client and server are dealing with XSD-derived type-safe classes. On the
server we'll receive an instance of a subclass of businessEntity. When the
serializer turns this into a string that the wrapper service hands to the
platform, it'll simply take the "extra" attributes which were unknown at
compile time (service compile, not platform compile - the platform is
already "safe" from extra attributes) and turn them into XML. The wrapper
will pass that string to the platform which will shred it into an internal
format, do the reqested work, and return. On the way "out" of the platform
during a Get or GetCollection, the wrapper will pass the request to the
appropriate platform Retrieve* or Query method and get back a string. The
wrapper will pass that string, and the appropriate System.Type to the
serializer, which will turn it into an object instance. The extra attributes
will end up in a collection of XmlElement that will in turn get sent to the
client.
On the client side, if your code didn't originally know about some set of
attributes then it won't need to access them in a type-safe manner. Your
client code is safe from customizations that were done outside of the
development of you custom client code. If you have extra attributes then
you'll have a class definition which includes those attributes. That class
will properly serialize because the client-side code knows all about the
extra bits - in fact, to your custom code these aren't even extras, they're
expected values.
Of course you always have the option to recompile the whole wrapper and the
client code once you've made your customizations.
--
Mj Miller
Technical Lead
Microsoft CRM
This posting is provided "AS IS" with no warranties, and confers no rights.
|