XML-RPC Goodie

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

XML-RPC Goodie

Jerome Chan
XML-RPC Goodie
http://homepage.mac.com/eviltofu/.cv/eviltofu/Public/XML-RPC.zip-link.zip

Here is a pre-alpha version of my xml-rpc goodie (there's not even a
version number!).

Requires YAXO, Base64 and HTTP Client from Steve Warings Spray package.
http://www.dolphinharbor.org/dh/projects/spray/index.html

How to use it?

request := XMLRPCRequest withServerAtURL:
'http://betty.userland.com:80/RPC2'.

response := request invoke: 'examples.getState' with: 10.
"response isError = false"
"response value = 'Florida'"

response := request invoke: 'examples.getState' with: 20.
"response isError = false"
"response value = 'Maine'"

response is a XMLRPCResponse object.

To test for errors send 'isError' to the object and it will return a
Boolean value.

In order to get the mapped value below send 'value' to the object.

Mapping  XMLRPC <-> Smalltalk
Array <-> OrderedCollection
Base64 <-> ByteArray
Boolean <-> Boolean
Date <-> TimeStamp
Double <-> Float
Integer <-> Integer
String <-> String
Struct <-> Dictionary

sending 'value' to
response := request invoke: 'examples.getState' with: 10.
will return the string 'Florida'.

If there are several parameters required for the invocation just use
more 'with:'s.

response := request invoke: 'system.listMethods'.
response := request invoke: 'methodWithOneParameter' with: true.
response := request invoke: 'methodWithTwoParameters' with: true with: 1.
response := request invoke: 'methodWithThreeParameters' with: true with:
2 with: 'hello'.
response := request invoke: 'methodWithFourParameters' with: true with:
false with: (OrderedCollection with: 1 with: 2) with: TimeStamp current.

You can use up to six parameters. If you need more just add in another
'with:with:with:with:with...' method to the class.

Bugs:

There are problems with my Double to float conversion and Date to
TimeStamp conversion. Sometimes you lose precision on doubles depending
on how its represented in memory. TimeStamps are identical if compared
with 'asSeconds' but not with 'asMilliseconds' which is what the default
is under the '=' operator for dolphin.


Reply | Threaded
Open this post in threaded view
|

Re: XML-RPC Goodie

tgkuo
Good stuff.
   I felt the ideas behind this implementation is of the kind of SOAP
operation which is more general in concept, and supports any web services
providing WSDL specification:
     At client side, we used Splash to send SOAP envelopes for invoking web
services in WSDL specification. These web services could be found in
X-Methods, http://www.xmethods.net/. Steve has listed and tested them for
Splash in http://www.dolphinharbor.org/dh/projects/spray/xm/index.html.
    The server sides as listed in X-Methods undertand WSDL and XMLSchema,
and provides RPC/Encodes or DOC/Literal ( for .NET) web service opeartions.
   Steve Waring's web side  has rewritten more detailed description of the
workings, see
http://www.dolphinharbor.org/dh/projects/spray/docs/index.html.

Example:
    x := SoapInteropXMethods new.
    x createClientOn:
'http://www.xmethods.net/sd/2001/EBayWatcherService.wsdl'.
    exchange := x client send: 'getCurrentPrice' with: '414173888'.
    answer := exchange value.

I personally felt the SOAP ( SOAP 1.2 spec, and "Smalltalk Object -> SOAP
envelopes -> SOAP message -> SOAP node" concept ) is a great envolving
construct, building huge semantic Internet World.

Any ideas?

Best regards
Tsun Kuo.

"Jerome Chan" <[hidden email]> ¦b¶l¥ó
news:[hidden email] ¤¤¼¶¼g...
> XML-RPC Goodie
> http://homepage.mac.com/eviltofu/.cv/eviltofu/Public/XML-RPC.zip-link.zip
>
> Here is a pre-alpha version of my xml-rpc goodie (there's not even a
> version number!).
>
> Requires YAXO, Base64 and HTTP Client from Steve Warings Spray package.
> http://www.dolphinharbor.org/dh/projects/spray/index.html


Reply | Threaded
Open this post in threaded view
|

Re: XML-RPC Goodie

Roberto Lupi-2
In reply to this post by Jerome Chan
In article <[hidden email]>,
[hidden email] says...
> XML-RPC Goodie
> http://homepage.mac.com/eviltofu/.cv/eviltofu/Public/XML-RPC.zip-link.zip
>
> Here is a pre-alpha version of my xml-rpc goodie (there's not even a
> version number!).

Great!

I'll need to make Dolphin and Zope talk soon and I planned to write one
myself, but you've anticipated me.

I will help in the development and debugging, if you'll release it with
a BSD-style license.

--
Roberto Lupi


Reply | Threaded
Open this post in threaded view
|

Re: XML-RPC Goodie

Jerome Chan
In article <[hidden email]>,
 Roberto Lupi <[hidden email]> wrote:

> In article <[hidden email]>,
> [hidden email] says...
> > XML-RPC Goodie
> > http://homepage.mac.com/eviltofu/.cv/eviltofu/Public/XML-RPC.zip-link.zip
> >
> > Here is a pre-alpha version of my xml-rpc goodie (there's not even a
> > version number!).
>
> Great!
>
> I'll need to make Dolphin and Zope talk soon and I planned to write one
> myself, but you've anticipated me.
>
> I will help in the development and debugging, if you'll release it with
> a BSD-style license.

Hrm. The Apple site appears to have some problems so I've transfered the
goodies to:

http://home.earthlink.net/~eviltofu/XML-RPC.zip