diff options
| author | Manuel Traut <manut@mecka.net> | 2014-02-18 23:34:33 +0100 |
|---|---|---|
| committer | Manuel Traut <manut@mecka.net> | 2014-02-18 23:34:33 +0100 |
| commit | a9f5c60272e630c3de528dc773eb5af491a01e0a (patch) | |
| tree | 6d3401e48349720511a4c352339ff03951619bb0 | |
| parent | de1b78ee51ee99165c7ad1030cc13a24fd05e394 (diff) | |
middleware: add a python soap example
it's a quite small one. Maybe we can add an interface description sometimes.
Signed-off-by: Manuel Traut <manut@mecka.net>
| -rwxr-xr-x | frameworks/middleware/examples/soap/client.py | 11 | ||||
| -rwxr-xr-x | frameworks/middleware/examples/soap/server.py | 18 |
2 files changed, 29 insertions, 0 deletions
diff --git a/frameworks/middleware/examples/soap/client.py b/frameworks/middleware/examples/soap/client.py new file mode 100755 index 0000000..9cd35f2 --- /dev/null +++ b/frameworks/middleware/examples/soap/client.py @@ -0,0 +1,11 @@ +#!/usr/bin/python + +from datetime import datetime +from ZSI.client import Binding + +b = Binding(url='http://localhost:8000/') +t = b.today (5) +# t = 2014-02-18 15:59:50.571927 +conv = datetime.strptime (t, "%Y-%m-%d %H:%M:%S.%f") +print "Today: %s" % conv.strftime ("%d.%m.%Y, %H:%M") +print b.load ("string") diff --git a/frameworks/middleware/examples/soap/server.py b/frameworks/middleware/examples/soap/server.py new file mode 100755 index 0000000..32a550a --- /dev/null +++ b/frameworks/middleware/examples/soap/server.py @@ -0,0 +1,18 @@ +#!/usr/bin/python + +from datetime import datetime +from ZSI import dispatch + +def today (arg): + print "today arg:", arg + today = datetime.today () + return str (today) + +def load (arg): + print "load arg:", arg + fd = open ("/proc/loadavg", "r") + loadavg = fd.read () + sysload = loadavg.split () + return sysload[0] + +dispatch.AsServer (port=8000, rpc=True) |
