I'm developing a XML-RPC service in C# using the XML-RPC.NET library. The service will be used to expose a forum to Tapatalk users
The Tapatalk API documentation states which methods should be implemented. Sometimes a parameter is specified as optional.
E.g. get_topic
has 4 parameters: forum_id
, start_num
, last_num
and mode
The method is invoked by the Tapatalk app with either all parameters or only the first 3 (so mode
is omitted).
I defined the methods as follows:
[XmlRpcMethod("get_topic"]
public GetTopicResult GetTopic(string forum_id, int? start_num, int? last_num, string mode)
When the method is invoked with all 4 parameters specified all goes well. When mode
is omitted I get the following error: Request contains too few param elements based on method signature.
Specifing mode as an optional parameter doesn't seem to do the trick:
[XmlRpcMethod("get_topic"]
public GetTopicResult GetTopic(string forum_id, int? start_num, int? last_num, string mode = "")
Trying to overload the method results in this error: Method GetTopic in type Mobiquo has duplicate XmlRpc method name get_topic
[XmlRpcMethod("get_topic"]
public GetTopicResult GetTopic(string forum_id, int? start_num, int? last_num)
[XmlRpcMethod("get_topic"]
public GetTopicResult GetTopic(string forum_id, int? start_num, int? last_num, string mode)
Any idea how I specify a parameter as optional?
Niels
Does this help? Justing getting into the world of xml-rpc myself.
http://xml-rpc.net/faq/xmlrpcnetfaq-3-0-0.html#1.15
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With