Mailing List Archive: 49091 messages
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search
 

SOAP

 [1/16] from: gchiu:compkarori at: 12-Jun-2001 10:59


Hope this formats okay :-) Grabs the current exchange rate for England/Japan, and taken from http://www.xmethods.com. Oh, and I have no idea how SOAP works ! Rebol [] do http://www.compkarori.co.nz/reb/http-tools-beta.r soap-url: http://services.xmethods.net/soap soap-request: {<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance" xmlns:xsd="http://www.w3.org/1999/XMLSchema"> <SOAP-ENV:Body> <ns1:getRate xmlns:ns1="urn:xmethods-CurrencyExchange" SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"> <country1 xsi:type="xsd:string">England</country1> <country2 xsi:type="xsd:string">Japan</country2> </ns1:getRate> </SOAP-ENV:Body> </SOAP-ENV:Envelope>} replace/all soap-request newline "" tmp: http-tools/soap soap-url reduce [ "" soap-request ] parse tmp/content [ thru <Result xsi:type='xsd:float'> copy result to </Result> to end (print [ "England/Japan Exchange rate: " result] ) ] -- Graham Chiu

 [2/16] from: gjones05:mail:orion at: 11-Jun-2001 18:39


From: "Graham Chiu"
> Hope this formats okay :-) > Grabs the current exchange rate for England/Japan, and taken > from http://www.xmethods.com.
Cool!
> Oh, and I have no idea how SOAP works !
Well, first you get in the shower, then .... ;-) --Scott Jones

 [3/16] from: m:koopmans2:chello:nl at: 12-Jun-2001 8:31


Good example Graham! Question to the rest of us: do we want this automated? So you could do: soap-exec [ ... ] How far are you with that? I am thinking of doing that myself, but..... so little time. Another thing I'd like to do is expose rugby services as SOAP. So you can implement SOAP services in an afternoon. What's holding me back is that SOAP is so cumbersome compared to Rebol. But on the other hand, sometimes you need a Trojan horse. Anybody any thoughts on this? --Maarten

 [4/16] from: gchiu:compkarori at: 12-Jun-2001 20:17


On Tue, 12 Jun 2001 08:31:18 +0200 "Maarten Koopmans" <[m--koopmans2--chello--nl]> wrote:
> Question to the rest of us: do we want this automated? > > So you could do: soap-exec [ ... ] > > How far are you with that? I am thinking of doing that > myself, but..... so
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. I do note that many SOAP services exist on ports other than 80 which means more changes ...
> 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? -- Graham Chiu

 [5/16] 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

 [6/16] from: m:koopmans2:chello:nl at: 12-Jun-2001 12:53


I typed the chat client and server in Outlook without testing, and immediately got a response that it didn't work. here are versions that are tested ;-) --Maarten -- Attached file included as plaintext by Listar -- -- File: chat_serv.r 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] [ probe r-msg: copy find messages id return r-msg ] serve [add-message get-messages] -- Attached file included as plaintext by Listar -- -- File: chat_client.r 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! 600 r-msg: rexec compose [get-messages (id) ] probe r-msg 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 ]

 [7/16] from: gchiu:compkarori at: 13-Jun-2001 9:18


On Tue, 12 Jun 2001 11:20:04 +0200 "Maarten Koopmans" <[m--koopmans2--chello--nl]> wrote:
> Say you have a service that you want to be available on a > network to other
<<quoted lines omitted: 3>>
> communication software. > You'd use rugby or something like that.
Okay, understood now. So, it's similar to xml-rpc without the xml between Rebol client/server. So, I see that Rebol needs SOAP to access 3rd party SOAP services, and Rugby needs to provide a SOAP interface to allow non-Rebol clients to access Rugby services. Is there a directory of Rugby services currently available? Do we need a wdsl type of descriptor to access these services? Or, perhaps, should all Rugby services provide a 'help command? -- Graham Chiu

 [8/16] from: petr::krenzelok::trz::cz at: 13-Jun-2001 6:13


Graham Chiu wrote:
> On Tue, 12 Jun 2001 11:20:04 +0200 > "Maarten Koopmans" <[m--koopmans2--chello--nl]> wrote:
<<quoted lines omitted: 7>>
> Okay, understood now. So, it's similar to xml-rpc without > the xml between Rebol client/server.
It's much better than scripting.com overhyped xml-rpc ;-)
> So, I see that Rebol needs SOAP to access 3rd party SOAP > services, and Rugby needs to provide a SOAP interface to > allow non-Rebol clients to access Rugby services. >
possibly, make it a plug-in though - who cares of SOAP/XML bloat if we have much cleaner solution? :-) ........ just kidding ;-)
> Is there a directory of Rugby services currently available? > Do we need a wdsl type of descriptor to access these > services?
Uhm, I feel lost now. Why everything so easy has to turn into something more complicated? :-) What rugby services are you talking about? You just set your environment block (at least at Rugby 1.x version), and export global context function names you want remote client to be able to execute - e.g. 'delete function, to allow remote client to delete your harddisk :-)
> Or, perhaps, should all Rugby services provide a > 'help command?
Good idea - maybe it would be good for Rugby server to save rebol's 'help, and provide new one, returning list or config of available services/interfaces ... Cheers, -pekr-

 [9/16] from: m:koopmans2:chello:nl at: 13-Jun-2001 6:23


