[Gambas-user] XMLRPC-Server
T Lee Davidson
t.lee.davidson at ...626...
Tue May 23 20:59:31 CEST 2017
Hello Hans,
RpcServer.Listen relies on ServerSocket which is part of the gb.net component. The documentation does not specify that gb.net is
required for gb.xml.rpc, but it apparently is.
On 05/23/2017 07:55 AM, Hans Lehmann wrote:
> Hello,
>
> I'm currently experimenting with the gb.xml.rpc component. An XMLRPC client works well (see archive attached). Now I would like
> to offer on the installed Web server Lighttpd (under Mint 17.1) a webservice (XMLRPC server) and via the XMLRPC client call. The
> following source code for the XMLRPC server provides an error in line ***. Can someone help me?
>
> Hans
>
> ' Gambas module file
>
> Public hXMLRPC As RpcServer
>
> Public Sub Main()
>
> Dim hXMLRPCFunction As RpcFunction
> Dim iXMLRPCPort, iXMLRPCServerMaxConnections As Integer
>
> hXMLRPC = New RpcServer As "hXMLRPC"
> iXMLRPCPort = 9009
> iXMLRPCServerMaxConnections = 1
>
> hXMLRPCFunction = New RpcFunction("add2integer", [XmlRpc.xInteger, XmlRpc.xInteger], XmlRpc.xInteger)
> ' hXMLRPCFunction.Help = ("Addition of 2 integers")
> hXMLRPC.Register(hXMLRPCFunction)
>
> Try hXMLRPC.Listen(iXMLRPCPort, iXMLRPCServerMaxConnections) ' ***
> If Error Then
> Print "Error-Text: " & Error.Text & gb.NewLine & "Error-Location: " & Error.Where
> hXMLRPC.Stop()
> Endif
> If hXMLRPC.Listening Then
> Print "The XMLRPC server listens for port " & Str(iXMLRPCPort)
> Endif
>
> End
>
> Public Sub hXMLRPC_RemoteCall(sMethod As String, aParameters As Variant[])
> Select Case sMethod
> Case "add2integer"
> Sum(aParameters)
> End Select
> End
>
> Public Sub Sum(aParameters As Variant[])
> hXMLRPC.SetReply(aParameters[0] + aParameters[1]) hXMLRPC.Stop()
>
> End
>
>
>
> ------------------------------------------------------------------------------
> Check out the vibrant tech community on one of the world's most
> engaging tech sites, Slashdot.org! http://sdm.link/slashdot
>
>
>
> _______________________________________________
> Gambas-user mailing list
> Gambas-user at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/gambas-user
>
--
Lee
__________
"Artificial Intelligence is no match for natural stupidity."
More information about the User
mailing list