Rohit wrote:
Hello,
I downloaded the XML-RPC implementation for .NET from www.xml-rpc.net
. I can't make it work. I built it using nant I can even successfully
compile programs with it. This is the example program which I am
trying to run:


<snip>

Is the problem with my program or the way I built the package.
Thanks for any help
Rohit

From the traceback it looks like your program is connecting to the XML-RPC server but the method you want to invoke is not known by the server. Probably something to do with case sensitivity or namespace.


I downloaded the package from http://www.xml-rpc.net. No need to build it as there are pre-built dll files in the bin directory which seem to work fine with mono.

So I built your example and couldn't figure out why it didn't work and after some swearing I delved into the docs and found XmlRpcProxyGen which will create a callable proxy from an interface. Pretty neat. Try this.....


using System; using CookComputing.XmlRpc;

struct SumAndDiff {
    public int sum;
    public int difference;
}

[XmlRpcUrl("http://www.cookcomputing.com/xmlrpcsamples/math.rem";)]
interface IMath
{
    [XmlRpcMethod("math.Add")]
    int Add(int a, int b);
    [XmlRpcMethod("math.Divide")]
    int Divide(int a, int b);
    [XmlRpcMethod("math.Multiply")]
    int Multiply(int a, int b);
    [XmlRpcMethod("math.Subtract")]
    int Subtract(int a, int b);
    [XmlRpcMethod("math.SumAndDifference")]
    SumAndDiff SumAndDifference(int a, int b);
}


class Test { static void Main() { IMath mathProxy = (IMath)XmlRpcProxyGen.Create(typeof(IMath));

        Console.WriteLine("5 + 4 = {0}", mathProxy.Add(5, 4));

        SumAndDiff sumAndDiff = mathProxy.SumAndDifference(10, 15);
        Console.WriteLine("Sum = {0}, Difference = {1}",
                          sumAndDiff.sum, sumAndDiff.difference);
    }
}
_______________________________________________
Mono-list maillist  -  [email protected]
http://lists.ximian.com/mailman/listinfo/mono-list

Reply via email to