Last time I had to work with web services, ActionScript2 was still hot stuff. Handling complex data was an absolute pain, mainly because of the woefully primitive XML implementation of AS2. Manually looping through children’s lists is not my idea of fulfilling programming tasks. Not that I realised how bad it was until AS3 showed up with E4X. “You mean I can just read the XML like an object or array? No way, that’s sci-fi!”
It was with a great deal of apprehension that I started on a new project that required integration with an external web service. But it turned out to be an absolute breeze. A small, hitherto ignored, menu item called “Data: Import Web Service (WSDL)” turned out to be very close to magic and became my new best friend.
Import Web Service takes an URI to the WSDL (web service definition language), loads and parses it and then lets you choose the methods you want to generate code for. It creates complete proxies with typed data classes for both in- and output. You can reload and regenerate classes if the web service changes, and you can add and remove methods at any time. All the generated code is accessible and well documented – although all is well documented with examples in the Flex help, I didn’t need more than the comments in the generated code.
I’m not claiming to have made a big discovery here, after all it’s part of the standard Flex Builder. But it just works so much better than I expected. Web Services have gone from being a royal pain to the easiest and most structured way of communicating with the server.