<?xml version="1.0" encoding="ascii"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>web2py.gluon.tools.Service</title>
<link rel="stylesheet" href="epydoc.css" type="text/css" />
<script type="text/javascript" src="epydoc.js"></script>
</head>
<body bgcolor="white" text="black" link="blue" vlink="#204080"
alink="#204080">
<!-- ==================== NAVIGATION BAR ==================== -->
<table class="navbar" border="0" width="100%" cellpadding="0"
bgcolor="#a0c0ff" cellspacing="0">
<tr valign="middle">
<!-- Home link -->
<th> <a
href="web2py.gluon-module.html">Home</a> </th>
<!-- Tree link -->
<th> <a
href="module-tree.html">Trees</a> </th>
<!-- Index link -->
<th> <a
href="identifier-index.html">Indices</a> </th>
<!-- Help link -->
<th> <a
href="help.html">Help</a> </th>
<!-- Project homepage -->
<th class="navbar" align="right" width="100%">
<table border="0" cellpadding="0" cellspacing="0">
<tr><th class="navbar" align="center"
><a class="navbar" target="_top" href="http://www.web2py.com">web2py Web Framework</a></th>
</tr></table></th>
</tr>
</table>
<table width="100%" cellpadding="0" cellspacing="0">
<tr valign="top">
<td width="100%">
<span class="breadcrumbs">
Package web2py ::
<a href="web2py.gluon-module.html">Package gluon</a> ::
<a href="web2py.gluon.tools-module.html">Module tools</a> ::
Class Service
</span>
</td>
<td>
<table cellpadding="0" cellspacing="0">
<!-- hide/show private -->
<tr><td align="right"><span class="options">[<a href="javascript:void(0);" class="privatelink"
onclick="toggle_private();">hide private</a>]</span></td></tr>
<tr><td align="right"><span class="options"
>[<a href="frames.html" target="_top">frames</a
>] | <a href="web2py.gluon.tools.Service-class.html"
target="_top">no frames</a>]</span></td></tr>
</table>
</td>
</tr>
</table>
<!-- ==================== CLASS DESCRIPTION ==================== -->
<h1 class="epydoc">Class Service</h1><span class="codelink"><a href="web2py.gluon.tools-pysrc.html#Service">source code</a></span><br /><br />
<pre class="base-tree">
object --+
|
<strong class="uidshort">Service</strong>
</pre>
<hr />
<!-- ==================== NESTED CLASSES ==================== -->
<a name="section-NestedClasses"></a>
<table class="summary" border="1" cellpadding="3"
cellspacing="0" width="100%" bgcolor="white">
<tr bgcolor="#70b0f0" class="table-header">
<td colspan="2" class="table-header">
<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tr valign="top">
<td align="left"><span class="table-header">Nested Classes</span></td>
<td align="right" valign="top"
><span class="options">[<a href="#section-NestedClasses"
class="privatelink" onclick="toggle_private();"
>hide private</a>]</span></td>
</tr>
</table>
</td>
</tr>
<tr>
<td width="15%" align="right" valign="top" class="summary">
<span class="summary-type"> </span>
</td><td class="summary">
<a href="web2py.gluon.tools.Service.JsonRpcException-class.html" class="summary-name">JsonRpcException</a>
</td>
</tr>
</table>
<!-- ==================== INSTANCE METHODS ==================== -->
<a name="section-InstanceMethods"></a>
<table class="summary" border="1" cellpadding="3"
cellspacing="0" width="100%" bgcolor="white">
<tr bgcolor="#70b0f0" class="table-header">
<td colspan="2" class="table-header">
<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tr valign="top">
<td align="left"><span class="table-header">Instance Methods</span></td>
<td align="right" valign="top"
><span class="options">[<a href="#section-InstanceMethods"
class="privatelink" onclick="toggle_private();"
>hide private</a>]</span></td>
</tr>
</table>
</td>
</tr>
<tr>
<td width="15%" align="right" valign="top" class="summary">
<span class="summary-type"> </span>
</td><td class="summary">
<table width="100%" cellpadding="0" cellspacing="0" border="0">
<tr>
<td><span class="summary-sig"><a href="web2py.gluon.tools.Service-class.html#__init__" class="summary-sig-name">__init__</a>(<span class="summary-sig-arg">self</span>,
<span class="summary-sig-arg">environment</span>=<span class="summary-sig-default">1</span>)</span><br />
x.__init__(...) initializes x; see x.__class__.__doc__ for
signature</td>
<td align="right" valign="top">
<span class="codelink"><a href="web2py.gluon.tools-pysrc.html#Service.__init__">source code</a></span>
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td width="15%" align="right" valign="top" class="summary">
<span class="summary-type"> </span>
</td><td class="summary">
<table width="100%" cellpadding="0" cellspacing="0" border="0">
<tr>
<td><span class="summary-sig"><a href="web2py.gluon.tools.Service-class.html#run" class="summary-sig-name">run</a>(<span class="summary-sig-arg">self</span>,
<span class="summary-sig-arg">f</span>)</span><br />
example:</td>
<td align="right" valign="top">
<span class="codelink"><a href="web2py.gluon.tools-pysrc.html#Service.run">source code</a></span>
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td width="15%" align="right" valign="top" class="summary">
<span class="summary-type"> </span>
</td><td class="summary">
<table width="100%" cellpadding="0" cellspacing="0" border="0">
<tr>
<td><span class="summary-sig"><a href="web2py.gluon.tools.Service-class.html#csv" class="summary-sig-name">csv</a>(<span class="summary-sig-arg">self</span>,
<span class="summary-sig-arg">f</span>)</span><br />
example:</td>
<td align="right" valign="top">
<span class="codelink"><a href="web2py.gluon.tools-pysrc.html#Service.csv">source code</a></span>
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td width="15%" align="right" valign="top" class="summary">
<span class="summary-type"> </span>
</td><td class="summary">
<table width="100%" cellpadding="0" cellspacing="0" border="0">
<tr>
<td><span class="summary-sig"><a href="web2py.gluon.tools.Service-class.html#xml" class="summary-sig-name">xml</a>(<span class="summary-sig-arg">self</span>,
<span class="summary-sig-arg">f</span>)</span><br />
example:</td>
<td align="right" valign="top">
<span class="codelink"><a href="web2py.gluon.tools-pysrc.html#Service.xml">source code</a></span>
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td width="15%" align="right" valign="top" class="summary">
<span class="summary-type"> </span>
</td><td class="summary">
<table width="100%" cellpadding="0" cellspacing="0" border="0">
<tr>
<td><span class="summary-sig"><a href="web2py.gluon.tools.Service-class.html#rss" class="summary-sig-name">rss</a>(<span class="summary-sig-arg">self</span>,
<span class="summary-sig-arg">f</span>)</span><br />
example:</td>
<td align="right" valign="top">
<span class="codelink"><a href="web2py.gluon.tools-pysrc.html#Service.rss">source code</a></span>
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td width="15%" align="right" valign="top" class="summary">
<span class="summary-type"> </span>
</td><td class="summary">
<table width="100%" cellpadding="0" cellspacing="0" border="0">
<tr>
<td><span class="summary-sig"><a href="web2py.gluon.tools.Service-class.html#json" class="summary-sig-name">json</a>(<span class="summary-sig-arg">self</span>,
<span class="summary-sig-arg">f</span>)</span><br />
example:</td>
<td align="right" valign="top">
<span class="codelink"><a href="web2py.gluon.tools-pysrc.html#Service.json">source code</a></span>
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td width="15%" align="right" valign="top" class="summary">
<span class="summary-type"> </span>
</td><td class="summary">
<table width="100%" cellpadding="0" cellspacing="0" border="0">
<tr>
<td><span class="summary-sig"><a href="web2py.gluon.tools.Service-class.html#jsonrpc" class="summary-sig-name">jsonrpc</a>(<span class="summary-sig-arg">self</span>,
<span class="summary-sig-arg">f</span>)</span><br />
example:</td>
<td align="right" valign="top">
<span class="codelink"><a href="web2py.gluon.tools-pysrc.html#Service.jsonrpc">source code</a></span>
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td width="15%" align="right" valign="top" class="summary">
<span class="summary-type"> </span>
</td><td class="summary">
<table width="100%" cellpadding="0" cellspacing="0" border="0">
<tr>
<td><span class="summary-sig"><a href="web2py.gluon.tools.Service-class.html#xmlrpc" class="summary-sig-name">xmlrpc</a>(<span class="summary-sig-arg">self</span>,
<span class="summary-sig-arg">f</span>)</span><br />
example:</td>
<td align="right" valign="top">
<span class="codelink"><a href="web2py.gluon.tools-pysrc.html#Service.xmlrpc">source code</a></span>
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td width="15%" align="right" valign="top" class="summary">
<span class="summary-type"> </span>
</td><td class="summary">
<table width="100%" cellpadding="0" cellspacing="0" border="0">
<tr>
<td><span class="summary-sig"><a href="web2py.gluon.tools.Service-class.html#amfrpc" class="summary-sig-name">amfrpc</a>(<span class="summary-sig-arg">self</span>,
<span class="summary-sig-arg">f</span>)</span><br />
example:</td>
<td align="right" valign="top">
<span class="codelink"><a href="web2py.gluon.tools-pysrc.html#Service.amfrpc">source code</a></span>
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td width="15%" align="right" valign="top" class="summary">
<span class="summary-type"> </span>
</td><td class="summary">
<table width="100%" cellpadding="0" cellspacing="0" border="0">
<tr>
<td><span class="summary-sig"><a href="web2py.gluon.tools.Service-class.html#amfrpc3" class="summary-sig-name">amfrpc3</a>(<span class="summary-sig-arg">self</span>,
<span class="summary-sig-arg">domain</span>=<span class="summary-sig-default"><code class="variable-quote">'</code><code class="variable-string">default</code><code class="variable-quote">'</code></span>)</span><br />
example:</td>
<td align="right" valign="top">
<span class="codelink"><a href="web2py.gluon.tools-pysrc.html#Service.amfrpc3">source code</a></span>
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td width="15%" align="right" valign="top" class="summary">
<span class="summary-type"> </span>
</td><td class="summary">
<table width="100%" cellpadding="0" cellspacing="0" border="0">
<tr>
<td><span class="summary-sig"><a href="web2py.gluon.tools.Service-class.html#soap" class="summary-sig-name">soap</a>(<span class="summary-sig-arg">self</span>,
<span class="summary-sig-arg">name</span>=<span class="summary-sig-default">1</span>,
<span class="summary-sig-arg">returns</span>=<span class="summary-sig-default">1</span>,
<span class="summary-sig-arg">args</span>=<span class="summary-sig-default">1</span>,
<span class="summary-sig-arg">doc</span>=<span class="summary-sig-default">1</span>)</span><br />
example::...</td>
<td align="right" valign="top">
<span class="codelink"><a href="web2py.gluon.tools-pysrc.html#Service.soap">source code</a></span>
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td width="15%" align="right" valign="top" class="summary">
<span class="summary-type"> </span>
</td><td class="summary">
<table width="100%" cellpadding="0" cellspacing="0" border="0">
<tr>
<td><span class="summary-sig"><a name="serve_run"></a><span class="summary-sig-name">serve_run</span>(<span class="summary-sig-arg">self</span>,
<span class="summary-sig-arg">args</span>=<span class="summary-sig-default">1</span>)</span></td>
<td align="right" valign="top">
<span class="codelink"><a href="web2py.gluon.tools-pysrc.html#Service.serve_run">source code</a></span>
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td width="15%" align="right" valign="top" class="summary">
<span class="summary-type"> </span>
</td><td class="summary">
<table width="100%" cellpadding="0" cellspacing="0" border="0">
<tr>
<td><span class="summary-sig"><a name="serve_csv"></a><span class="summary-sig-name">serve_csv</span>(<span class="summary-sig-arg">self</span>,
<span class="summary-sig-arg">args</span>=<span class="summary-sig-default">1</span>)</span></td>
<td align="right" valign="top">
<span class="codelink"><a href="web2py.gluon.tools-pysrc.html#Service.serve_csv">source code</a></span>
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td width="15%" align="right" valign="top" class="summary">
<span class="summary-type"> </span>
</td><td class="summary">
<table width="100%" cellpadding="0" cellspacing="0" border="0">
<tr>
<td><span class="summary-sig"><a name="serve_xml"></a><span class="summary-sig-name">serve_xml</span>(<span class="summary-sig-arg">self</span>,
<span class="summary-sig-arg">args</span>=<span class="summary-sig-default">1</span>)</span></td>
<td align="right" valign="top">
<span class="codelink"><a href="web2py.gluon.tools-pysrc.html#Service.serve_xml">source code</a></span>
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td width="15%" align="right" valign="top" class="summary">
<span class="summary-type"> </span>
</td><td class="summary">
<table width="100%" cellpadding="0" cellspacing="0" border="0">
<tr>
<td><span class="summary-sig"><a name="serve_rss"></a><span class="summary-sig-name">serve_rss</span>(<span class="summary-sig-arg">self</span>,
<span class="summary-sig-arg">args</span>=<span class="summary-sig-default">1</span>)</span></td>
<td align="right" valign="top">
<span class="codelink"><a href="web2py.gluon.tools-pysrc.html#Service.serve_rss">source code</a></span>
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td width="15%" align="right" valign="top" class="summary">
<span class="summary-type"> </span>
</td><td class="summary">
<table width="100%" cellpadding="0" cellspacing="0" border="0">
<tr>
<td><span class="summary-sig"><a name="serve_json"></a><span class="summary-sig-name">serve_json</span>(<span class="summary-sig-arg">self</span>,
<span class="summary-sig-arg">args</span>=<span class="summary-sig-default">1</span>)</span></td>
<td align="right" valign="top">
<span class="codelink"><a href="web2py.gluon.tools-pysrc.html#Service.serve_json">source code</a></span>
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td width="15%" align="right" valign="top" class="summary">
<span class="summary-type"> </span>
</td><td class="summary">
<table width="100%" cellpadding="0" cellspacing="0" border="0">
<tr>
<td><span class="summary-sig"><a name="serve_jsonrpc"></a><span class="summary-sig-name">serve_jsonrpc</span>(<span class="summary-sig-arg">self</span>)</span></td>
<td align="right" valign="top">
<span class="codelink"><a href="web2py.gluon.tools-pysrc.html#Service.serve_jsonrpc">source code</a></span>
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td width="15%" align="right" valign="top" class="summary">
<span class="summary-type"> </span>
</td><td class="summary">
<table width="100%" cellpadding="0" cellspacing="0" border="0">
<tr>
<td><span class="summary-sig"><a name="serve_xmlrpc"></a><span class="summary-sig-name">serve_xmlrpc</span>(<span class="summary-sig-arg">self</span>)</span></td>
<td align="right" valign="top">
<span class="codelink"><a href="web2py.gluon.tools-pysrc.html#Service.serve_xmlrpc">source code</a></span>
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td width="15%" align="right" valign="top" class="summary">
<span class="summary-type"> </span>
</td><td class="summary">
<table width="100%" cellpadding="0" cellspacing="0" border="0">
<tr>
<td><span class="summary-sig"><a name="serve_amfrpc"></a><span class="summary-sig-name">serve_amfrpc</span>(<span class="summary-sig-arg">self</span>,
<span class="summary-sig-arg">version</span>=<span class="summary-sig-default">0</span>)</span></td>
<td align="right" valign="top">
<span class="codelink"><a href="web2py.gluon.tools-pysrc.html#Service.serve_amfrpc">source code</a></span>
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td width="15%" align="right" valign="top" class="summary">
<span class="summary-type"> </span>
</td><td class="summary">
<table width="100%" cellpadding="0" cellspacing="0" border="0">
<tr>
<td><span class="summary-sig"><a name="serve_soap"></a><span class="summary-sig-name">serve_soap</span>(<span class="summary-sig-arg">self</span>,
<span class="summary-sig-arg">version</span>=<span class="summary-sig-default"><code class="variable-quote">'</code><code class="variable-string">1.1</code><code class="variable-quote">'</code></span>)</span></td>
<td align="right" valign="top">
<span class="codelink"><a href="web2py.gluon.tools-pysrc.html#Service.serve_soap">source code</a></span>
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td width="15%" align="right" valign="top" class="summary">
<span class="summary-type"> </span>
</td><td class="summary">
<table width="100%" cellpadding="0" cellspacing="0" border="0">
<tr>
<td><span class="summary-sig"><a href="web2py.gluon.tools.Service-class.html#__call__" class="summary-sig-name">__call__</a>(<span class="summary-sig-arg">self</span>)</span><br />
register services with: service = Service(globals()) @service.run
@service.rss @service.json @service.jsonrpc @service.xmlrpc
@service.jsonrpc @service.amfrpc @service.amfrpc3('domain')
@service.soap('Method', returns={'Result':int},
args={'a':int,'b':int,})</td>
<td align="right" valign="top">
<span class="codelink"><a href="web2py.gluon.tools-pysrc.html#Service.__call__">source code</a></span>
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td width="15%" align="right" valign="top" class="summary">
<span class="summary-type"> </span>
</td><td class="summary">
<table width="100%" cellpadding="0" cellspacing="0" border="0">
<tr>
<td><span class="summary-sig"><a name="error"></a><span class="summary-sig-name">error</span>(<span class="summary-sig-arg">self</span>)</span></td>
<td align="right" valign="top">
<span class="codelink"><a href="web2py.gluon.tools-pysrc.html#Service.error">source code</a></span>
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td colspan="2" class="summary">
<p class="indent-wrapped-lines"><b>Inherited from <code>object</code></b>:
<code>__delattr__</code>,
<code>__getattribute__</code>,
<code>__hash__</code>,
<code>__new__</code>,
<code>__reduce__</code>,
<code>__reduce_ex__</code>,
<code>__repr__</code>,
<code>__setattr__</code>,
<code>__str__</code>
</p>
</td>
</tr>
</table>
<!-- ==================== PROPERTIES ==================== -->
<a name="section-Properties"></a>
<table class="summary" border="1" cellpadding="3"
cellspacing="0" width="100%" bgcolor="white">
<tr bgcolor="#70b0f0" class="table-header">
<td colspan="2" class="table-header">
<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tr valign="top">
<td align="left"><span class="table-header">Properties</span></td>
<td align="right" valign="top"
><span class="options">[<a href="#section-Properties"
class="privatelink" onclick="toggle_private();"
>hide private</a>]</span></td>
</tr>
</table>
</td>
</tr>
<tr>
<td colspan="2" class="summary">
<p class="indent-wrapped-lines"><b>Inherited from <code>object</code></b>:
<code>__class__</code>
</p>
</td>
</tr>
</table>
<!-- ==================== METHOD DETAILS ==================== -->
<a name="section-MethodDetails"></a>
<table class="details" border="1" cellpadding="3"
cellspacing="0" width="100%" bgcolor="white">
<tr bgcolor="#70b0f0" class="table-header">
<td colspan="2" class="table-header">
<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tr valign="top">
<td align="left"><span class="table-header">Method Details</span></td>
<td align="right" valign="top"
><span class="options">[<a href="#section-MethodDetails"
class="privatelink" onclick="toggle_private();"
>hide private</a>]</span></td>
</tr>
</table>
</td>
</tr>
</table>
<a name="__init__"></a>
<div>
<table class="details" border="1" cellpadding="3"
cellspacing="0" width="100%" bgcolor="white">
<tr><td>
<table width="100%" cellpadding="0" cellspacing="0" border="0">
<tr valign="top"><td>
<h3 class="epydoc"><span class="sig"><span class="sig-name">__init__</span>(<span class="sig-arg">self</span>,
<span class="sig-arg">environment</span>=<span class="sig-default">1</span>)</span>
<br /><em class="fname">(Constructor)</em>
</h3>
</td><td align="right" valign="top"
><span class="codelink"><a href="web2py.gluon.tools-pysrc.html#Service.__init__">source code</a></span>
</td>
</table>
x.__init__(...) initializes x; see x.__class__.__doc__ for
signature
<dl class="fields">
<dt>Overrides:
object.__init__
<dd><em class="note">(inherited documentation)</em></dd>
</dt>
</dl>
</td></tr></table>
</div>
<a name="run"></a>
<div>
<table class="details" border="1" cellpadding="3"
cellspacing="0" width="100%" bgcolor="white">
<tr><td>
<table width="100%" cellpadding="0" cellspacing="0" border="0">
<tr valign="top"><td>
<h3 class="epydoc"><span class="sig"><span class="sig-name">run</span>(<span class="sig-arg">self</span>,
<span class="sig-arg">f</span>)</span>
</h3>
</td><td align="right" valign="top"
><span class="codelink"><a href="web2py.gluon.tools-pysrc.html#Service.run">source code</a></span>
</td>
</table>
example:
<pre class="literalblock">
service = Service(globals())
@service.run
def myfunction(a, b):
return a + b
def call():
return service()
</pre>
Then call it with:
<pre class="literalblock">
wget http://..../app/default/call/run/myfunction?a=3&b=4
</pre>
<dl class="fields">
</dl>
</td></tr></table>
</div>
<a name="csv"></a>
<div>
<table class="details" border="1" cellpadding="3"
cellspacing="0" width="100%" bgcolor="white">
<tr><td>
<table width="100%" cellpadding="0" cellspacing="0" border="0">
<tr valign="top"><td>
<h3 class="epydoc"><span class="sig"><span class="sig-name">csv</span>(<span class="sig-arg">self</span>,
<span class="sig-arg">f</span>)</span>
</h3>
</td><td align="right" valign="top"
><span class="codelink"><a href="web2py.gluon.tools-pysrc.html#Service.csv">source code</a></span>
</td>
</table>
example:
<pre class="literalblock">
service = Service(globals())
@service.csv
def myfunction(a, b):
return a + b
def call():
return service()
</pre>
Then call it with:
<pre class="literalblock">
wget http://..../app/default/call/csv/myfunction?a=3&b=4
</pre>
<dl class="fields">
</dl>
</td></tr></table>
</div>
<a name="xml"></a>
<div>
<table class="details" border="1" cellpadding="3"
cellspacing="0" width="100%" bgcolor="white">
<tr><td>
<table width="100%" cellpadding="0" cellspacing="0" border="0">
<tr valign="top"><td>
<h3 class="epydoc"><span class="sig"><span class="sig-name">xml</span>(<span class="sig-arg">self</span>,
<span class="sig-arg">f</span>)</span>
</h3>
</td><td align="right" valign="top"
><span class="codelink"><a href="web2py.gluon.tools-pysrc.html#Service.xml">source code</a></span>
</td>
</table>
example:
<pre class="literalblock">
service = Service(globals())
@service.xml
def myfunction(a, b):
return a + b
def call():
return service()
</pre>
Then call it with:
<pre class="literalblock">
wget http://..../app/default/call/xml/myfunction?a=3&b=4
</pre>
<dl class="fields">
</dl>
</td></tr></table>
</div>
<a name="rss"></a>
<div>
<table class="details" border="1" cellpadding="3"
cellspacing="0" width="100%" bgcolor="white">
<tr><td>
<table width="100%" cellpadding="0" cellspacing="0" border="0">
<tr valign="top"><td>
<h3 class="epydoc"><span class="sig"><span class="sig-name">rss</span>(<span class="sig-arg">self</span>,
<span class="sig-arg">f</span>)</span>
</h3>
</td><td align="right" valign="top"
><span class="codelink"><a href="web2py.gluon.tools-pysrc.html#Service.rss">source code</a></span>
</td>
</table>
example:
<pre class="literalblock">
service = Service(globals())
@service.rss
def myfunction():
return dict(title=..., link=..., description=...,
created_on=..., entries=[dict(title=..., link=...,
description=..., created_on=...])
def call():
return service()
</pre>
Then call it with:
<pre class="literalblock">
wget http://..../app/default/call/rss/myfunction
</pre>
<dl class="fields">
</dl>
</td></tr></table>
</div>
<a name="json"></a>
<div>
<table class="details" border="1" cellpadding="3"
cellspacing="0" width="100%" bgcolor="white">
<tr><td>
<table width="100%" cellpadding="0" cellspacing="0" border="0">
<tr valign="top"><td>
<h3 class="epydoc"><span class="sig"><span class="sig-name">json</span>(<span class="sig-arg">self</span>,
<span class="sig-arg">f</span>)</span>
</h3>
</td><td align="right" valign="top"
><span class="codelink"><a href="web2py.gluon.tools-pysrc.html#Service.json">source code</a></span>
</td>
</table>
example:
<pre class="literalblock">
service = Service(globals())
@service.json
def myfunction(a, b):
return [{a: b}]
def call():
return service()
</pre>
Then call it with:
<pre class="literalblock">
wget http://..../app/default/call/json/myfunction?a=hello&b=world
</pre>
<dl class="fields">
</dl>
</td></tr></table>
</div>
<a name="jsonrpc"></a>
<div>
<table class="details" border="1" cellpadding="3"
cellspacing="0" width="100%" bgcolor="white">
<tr><td>
<table width="100%" cellpadding="0" cellspacing="0" border="0">
<tr valign="top"><td>
<h3 class="epydoc"><span class="sig"><span class="sig-name">jsonrpc</span>(<span class="sig-arg">self</span>,
<span class="sig-arg">f</span>)</span>
</h3>
</td><td align="right" valign="top"
><span class="codelink"><a href="web2py.gluon.tools-pysrc.html#Service.jsonrpc">source code</a></span>
</td>
</table>
example:
<pre class="literalblock">
service = Service(globals())
@service.jsonrpc
def myfunction(a, b):
return a + b
def call():
return service()
</pre>
Then call it with:
<pre class="literalblock">
wget http://..../app/default/call/jsonrpc/myfunction?a=hello&b=world
</pre>
<dl class="fields">
</dl>
</td></tr></table>
</div>
<a name="xmlrpc"></a>
<div>
<table class="details" border="1" cellpadding="3"
cellspacing="0" width="100%" bgcolor="white">
<tr><td>
<table width="100%" cellpadding="0" cellspacing="0" border="0">
<tr valign="top"><td>
<h3 class="epydoc"><span class="sig"><span class="sig-name">xmlrpc</span>(<span class="sig-arg">self</span>,
<span class="sig-arg">f</span>)</span>
</h3>
</td><td align="right" valign="top"
><span class="codelink"><a href="web2py.gluon.tools-pysrc.html#Service.xmlrpc">source code</a></span>
</td>
</table>
example:
<pre class="literalblock">
service = Service(globals())
@service.xmlrpc
def myfunction(a, b):
return a + b
def call():
return service()
</pre>
The call it with:
<pre class="literalblock">
wget http://..../app/default/call/xmlrpc/myfunction?a=hello&b=world
</pre>
<dl class="fields">
</dl>
</td></tr></table>
</div>
<a name="amfrpc"></a>
<div>
<table class="details" border="1" cellpadding="3"
cellspacing="0" width="100%" bgcolor="white">
<tr><td>
<table width="100%" cellpadding="0" cellspacing="0" border="0">
<tr valign="top"><td>
<h3 class="epydoc"><span class="sig"><span class="sig-name">amfrpc</span>(<span class="sig-arg">self</span>,
<span class="sig-arg">f</span>)</span>
</h3>
</td><td align="right" valign="top"
><span class="codelink"><a href="web2py.gluon.tools-pysrc.html#Service.amfrpc">source code</a></span>
</td>
</table>
example:
<pre class="literalblock">
service = Service(globals())
@service.amfrpc
def myfunction(a, b):
return a + b
def call():
return service()
</pre>
The call it with:
<pre class="literalblock">
wget http://..../app/default/call/amfrpc/myfunction?a=hello&b=world
</pre>
<dl class="fields">
</dl>
</td></tr></table>
</div>
<a name="amfrpc3"></a>
<div>
<table class="details" border="1" cellpadding="3"
cellspacing="0" width="100%" bgcolor="white">
<tr><td>
<table width="100%" cellpadding="0" cellspacing="0" border="0">
<tr valign="top"><td>
<h3 class="epydoc"><span class="sig"><span class="sig-name">amfrpc3</span>(<span class="sig-arg">self</span>,
<span class="sig-arg">domain</span>=<span class="sig-default"><code class="variable-quote">'</code><code class="variable-string">default</code><code class="variable-quote">'</code></span>)</span>
</h3>
</td><td align="right" valign="top"
><span class="codelink"><a href="web2py.gluon.tools-pysrc.html#Service.amfrpc3">source code</a></span>
</td>
</table>
example:
<pre class="literalblock">
service = Service(globals())
@service.amfrpc3('domain')
def myfunction(a, b):
return a + b
def call():
return service()
</pre>
The call it with:
<pre class="literalblock">
wget http://..../app/default/call/amfrpc3/myfunction?a=hello&b=world
</pre>
<dl class="fields">
</dl>
</td></tr></table>
</div>
<a name="soap"></a>
<div>
<table class="details" border="1" cellpadding="3"
cellspacing="0" width="100%" bgcolor="white">
<tr><td>
<table width="100%" cellpadding="0" cellspacing="0" border="0">
<tr valign="top"><td>
<h3 class="epydoc"><span class="sig"><span class="sig-name">soap</span>(<span class="sig-arg">self</span>,
<span class="sig-arg">name</span>=<span class="sig-default">1</span>,
<span class="sig-arg">returns</span>=<span class="sig-default">1</span>,
<span class="sig-arg">args</span>=<span class="sig-default">1</span>,
<span class="sig-arg">doc</span>=<span class="sig-default">1</span>)</span>
</h3>
</td><td align="right" valign="top"
><span class="codelink"><a href="web2py.gluon.tools-pysrc.html#Service.soap">source code</a></span>
</td>
</table>
<pre class="literalblock">
example::
service = Service(globals())
@service.soap('MyFunction',returns={'result':int},args={'a':int,'b':int,})
def myfunction(a, b):
return a + b
def call():
return service()
The call it with::
from gluon.contrib.pysimplesoap.client import SoapClient
client = SoapClient(wsdl="http://..../app/default/call/soap?WSDL")
response = client.MyFunction(a=1,b=2)
return response['result']
Exposes online generated documentation and xml example messages at:
- http://..../app/default/call/soap
</pre>
<dl class="fields">
</dl>
</td></tr></table>
</div>
<a name="__call__"></a>
<div>
<table class="details" border="1" cellpadding="3"
cellspacing="0" width="100%" bgcolor="white">
<tr><td>
<table width="100%" cellpadding="0" cellspacing="0" border="0">
<tr valign="top"><td>
<h3 class="epydoc"><span class="sig"><span class="sig-name">__call__</span>(<span class="sig-arg">self</span>)</span>
<br /><em class="fname">(Call operator)</em>
</h3>
</td><td align="right" valign="top"
><span class="codelink"><a href="web2py.gluon.tools-pysrc.html#Service.__call__">source code</a></span>
</td>
</table>
<p>register services with: service = Service(globals()) @service.run
@service.rss @service.json @service.jsonrpc @service.xmlrpc
@service.jsonrpc @service.amfrpc @service.amfrpc3('domain')
@service.soap('Method', returns={'Result':int},
args={'a':int,'b':int,})</p>
<p>expose services with</p>
<p>def call(): return service()</p>
call services with http://..../app/default/call/run?[parameters]
http://..../app/default/call/rss?[parameters]
http://..../app/default/call/json?[parameters]
http://..../app/default/call/jsonrpc http://..../app/default/call/xmlrpc
http://..../app/default/call/amfrpc http://..../app/default/call/amfrpc3
http://..../app/default/call/soap
<dl class="fields">
</dl>
</td></tr></table>
</div>
<br />
<!-- ==================== NAVIGATION BAR ==================== -->
<table class="navbar" border="0" width="100%" cellpadding="0"
bgcolor="#a0c0ff" cellspacing="0">
<tr valign="middle">
<!-- Home link -->
<th> <a
href="web2py.gluon-module.html">Home</a> </th>
<!-- Tree link -->
<th> <a
href="module-tree.html">Trees</a> </th>
<!-- Index link -->
<th> <a
href="identifier-index.html">Indices</a> </th>
<!-- Help link -->
<th> <a
href="help.html">Help</a> </th>
<!-- Project homepage -->
<th class="navbar" align="right" width="100%">
<table border="0" cellpadding="0" cellspacing="0">
<tr><th class="navbar" align="center"
><a class="navbar" target="_top" href="http://www.web2py.com">web2py Web Framework</a></th>
</tr></table></th>
</tr>
</table>
<table border="0" cellpadding="0" cellspacing="0" width="100%%">
<tr>
<td align="left" class="footer">
Generated by Epydoc 3.0beta1 on Thu Aug 4 00:47:02 2011
</td>
<td align="right" class="footer">
<a href="http://epydoc.sourceforge.net">http://epydoc.sourceforge.net</a>
</td>
</tr>
</table>
<script type="text/javascript">
<!--
// Private objects are initially displayed (because if
// javascript is turned off then we want them to be
// visible); but by default, we want to hide them. So hide
// them unless we have a cookie that says to show them.
checkCookie()
// -->
</script>
</body>
</html>