Re: [Mono-list] Xml-rpc.net problem with mono

2005-05-16 Thread Greg Hamilton
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:

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  -  Mono-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-list


[Mono-list] Xml-rpc.net problem with mono

2005-05-13 Thread Rohit
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:



using System;
using CookComputing.XmlRpc;
struct sumdiff {
  public int sum;
  public int diff;
}
[XmlRpcUrl("http://www.cookcomputing.com/sumAndDiff.rem";)]
class sumdiffproxy: XmlRpcClientProtocol {
  [XmlRpcMethod("sample.sumAndDiffernce")]
  sumdiff calc(int x,int y) {
return (sumdiff)Invoke("SumAndDifference",new Object[]{x,y});
  }
  public static void Main() {
sumdiffproxy s=new sumdiffproxy();
sumdiff v=s.calc(4,5);
Console.WriteLine(v.sum);
Console.WriteLine(v.diff);
  }
}


I compiled the above program with : 'mcs /r:CookComputing.XmlRpc.dll sumdiff.cs'

But when I run the program I get the following errors: 



Compat mode: the request from
/usr/lib/mono/gac/CookComputing.XmlRpc/0.9.1.0__a7d6e17aa302004d/CookComputing.XmlRpc.dll
to load System was remapped (http://www.go-mono.com/remap.html)
Compat mode: the request from
/usr/lib/mono/gac/CookComputing.XmlRpc/0.9.1.0__a7d6e17aa302004d/CookComputing.XmlRpc.dll
to load System.Web was remapped (http://www.go-mono.com/remap.html)

Unhandled Exception: System.Exception: Invoke on non-existent or
non-public proxy method
in <0x00074> CookComputing.XmlRpc.XmlRpcClientProtocol:GetRpcMethodName
(object,string)
in <0x0004e> CookComputing.XmlRpc.XmlRpcClientProtocol:MakeXmlRpcRequest
(System.Net.WebRequest,string,object[],object)
in <0x000b7> CookComputing.XmlRpc.XmlRpcClientProtocol:Invoke
(object,string,object[])
in <0x00013> CookComputing.XmlRpc.XmlRpcClientProtocol:Invoke (string,object[])
in <0x0006b> (wrapper remoting-invoke-with-check)
CookComputing.XmlRpc.XmlRpcClientProtocol:Invoke (string,object[])
in <0x0008c> sumdiffproxy:calc (int,int)
in <0x0007d> (wrapper remoting-invoke-with-check) sumdiffproxy:calc (int,int)
in <0x0004f> sumdiffproxy:Main ()




Is the problem with my program or the way I built the package.
Thanks for any help
Rohit
-- 
http://www.geocities.com/rohitkkumar
___
Mono-list maillist  -  Mono-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-list