Grails, BlazeDS, Flex and method overloading

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Grails, BlazeDS, Flex and method overloading

Sebastien ARBOGAST
Hi everyone,

Since my Grails BlazeDS plugin is not working with Grails 1.3 (it worked great with 1.2) and I can't figure out why Flash Builder won't see the services exposed, I'm trying to rewrite a new cleaner version of it that would not require any flex-servlet.xml configuration file.
So here is the relevant part of my plugin descriptor in order to try and reach that goal:

def doWithWebDescriptor = { xml ->
        //listeners
        def listeners = xml.listener
        listeners[listeners.size() - 1] + {
            listener {
                'listener-class'('flex.messaging.HttpFlexSession')
            }
        }

        //servlets
        def servlets = xml.servlet
        servlets[servlets.size() - 1] + {
            servlet {
                'servlet-name'("flex")
                'display-name'("Spring-Flex Dispatcher Servlet")
                'servlet-class'(DispatcherServlet.name)
                'init-param' {
                    'param-name'('contextAttribute')
                    'param-value'('org.springframework.web.servlet.FrameworkServlet.CONTEXT.grails')
                }
                'load-on-startup'("1")
            }
            servlet {
                'servlet-name'("RDSDispatchServlet")
                'display-name'("Flash Builder wizard helper")
                'servlet-class'(FrontEndServlet.name)
                'init-param' {
                    'param-name'("messageBrokerId")
                    'param-value'("_messageBroker")
                }
                'init-param' {
                    'param-name'("useAppserverSecurity")
                    'param-value'("false")
                }
                'load-on-startup'("10")
            }
        }

        //servlet-mappings
        def servletMappings = xml.'servlet-mapping'
        servletMappings[servletMappings.size() - 1] + {
            'servlet-mapping'(id: "RDS_DISPATCH_MAPPING") {
                'servlet-name'("RDSDispatchServlet")
                'url-pattern'("/CFIDE/main/ide.cfm")
            }
            'servlet-mapping' {
                'servlet-name'("flex")
                'url-pattern'("/messagebroker/*")
            }
        }
    }

    def doWithSpring = {
        xmlns context: "http://www.springframework.org/schema/context"
        xmlns flex: "http://www.springframework.org/schema/flex"

        autoProxyCreator(AnnotationAwareAspectJAutoProxyCreator) {
            proxyTargetClass = true
        }

        flex.'message-broker'()

        if (application.serviceClasses) {
            application.serviceClasses.each { service ->
                def srvClass = service.getClazz()
                def exposes = GrailsClassUtils.getStaticPropertyValue(srvClass, 'expose')
                if (exposes?.contains('blazeds')) {
                    def serviceName = service.propertyName
                    flex.'remoting-destination'(ref: "${serviceName}")
                }
            }
        }
    }

Then I have developed this very simple service

class EchoService {

    static transactional = true

    static expose = ["blazeds"]

    String echo(String message) {
        return message.reverse()
    }
}

Then I created a simple Flex project in Flash Builder, and I used the "Connect to Data/Service..." wizard in order to generate client stubs for this service.
I can see my service in the list. But then when I hit "Finish", I get an error message saying "EchoService contains overloaded method and is not supported for introspection".

I have tried asking the question on Adobe forums (http://forums.adobe.com/message/2976940#2976940) but no one could answer.
I think the current version of my plugin exposes a proxy of my service, which would be why Flash Builder does not complain. But yet again, this doesn't work with Grails 1.3.x

Does anyone have an idea of how I could work around what seems to be a limitation of FlashBuilder using only Grails and some Spring/proxy trickery?
Any other idea how I could make this work?

Please, I'm desperate. I really need to make this plugin work.

Best regards,
Sébastien Arbogast