XMLRPC-Server

classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|

XMLRPC-Server

Hans Lehmann
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
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gambas-user

XMLRPCC-0.0.9.tar.gz (17K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: XMLRPC-Server

T Lee Davidson
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
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/gambas-user
>

--
Lee
__________

"Artificial Intelligence is no match for natural stupidity."

------------------------------------------------------------------------------
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
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gambas-user
Reply | Threaded
Open this post in threaded view
|

Re: XMLRPC-Server

Hans Lehmann

Hello Lee,
> 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.
That's exactly. The missing components were added. Thanks for the hint.
The source code for the XMLRPC client and the XMLRPC server is attached.
The project works - but unfortunately not as a web service - only
locally. Where is the error? What should I do?

Sincerely
Hans

------------------------------------------------------------------------------
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
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gambas-user

XMLRPCCA-0.0.15.tar.gz (17K) Download Attachment
XMLRPCSA-0.1.1.tar.gz (17K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: XMLRPC-Server

PICCORO McKAY Lenz
2017-05-24 4:52 GMT-04:00 Hans Lehmann <[hidden email]>:

> The source code for the XMLRPC client and the XMLRPC server is attached.
> The project works - but unfortunately not as a web service - only locally.
> Where is the error? What should I do?
>
great

Excellent effort! The web services are very important for integration of
different platforms in different technologies, I will take a look to see
what I help because I need it a lot

gambas  has a great lack in this area! thanks Hans!


>
> Sincerely
> Hans
>
> ------------------------------------------------------------
> ------------------
> 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
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/gambas-user
>
>
------------------------------------------------------------------------------
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
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gambas-user
Reply | Threaded
Open this post in threaded view
|

Re: XMLRPC-Server

T Lee Davidson
In reply to this post by Hans Lehmann
On 05/24/2017 04:52 AM, Hans Lehmann wrote:

>
> Hello Lee,
>> 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.
> That's exactly. The missing components were added. Thanks for the hint.
> The source code for the XMLRPC client and the XMLRPC server is attached. The project works - but unfortunately not as a web
> service - only locally. Where is the error? What should I do?
>
> Sincerely
> Hans

Hi Hans,

The commonly used term, "web service", can be a bit misleading since not all services accessible over the web (internet) are
necessarily served by a _web_ server.

The gb.xml.rpc component is not designed to run 'through' a web server in the same manner that PHP web services do. This means
that, in this case, the RPC service cannot be called simply by fetching a file. The service must _first_ be started on whatever
machine is acting as the server. Then, a request can be made to the service, already listening on a specific port, by making a
call to it in the form of <a href="http://ip_address:port">http://ip_address:port.

(PHP scripts must be executed by a web server which means the server is already running.)

If you are wanting to be able to access an actual web service (PHP-style), then I believe you are using the wrong component(s).
In that case, you should probably use gb.web for the server side and gb.net.curl's HttpClient for the client side.

Your client/server application does indeed work just fine (even without gb.web and gb.net.curl), provided the server is started
prior to making the call.


--
Lee

------------------------------------------------------------------------------
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
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gambas-user
Reply | Threaded
Open this post in threaded view
|

Re: XMLRPC-Server

Hans Lehmann
In reply to this post by PICCORO McKAY Lenz
Hello Lee,
Hi Gerhard (PICOORO),

I have now installed a PHP XMLRPC server (version 3) on my local
Lighttpd web server - it is just a PHP file and two necessary PHPXMLRPC
libraries - and call the defined service with a Gambas XMLRPC client. It
works well.

Sincerely

Hans
------------------------------------------------------------------------------
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
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gambas-user
Reply | Threaded
Open this post in threaded view
|

Re: XMLRPC-Server

PICCORO McKAY Lenz
umm thanks for ! and tht means that a cgi based XMLRPC server may be
complicated to make..

in any case, many thanks for the files..  jajaja I feel very sorry,with
German family and I am the only one who does not speak the language

Lenz McKAY Gerardo (PICCORO)
http://qgqlochekone.blogspot.com

2017-05-25 15:13 GMT-04:00 Hans Lehmann <[hidden email]>:

> Hello Lee,
> Hi Gerhard (PICOORO),
>
> I have now installed a PHP XMLRPC server (version 3) on my local Lighttpd
> web server - it is just a PHP file and two necessary PHPXMLRPC libraries -
> and call the defined service with a Gambas XMLRPC client. It works well.
>
>
> Sincerely
>
> Hans
> ------------------------------------------------------------
> ------------------
> 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
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/gambas-user
>
------------------------------------------------------------------------------
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
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gambas-user