[Gambas-user] XMLRPC-Server

Hans Lehmann hans at ...3219...
Tue May 23 13:55:19 CEST 2017


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

-------------- next part --------------
A non-text attachment was scrubbed...
Name: XMLRPCC-0.0.9.tar.gz
Type: application/gzip
Size: 13153 bytes
Desc: not available
URL: <http://lists.gambas-basic.org/pipermail/user/attachments/20170523/48ad5ae1/attachment.gz>


More information about the User mailing list