Products

Price/Order

Support

Partners

Testimonials

Test Results

About us

Contact
 XML-RPC function parameters
Bottom
 
Total posts: 3
 Author XML-RPC function parameters
Jonathan Neve

25.10.2006 07:23:14
Registered user
Hello!

First of all, thanks a lot for implementing the XML-RPC transport, which opens many possibilities for using RTC in situations where it couldn't otherwise be used. For example, my situation at present is that I have an Apache Java XML-RPC implementation running on Linux on the server side, and a Windows / C++Builder application running on the client side (I also have some PHP pages calling the XML-RPC functions). Up to now I've been using DXML-RPC, which is an opensource implementation of XML-RPC for Delphi -- decent, but rudimentary, and no support. Now I'm going to be able to use RTC, which is much more enjoyable to use, yet using the standard XML-RPC format means that I should be able to seemlessly communicate with my Java code without changing anything on the server. That's the beauty of XML-RPC: since it's standard, there are implementations in many (most) programming languages, and they are all totally interoperable! :) So anyway, thanks again!

Now, my question is the following: RTC has the concept of named parameters to function calls. XML-RPC, as far as I know, has no such concept: the parameters must simply be in the right order. So how can I use RTC to call an XML-RPC function? In other words, which parameters names should I use? Will the parameter names simply be ignored? If so, can I be sure that my parameters will be kept in the same order I put them in? Or should I rather call the parameters 1, 2, 3... N in the order in which they are supposed to appear?

Thanks in advance,
Jonathan Neve.
Danijel Tkalcec [RTC]

25.10.2006 11:54:51
Registered user
Yep, XML-RPC function call parameters are sent in a list, where order is important, but no names are assigned, while RTC uses names for all parameters.

To make the communication between RTC Clients and Servers compatible even when using XML-RPC, all parameters will be packed into a <struct>. So, if you simply assign parameters using names in RTC, name information will be preserved and the other side will receive everything in a single <struct>. Using the same analogy, when a non-RTC app wants to call a remote function written with RTC by using names, it will send all parameters in a <struct> (using parameter names).

On the other hand, when you want to call remote functions written by Servers which expect all parameters to be received in an ordered list without names, you will pack the data in an array called "params" (newArray['params']). Elements in RTC arrays start from index 0, so your first parameter has to be at index 0, too. Using the same analogy, when a non-RTC client sends you parameters in a list without names, you will receive it as an array called "params" (asArray['params']), where the first parameter will be at index 0.

A lot of implementations have chosen to use named parameters instead of a parameter list wen sending data over XML-RPC, in which case they are pacing all parameters in a single <struct>, same as RTC. I think there is a Java implementation which does that, too.

PS. I have just posted a short FAQ topic about XML-RPC with RTC SDK, you may be interested in checking it out: XML-RPC vs. RTC format

Best Regards,
Danijel Tkalcec
Jonathan Neve

25.10.2006 12:43:46
Registered user
Thanks for your answer, that makes it clear. I'll just pack them into a "params" array then, and that should do the trick.

As you say, this does depend on the server implementation. In my case, I'm using the Java Apache implementation (which uses reflexion to find the remote functions, which means that I have no control over it on the server side), so I'll have to stick with ordered parameters. I do want my client code to be compatible with other servers too (I'm writing an RTC transport for CopyCat), so I think I'll make it an option.