[REBOL] Re: SOAP
From: m:koopmans2:chello:nl at: 12-Jun-2001 11:20
> Automation is good! As for me, I only started looking at
> SOAP last night after reading Chris Double's message about
> SOAP and SMS, and thought I could modify my existing code to
> send a SOAP header. I was a little surprised it worked <g>.
> So what you see is all I've done.
OK, I'll pick it up (or actually, I've already done that). But as I'm
finishing a project and have aholiday planned it may take some time.
> I do note that many SOAP services exist on ports other than
> 80 which means more changes ...
>
I actually plan to modify the http scheme a bit to use SOAP. With help
from Scott and Sterling I already can send arbitrary header info, and I
got the forwarding bug out, so...
> > Another thing I'd like to do is expose rugby services as
> > SOAP. So you can
>
> I don't really understand rugby. Would you explain what it
> does in mono syllables, or present an example of how it can
> be used?
Rugby, my pride! Rugby is a middleware vendor's nightmare come true ;-)
Say you have a service that you want to be available on a network to other
Rebol processes.
And it needs to perform rather well, and you don't want to write all the
communication software.
You'd use rugby or something like that.
A quick example: you have this encridble poweful function that when given
two numbers returns the greatest.
maximize: func [ x1 [integer!] x2 [integer!] [ ...]
Being the nice guy that you are you decide to make this available to all
other Rebolians.
So you type in the console:
>>do %rugby_server.r
>>serve [ maximize ] ;add any function to this list you like
On the other side of this planet I want to use this incredible powerful
service in my app:
>>do %rugby_client.r
>>p: make port! tcp://www.compkapori.co.nz:8001
>>rexec/with [ maximize 15 10 ] p
>>15
And there are some nifty refinements of course!
rexec/oneway [ ... ] ;don't wait for the result
rexec/deferred [ ...] ;don't wait but check later using....
poll-for-result id; Is there a result for request identified by id? return
false or the result
wait-for-result id; Wait for a result (blocking)
As a service provider you decide to make money with this service. So only
people who paid
can use this superb utility! You limit access on Ip basis:
>> serve/restrict [maximize] [24.32.6.244] ; allows access to 24.32.6.244
only, add IP numbers as desired
Note that Rugby does message integrity as well. I am currently adding
automatic handshaking for encryption levels,
for /Pro /Command users.
Get the picture? Now that's why SOAP feels cumbersome IMHO.
You can download rugby from www.erebol.com/downloads/
One more example, a simple chat server with rugby.
First, the server:
REBOL [ Title: {Rugby chat server}]
do %rugby_server.r
messages: make block 600
msg-id: 0
add-message: func [ msg [string!]]
[
msg-id: msg-id + 1
append messages msg-id
append messages msg
return true
]
get-messages: func [ id [integer!] /local my-msg]
[
my-msg: copy select messages id
return my-msg
]
serve [add-message get-messages]
;************************************
And now the client:
REBOL [ Title: {Rugby chat client}]
do %rugby_client.r
last-msg-id: 1
send-message: func [msg [string!]]
[
rexec/oneway compose [add-message (msg)]
]
get-messages: func [ id [integer!] /local r-msg msg]
[
msg: make block!
r-msg: rexec compose [get-messages (id) ]
foreach entry r-msg
[
if string? entry [append msg entry]
]
last-msg-id: first skip tail r-msg -1 ;Gets the last retrieved msg-id
return copy msg
]
;***********************
Ok, I used more than one syllable occasionally.
Time to stop the shameless self-promotion ;-)
Hope you like it,
Maarten