I am working with XE7 on a Datasnap server application. I am using REST in this setup, opting away from the TCP/IP setup for now. I have no problems getting things to work using URL segmented parameters such as talked about on the Datasnap REST Messaging Protocol page (http://docwiki.embarcadero.com/RADStudio/XE7/en/DataSnap_REST_Messaging_Protocol)

I am working with XE7 on a Datasnap server application. I am using REST in this setup, opting away from the TCP/IP setup for now. I have no problems getting things to work using URL segmented parameters such as talked about on the Datasnap REST Messaging Protocol page (http://docwiki.embarcadero.com/RADStudio/XE7/en/DataSnap_REST_Messaging_Protocol)

What I am having trouble with is when using GET query parameters like this...  

  datasnap/rest/MyClass/MyMethod?p1=value1&p2=value2

When doing this, the parameters in the method have default values, but I can look up the parameters and their values using GetInvocationMetadata().QueryParams. That is quite confusing. I assume Datasnap is using the method signature for routing, but the parameters themselves are ignored the lookup has to be done.

Now that I think about it, Datasnap probably does not use method signatures for routing, because I believe you must have unique method names for all public methods in your ServerMethods class. 

Is this in fact what is going on or am I missing something?

What is the best way to handle both ways of calling a method in case where someone could call it using URL segmented parameters or someone else might call it with query parameters in the URL?

Comments