REST client sample

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

REST client sample

Günther Schmidt
Hi,

has anybody here ever written a REST client sample with DST?

I've seen the SOAP client/server packages on Dolphinharbor, but I'd be
more interessted on how to implement a REST service.

Günther


Reply | Threaded
Open this post in threaded view
|

Re: REST client sample

Sean M-3
"Günther Schmidt" <[hidden email]> wrote in message
news:42bc4e52$[hidden email]...
> Hi,
>
> has anybody here ever written a REST client sample with DST?
>
> I've seen the SOAP client/server packages on Dolphinharbor, but I'd be
> more interessted on how to implement a REST service.

stream := FileStream on: (IStream onURL:
'http://www.arcturus.com.au/dolphin/restServer.stb') text: false.
video := [ Object binaryReadFrom: stream ] ensure: [ stream close ].
video inspect.

There is a rest client all done for you. You just retrieved a Video instance
of the movie 'Aliens' from my server

Ofcourse, for it to work, you have to have the MVP examples installed
(Specifically the Video Store example)

That is pretty much what REST is all about, a resource as a url which
doesn't change. Usually XML, but in this case, an serialized Dolphin object.

The whole Dolphin Live Update system is a REST system.


Reply | Threaded
Open this post in threaded view
|

Re: REST client sample

Günther Schmidt
Sean,

thanks, where do I find the MVP examples, is that a goodie package of yours?

I've got Dolphin XP PRO here on my machine, but I don't see it.

About REST:

I was wondering how I should implement a PUT or POST client. Let's say
I've got some data that I want to upload to the server.

I've written a server example in PHP
(http://gallery.bibliofil.de/artists), and that works fine. So far I
"downloaded" it using IXMLDOMDocument. IXMLDOMDocument can validate the
XML document for wellformedness, but I still need to write a mapping
myself to turn the strings into the appropriate objects.

That's why I asked for a sample REST client, so I could see how other
people would handle this.

PUT, POST and turning XML data into appropriate ST objects.

Günther


Reply | Threaded
Open this post in threaded view
|

Re: REST client sample

Sean M-3
> thanks, where do I find the MVP examples, is that a goodie package of
> yours?

Should be built into any edition of Dolphin 5...

Package Browser | Object Arts | Samples | MVP | Video Library


If you can de-serialize the stb file and inspect it and it shows an
inspector onf a Video, you're laughing.

> About REST:
>
> I was wondering how I should implement a PUT or POST client. Let's say
> I've got some data that I want to upload to the server.
>
> I've written a server example in PHP
> (http://gallery.bibliofil.de/artists), and that works fine. So far I
> "downloaded" it using IXMLDOMDocument. IXMLDOMDocument can validate the
> XML document for wellformedness, but I still need to write a mapping
> myself to turn the strings into the appropriate objects.
>
> That's why I asked for a sample REST client, so I could see how other
> people would handle this.
>
> PUT, POST and turning XML data into appropriate ST objects.

Ok, seeing as you're working with a PHP server, it's probably best to keep
everything as XML...

You could use an XmlRpc server written in PHP on the server, and use the
XmlRpc client I ported in Dolphin.. That would enable you to GET and PUT
results.

The Rpc client is fairly simple. The biggest complexity would come on the
PHP side I think.

There is basic support for serializing a Smalltalk object, and sending it to
PHP as XML, and then receiving a Smalltalk object as Xml and
re-instantiating it. I never tested that though because it isn't really part
of the XmlRpc "Specification" (If you could even call it that)

For the XmlRpc client:

http://www.arcturus.com.au/dolphin/

Check out the code examples (class methods on XmlRpcClient).