> Peter Lang wrote: > > Hi, > > > > After investigating the Source of xmlrpc i thought i know how to use > > it... Everything work so far, but the last Step does not work. > > The line: myStruc.Value(a) has to return the result, but instead of > > giving back an int i get an RpcStruct again and again. > > > > The sample does not much useful, but when it ends it throws the following > > Errors to the Console: > > WARNING: circular references detected > > RpcStruct (1) > > WARNING: 9 allocation(s) non freed. > > > > Is there any additional Documentation i missed? > > > > > > PUBLIC SUB Main() > > > > DIM RpcF AS RpcFunction > > DIM myStruc AS RpcStruct > > DIM client AS RpcClient > > DIM hVar AS NEW Variant[] > > DIM ret AS Variant > > DIM a AS Integer > > DIM name AS String > > DIM dType AS Integer > > > > a = 0 > > > > RpcF = NEW RpcFunction("sample.sumAndDifference", [XmlRpc.xInteger, > > XmlRpc.xInteger], XmlRpc.xStruct) > > client = NEW RpcClient(RpcF) > > client.URL = "http://xmlrpc-c.sourceforge.net/api/sample.php" > > hVar.Add(5) > > hVar.Add(3) > > > > myStruc = client.Call(hVar) > > DO WHILE a < myStruc.Count > > name = myStruc.Key(a) > > dType = myStruc.dataType(a) > > ret = myStruc.Value(a) > > INC a > > LOOP > > > > END > > Peter and all, > > I think I may have found the problem, it looks like a bug in the > gb.xml.rpc component. > BUT i'm not a xml guru nor a gambas component wizard, so it could be a > bogus fix, and break things. > > Anyway with this change your example code works without errors and > returns the correct values as well ;-) > I have added some debug statements to your code to prove this, see below. > > Just change line 194 in "gambas/2.0/gb.xml/src/rpc/gb.xml.rpc/Tools.module" > from: > hAtom.Data.Add(Name, hAtom.Data, hAtom.Type) > to: > hAtom.Data.Add(Name, bAtom.Data, bAtom.Type) > > It looks like two typos to me... > > Then type sudo make install from dir "gambas/2.0/gb.xml/src/" to install > it. > > Run code: > --- > ' Gambas module file > PUBLIC SUB Main() > > DIM RpcF AS RpcFunction > DIM myStruc AS RpcStruct > DIM client AS RpcClient > DIM hVar AS NEW Variant[] > DIM ret AS Variant > DIM a AS Integer > DIM name AS String > DIM dType AS Integer > > a = 0 > > RpcF = NEW RpcFunction("sample.sumAndDifference", [XmlRpc.xInteger, > XmlRpc.xInteger], XmlRpc.xStruct) > client = NEW RpcClient(RpcF) > client.URL = "http://xmlrpc-c.sourceforge.net/api/sample.php" > hVar.Add(5) > hVar.Add(3) > > myStruc = client.Call(hVar) > DO WHILE a < myStruc.Count > name = myStruc.Key(a) > dType = myStruc.dataType(a) > ret = myStruc.Value(a) > > DEBUG "Name = " & name > DEBUG "Type = " & dType > DEBUG "Value = " & ret > > INC a > LOOP > > END > > It returns: > > MMain.Main.28: Name = sum > MMain.Main.29: Type = 0 > MMain.Main.30: Value = 8 > MMain.Main.28: Name = difference > MMain.Main.29: Type = 0 > MMain.Main.30: Value = 2 > > ;-) > > Regards, > Ron_2nd. >
Thanks for the patch. I will put it in the next commit. Regards, -- Benoît ------------------------------------------------------------------------------ Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, CA -OSBC tackles the biggest issue in open source: Open Sourcing the Enterprise -Strategies to boost innovation and cut costs with open source participation -Receive a $600 discount off the registration fee with the source code: SFAD http://p.sf.net/sfu/XcvMzF8H _______________________________________________ Gambas-user mailing list Gambas-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/gambas-user