> > Say you have a service that you want to be available on a > > network to other
<<quoted lines omitted: 5>>
> Okay, understood now. So, it's similar to xml-rpc without > the xml between Rebol client/server.
Yes. But... making services is easier than any middleware I know.
> So, I see that Rebol needs SOAP to access 3rd party SOAP > services, and Rugby needs to provide a SOAP interface to > allow non-Rebol clients to access Rugby services. >
Yes again. Note that a SOAP interace for Rugby is probably the easiest part: you dictate the SOAP interface and hence the types etc you support. Since Rebol has built-in support for lots of types, I probably will map them to string and convert them using Rebols reflexive properties. I may just do that for every type so I can get the automaed SOAP exposure out quickly. On the other hand: does REBOL needs to access SOAP objects in a generic way? There are lots of other ways: - DLL/SHell interface - Other TCP protocols - Custom SOAP requests. You showed us how easy it was! I think I'll focus on the exposure part for now. I need to find the time for it, but it is a very useful addition to what I've already got, and I have a good idea on how to build it.
> Is there a directory of Rugby services currently available? > Do we need a wdsl type of descriptor to access these > services? Or, perhaps, should all Rugby services provide a > 'help command? >
Here you need server space. Using Rebols reflexive properties we can do this easily. A directory/name server will really help distributed development. I'll see if I can come up with anything. And a help-services command is always good. Perhaps I should include these features in the next version. Thanks, Maarten

 [10/16] from: gchiu:compkarori at: 13-Jun-2001 18:26


On Wed, 13 Jun 2001 06:13:57 +0200 Petr Krenzelok <[Petr--Krenzelok--trz--cz]> wrote:
> > Is there a directory of Rugby services currently > available?
<<quoted lines omitted: 4>>
> more complicated? :-) What rugby services are you talking > about? You
Ryan has a quote server at tcp://206.229.23.41:8001 I was wondering if other people have Rugby services available. As for complicated, I can see the reasons for wdsl - a machine readable way to know what functions are available, how to call them, whether strings, or floats etc are returned etc. -- Graham Chiu

 [11/16] from: gchiu:compkarori at: 13-Jun-2001 18:32


On Wed, 13 Jun 2001 06:23:45 +0200 "Maarten Koopmans" <[m--koopmans2--chello--nl]> wrote:
> I probably will map them to string and convert them using > Rebols reflexive properties. I may just do that for every > type > so I can get the automaed SOAP exposure out quickly.
Sounds good.
> can do this easily. A directory/name server will really > help distributed > development. I'll see if I can come up with anything.
Or perhaps just a web page like xmethods.com -- Graham Chiu

 [12/16] from: petr:krenzelok:trz:cz at: 13-Jun-2001 8:49


Graham Chiu wrote:
> On Wed, 13 Jun 2001 06:13:57 +0200 > Petr Krenzelok <[Petr--Krenzelok--trz--cz]> wrote:
<<quoted lines omitted: 14>>
> how to call them, whether strings, or floats etc are > returned etc.
ah, now I see - something like network interfaces Holger described some time ago? Maybe we could use rebol objects for that? Or is "wdsl" any standardized aproach? Thanks, -pekr-

 [13/16] from: gchiu:compkarori at: 13-Jun-2001 21:17


> time ago? Maybe we could use rebol objects for that? Or > is "wdsl" any > standardized aproach?
Here's a link that describes what WDSL is: http://www.devxpert.com/tutors/wsdl/wsdl.asp The point of it, is that it is machine readable. Now this is very cute, and demonstrates the above: http://www.soapclient.com/soapclient.com/soaptest.html You enter the url of a WDSL file in the form, and the script then analyses the WDSL file, and creates forms based upon the methods detected in that file. When you submit the form it then turns the http request into a SOAP request, submits it to the SOAP server, and then returns the result to you. -- Graham Chiu

 [14/16] from: gchiu:compkarori at: 13-Jun-2001 22:08


On Wed, 13 Jun 2001 21:17:24 +1200 "Graham Chiu" <[gchiu--compkarori--co--nz]> wrote:
> You enter the url of a WDSL file in the form, and the > script > then analyses the WDSL file, and creates forms based upon > the methods detected in that file.
In my last message, please replace all instances of "WDSL" with "WSDL" :-( -- Graham Chiu

 [15/16] from: gchiu:compkarori at: 16-Jun-2001 16:43


I was having problems accessing SOAP services on other than port 80, but it now seems that the server I was trying was a little flaky :-( This example here: http://www.compkarori.co.nz/reb/airfare.r obtains a live airfare quote courtesy of travel.yahoo.com, and uses port 82. -- Graham Chiu

 [16/16] from: gchiu:compkarori at: 20-Jun-2001 9:57


On Tue, 12 Jun 2001 08:31:18 +0200 "Maarten Koopmans" <[m--koopmans2--chello--nl]> wrote:
> So you could do: soap-exec [ ... ] > > How far are you with that? I am thinking of doing that > myself, but..... so > little time.
Hi Maarten, I've got to the point where I can now do: soap-exec url-wsdl SoapMethod [ parameter list ] but so far only for non-complex data types. -- Graham Chiu

Notes
  • Quoted lines have been omitted from some messages.
    View the message alone to see the lines that have been omitted