[Gambas-user] XmlRpc
Ron
ron at ...1740...
Tue May 19 19:51:06 CEST 2009
Jesus Guardon schreef:
> Hi all
>
> Anyone has been using XmlRpc component of Gambas?
> No documentation already done for it, and I need to communicate with
> another app via this protocol.
> At a first glance, I'm unable to understand how to use, any help please?
>
> Using Gambas2 - 2.12.0 on Ubuntu 8.10
>
> Regards
>
> Jesus
>
>
Hi,
Yes I'm using the server part, I talk to it with PHP 5 xmlrpc.
Look here for the server part:
http://www.domotiga.nl/projects/domotiga/browser/trunk/DomotiGa/CXMLRPC.class
This is a _very raw_ client example:
---
' 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.
More information about the User
mailing list