Remote Procedure Calls with PureBasic

Share your advanced PureBasic knowledge/code with the community.
Foz
Addict
Addict
Posts: 1359
Joined: Tue Nov 13, 2007 12:42 pm
Location: Manchester, UK

Remote Procedure Calls with PureBasic

Post by Foz »

Well, having a break away from it certainly brought me back with a fresh look at it, and here is a rudimentary version:

http://www.shadowtavern.com/code/remoting.zip

When I've rested a bit, I'll write up how it works, but briefly, on the client side, add the procedure that is to be called in "client include.pb". The trick for the client side is:

Code: Select all

XMLRPC_MethodCall("MethodName", "pb type" + "pb value" [, "pb type" + "pb value", ...]
This will allow fora method to be called with up to 20 paramters.

On the server side, there are two files to update.
"server procedures.pb" are the actual procedures that will be executed on the server, just treat it like a normal procedure.
"server xml params.pb" is the trick, there is procedure called "ExecuteXML". This has the select case statement for each procedure, typing the parameters and handles the response.

Code: Select all

    Case "AddIt"
      Protected result.l = AddIt(Val(mc\Parameter[0]), Val(mc\Parameter[1]))
      XMLRPC_MethodResponse(ClientID, "l", Str(result))
Enjoy!
~ Foz
Fred
Administrator
Administrator
Posts: 18252
Joined: Fri May 17, 2002 4:39 pm
Location: France
Contact:

Post by Fred »

Looks interesting, would be cool to be SOAP compatiable ;)
User avatar
Rook Zimbabwe
Addict
Addict
Posts: 4322
Joined: Tue Jan 02, 2007 8:16 pm
Location: Cypress TX
Contact:

Post by Rook Zimbabwe »

Yes, that would open up a lot of coding opportunities for many of us. SOAP is OK! 8)
Binarily speaking... it takes 10 to Tango!!!

Image
http://www.bluemesapc.com/
Foz
Addict
Addict
Posts: 1359
Joined: Tue Nov 13, 2007 12:42 pm
Location: Manchester, UK

Post by Foz »

sorry to disappoint, but I have no plans for implementing SOAP. I barely had the patience to do XMLRPC - which I did to give me an easy to debug view of the messages.

I'll finish implementing the XMLRPC types, and then I'll move onto a binary formatter, complete with compression.

This is really just a library that is going to help me to start on my main project - but one step at a time. :D
Mistrel
Addict
Addict
Posts: 3415
Joined: Sat Jun 30, 2007 8:04 pm

Post by Mistrel »

This is pretty cool. Awsome work, Foz. :)
Foz
Addict
Addict
Posts: 1359
Joined: Tue Nov 13, 2007 12:42 pm
Location: Manchester, UK

Post by Foz »

Does anyone here have experience with SOAP?

I'm after how the messages are formed and look.

If I can get some examples and it's simple enough, I'll change the XMLRPC to SOAP. Or maybe someone else wants to have a crack at writing it? If so, let me know.
Foz
Addict
Addict
Posts: 1359
Joined: Tue Nov 13, 2007 12:42 pm
Location: Manchester, UK

Post by Foz »

I've done as much as I need to so I can start my actual project.

I've updated the download, and it now has the ability to deal with arrays, using the XMLRPC_Encode_Array<type> and XMLRPC_Decode_Array<type>.

At some point in the future I'll add failure responses and maybe structures if I can get my head around the "how".

I hope this is useful to some people :)
Post Reply