Chapter 50. Integrating Flex and Java

This chapter explores more deeply into Flex RPC services, focusing on using Flex's WebService class to connect to a SOAP-based Web Service written with Java using the Grails framework. The Grails framework is an agile web development platform very similar to Ruby on Rails, except that it runs on the Java VM, which many enterprises already support in their data centers. Grails is based on the Groovy Java language extensions, which bring a lot of dynamic language syntactical sugar to the Java runtime, increasing developer productivity. With Grails, Groovy, and an XFire plug-in, which exposes Java objects at Web Services, you can create Web Services that are easily accessed from Flex applications in no time.

Building on the previous chapter's HTTPService sample, we're going to build this chapter's RPC communication with typed Web Services. While developing custom server messaging formats in pure XML is simple, it offers no runtime type-checking. The more complex the messages are that go back and forth, the more useful it becomes to have Web Services defined using WSDL (Web Services Description Language). In addition, this chapter's sample code will advance the Flex client design by breaking all the service layer calls into their own class, separating the view functionality out — a practice that you'll want to employ as the services you call increase in number and complexity. Plus, it's a stepping stone to using a full-blown Flex framework, like ...

Get Professional Adobe® Flex® 3 now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.