I had some interesting problems the other week while working on some Model-Glue (gesture) RemoteService requests. I had posted to the Model-Glue Google Group about a few things I ran into when using the AbstractRemotingService.cfc, and getting url variables to work properly through the service, which they have addressed (Thank you!).
Obviously you need to read the wiki documentation first.
When you Create your RemoteService.cfc that exists at the root of your application, which will be your remoting front controller if you will, you need to tell it where your main model-glue template file is located. (download the zip file from www.model-glue.com and find the modelglueapplicationtemplate directory for the sample RemotingService.cfc)
Once you have a simple working version up / running by calling /RemotingService.cfc?method=executeEvent&event=my.event&format=json and pass in the data you need to, then you need a good way to test it right? If you use MXUnit then you have more than likely configured your IDE to execute these tests.
Figure 1.0
ISSUE:
The thing I ran into was that I was using model-glue's event security where I could specify certain events to be 'authentication' needed etc. My remoting service was calling an event that required prior authorization (i.e. session.isLoggedin() or some other means). Now, when I executed a test for this event in mxUnit through the Eclipse plugin for mxunit, it would Fail the test and kept telling me I was unauthorized to execute this event etc, and return the source code for my login screen instead (which would be correct if I was not logged in). However in my unit Test, I was making sure to Call my AuthorizationFacade and log me in in the 'setup' method and verified that 'isLoggedIn()' returned true.
RESOLUTION:
So in my unit test I am doing a cfhttp 'post' (or now that they supported url variables better in the service a 'get' ) request to the RemoteService.cfc passing in my data. HOWEVER, I needed to also pass in the following through my cfhttp call:
<cfhttpparam ....="formfield" name="CFIDE" value="#cookie.CFIDE#">
<cfhttpparam ....="formfield" name="CFTOKEN" value="#cookie.CFTOKEN#">
<cfhttpparam ....="formfield" name="JSESSIONID" value="#session.sessionid#">
Once this was in place, the calls worked as expected, and returned proper json data.