xmlrpc.lzx
<library>
<include href="rpc/rpc.lzx"/>
<include href="rpc/library/xmlrpc.js"/>
<class name="xmlrpc" extends="rpc">
<attribute name="service" value="$once{null}" type="string"/>
<attribute name="_verifywithproxy" value="false
" type="boolean"/>
<method name="load">
// Since there aren't any prototypes to load for XML-RPC,
// we just create proxy using declared calls.
for (var cn=0, len=this.subnodes.length; cn<len; cn++) {
// create proxy object if it doesn't exist
if (this.proxy == null) this.proxy = {};
var call = this.subnodes[cn];
if ( ! (call instanceof lz.remotecall) ) continue;
var method = call.funcname;
// create proxy for a particular funcname only once.
if ( this.proxy[method] == null ) {
this.proxy[method] = function (paramArr, delegate) {
var args = arguments.callee.args;
LzXMLRPCService.invoke(delegate, paramArr,
{ service: args.service, methodname: args.method},
args.secure, args.secureport);
}
this.proxy[method].args = {
service: this.service,
method: method,
secure: this.secure,
secureport: this.secureport
}
}
}
this._loadDel.execute(
{ status: 'ok', message: 'ok',
stub: this.proxy, stubinfo: null }
);
</method>
<method name="init">
if (this.service == null) {
Debug.write("xmlrpc ERROR: service not defined");
return;
}
super.init();
</method>
<doc>
<tag name="shortdesc">
<text>XML-RPC implementation</text>
</tag>
<text>
<p>XML-RPC is simple spec that describes how to invoke a remote operation using
XML over HTTP. Laszlo XML-RPC is part of <link linkend="rpc">Laszlo RPC</link> and shares many of the same APIs and concepts.
Laszlo RPC includes <link linkend="rpc-soap">SOAP</link> and <link linkend="rpc-javarpc">JavaRPC</link>. For more information on XML-RPC,
go to <a href="http://www.xmlrpc.com/" shape="rect">XML-RPC.com</a>
</p>
<p>Most Laszlo RPC objects like JavaRPC and SOAP will set function stubs in the
proxy property during load based on methods described by a class (for JavaRPC)
or on a service description (using a WSDL in SOAP). Remotecall declarations
refer to these function stubs and any remotecalls not pointing to a function
stub that doesn't exist will generate an error/warning. In <xmlrpc>,
function stubs are created based on remotecall declarations. Note that XML-RPC
use dot notation for their operation names. Because that will conflict with the
view system's notation, it's suggested that remotecalls are explictly named.</p>
<example>
<canvas debug="true" height="400">
<debug x="10" y="40" width="450" height="350"/>
<xmlrpc name="math" service="http://www.cookcomputing.com/xmlrpcsamples/math.rem">
<handler name="onload">
Debug.debug('math XML-RPC service loaded');
Debug.debug('proxy:');
Debug.inspect(this.proxy);
</handler>
<handler name="ondata" args="data">
Debug.debug('got data: %w', data);
</handler>
<handler name="onerror" args="error">
Debug.debug('onerror: %w', error);
</handler>
<remotecall name="add" funcname="math.Add"/>
<remotecall name="subtract" funcname="math.Subtract"/>
<remotecall name="multiply" funcname="math.Multiply"/>
<remotecall name="divide" funcname="math.Divide"/>
</xmlrpc>
<button text="100+200" x="10" y="10">
<handler name="onclick">
Debug.debug('100+200');
math.add.invoke([100,200]);
</handler>
</button>
</canvas>
</example>
<p><b>See Also:</b></p>
<ul>
<li>
<sgmltag class="element" role="lz.rpc"><rpc></sgmltag>
</li>
<li>
<sgmltag class="element" role="lz.javarpc"><javarpc></sgmltag>
</li>
<li>
<sgmltag class="element" role="lz.soap"><soap></sgmltag>
</li>
<li>
<sgmltag class="element" role="lz.remotecall"><remotecall></sgmltag>
</li>
<li>
<link linkend="rpc">Developer's Guide: RPC chapter</link>
</li>
<li>
<link linkend="rpc-xmlrpc">Developer's Guide: XMLRPC chapter</link>
</li>
</ul>
</text>
</doc>
</class>
</library>
Cross References
Includes
Classes
- <class name="xmlrpc" extends="rpc">