 |
| SOAP Central - a public SOAP service repository |
|
Welcome to SOAP Central, my web service farm. As a public service, I will be wrapping useful functions as SOAP services and making them available here for you to try. These are services that I use elsewhere, and so are likely to remain accessable as long as I use them. No contracts about interfaces, and don't use them in production environments. (Actually, if you want to use them in a production environment, and have a budget, give me a call 8).
|
Service URI:
http://soap.rianvanstaden.com:2020
Please note that currently, no namespace is needed. |
Current services:
hello() Test function, returns String
add(val1,val2) Test function, takes two strings, ints or floats, return input type.
sparkline(type:string,data:array,args:dict) Takes type as string, one of "smooth" or "discrete", data as array of integers between 0 and 100, and args as outlined in the python sample code below:
#!/usr/bin/python
import SOAPpy
import binascii
serv = SOAPpy.SOAPProxy("http://soap.rianvanstaden.com:2020")
args = {}
# args for all sparklines
args['step'] = '1'
args['height'] = '20'
# args for discrete sparkline
args['upper'] = '50'
args['below-color'] = '#078007'
args['above-color'] = '#f30404'
# args for smooth sparkline
args['min-color'] = '#0000FF'
args['max-color'] = '#00FF00'
args['last-color'] = '#FF0000'
args['min-m'] = 'true' #show min dot
args['max-m'] = 'true' #show max dot
args['last-m'] = 'true' #show last dot
data = (10,20,30,40,30,20,40,80,90,90,70,60,10,40)
base64_sparkline = serv.sparkline('discrete',data,args)
f = open('test.png','w+b')
f.write(binascii.a2b_base64(base64_sparkline))
f.close()
It returns a base64-encoded PNG file (as a string) of a sparkline (as defined by Edward Tufte, similar to or )1. The PNGs are quite small, and so can be embedded directly in HTML using the data: tag (which, as fate would have it, doesn't always work in Internet Explorer), like so:
<img src="data:image/png,%89PNG%0D%0...snip...AEB%60%82"/>
which then looks like this: . The sparkline generation code is based on that of Joe Gregorio.
Update:
A stub class for the sparkline service is now available: meet Sparky.
|
getFeeds(URI:string) Takes a URI as string, returns an array of URIs of any RSS or Atom feeds on the page designated by the URI parameter. The feeds are checked to make sure they really are feeds, so beware SOAP timeouts. Supports the Robot Exclusion Standard. Thanks to Mark Pilgrim for the original feedfinder code.
>>> serv.getFeeds('http://www.cnn.com/')
['http://rss.cnn.com/rss/cnn_topstories.rss', 'http://rss.cnn.com/rss/cnn_latest.rss']
toRoman(n:integer) Takes an integer between 0 and 5000 (inclusive) and returns a string with the roman numeral equivalent:
>>> serv.toRoman(1984)
'MCMLXXXIV'
fromRoman(s:string) Takes a roman numeral as string and returns an integer value representation of the numeral.
>>> serv.fromRoman('MCM')
1900
More to come...
|
| Footnotes:
1. A practical example is currencies. While it is interesting to say that the exchange rate between the South African Rand (ZAR) and the Euro varied between 10.6890 in January of 2002 and 8.1537 in July of this year, referring to its development using sparklines says a lot more: The development of the South African Rand since January 2002 from its base value of 10.689...Or: Since January 2002, the Rand has spent a lot of time under its period mean value , especially in the latter half....
|
|
|