Then, let's create a Groovy Web Service
Running WSPublisher will start up an instance of Jetty and publish your newly created web service. To check that everything is running smoothly, try accessing WSDL
http://localhost:6980/SimpleService?WSDLYou should get back an XML document. Now, once your simple web service is running, let's create a simple Flex consumer. Assuming you already have a Flex project setup, let's start by declaring a web service
Notice WSDL url parameter and operation 'name' tag, which point to Java 'getMsg' method. The rest of attributes define web service id and respective callback functions, declared like this
Last step is to create a simple button that would trigger the call
Now, run your Flex project and you should see a single button on the screen.
If you've done everything correctly, pressing the button will fetch "Hello World from Flex/Java communication!" string and display it in a pop up window
That is it! Now you can use your existing Java server code and still have a slick Flex based user interface. Here is a JavaWorld article that goes further into Java EE/Flex combination. Hope you find this post useful. Happy Flexing!