Maybe you can find this post useful:
https://groups.google.com/forum/#!topic/mgwt/8WOo00f_L2A
Anyway, if you can use other mechanism for communication client-server I'd suggest you REST-JSON taking advantage of RequestBuilder (official doc here). I used it, and it worked without problem.