SOAP + Flex => SchemaTypeRegistry
There’s a Flex 3 feature that seems to have been unnoticed: the possibility to receive strongly typed objects from a SOAP service as we could do through the AMF protocol. Everything is done in the singleton class SchemaTypeRegistry. We just have to give the received object name, its namespace in the SOAP envelope and the destination class. A short example is better than a long speech: try to imagine that we want to map an object called user with the namespace http://www.matsiya.fr/user to the User class. We have just to add in the application (mapping will then concern all the services):
SchemaTypeRegistry.getInstance().registerClass(new QName("http://www.matsiya.fr/user", "user"), User);
It’s also possible to define the SchemaTypeRegistry for a specific operation into the XMLDecoder:
var sr:SchemaTypeRegistry = new SchemaTypeRegistry(); sr.registerClass(new QName("http://www.mastiya.fr/user", "user"), User); op.decoder.typeRegistry = sr; //op étant notre operation
It’s strange that Adobe don’t communicate on this feature, the documentation is virtually inexistent and especially on all that could concern XMLDecoder. Unfortunately, this method can just be used with SOAP services, to my knowledge it’s impossible to force the decoding of an external XML file or a REST service result through the XMLDecoder.




