5

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

Community
  • 1
  • 1
Niels R.
  • 7,260
  • 5
  • 32
  • 44

1 Answers1

1

Does this help? Justing getting into the world of xml-rpc myself.

http://xml-rpc.net/faq/xmlrpcnetfaq-3-0-0.html#1.15

Scott Decker
  • 4,229
  • 7
  • 24
  • 39
  • 1
    I checked out the FAQ first thing, but this is for optional mapping of parameters of a response struct (if I understand it correctly). – Niels R. Apr 11 '14 at 07:57