I meant to blog about this a long time ago, but I never actually got to it. In August, I implemented an extension to the call mechanism in Uiml.net that allows a UIML interface to call external application logic via the XML-RPC protocol.
I made an example UIML interface, which connects to the UserLand Betty server at betty.userland.com. It then resolves the state name from a state code entered by the user. Here are some screenshots of the rendered interface:
We use the standard UIML call tag. Here’s how we specify the behavior of the user interface:
<behavior> <rule> <condition> <event part-name="go" class="ButtonPressed"/> </condition> <action> <property part-name="stateName" name="text"> <call name="Betty.GetStateName"> <param> <property part-name="stateCode" name="text"/> </param> </call> </property> </action> </rule> </behavior> |
The XML-RPC web service is described in the logic part like this:
<logic> <d-component id="Betty" location="xmlrpc://betty.userland.com/RPC2"> <d-method id="GetStateName" returns-value="System.String" maps-to="examples.getStateName"> <d-param id="code" type="System.Int32"/> </d-method> </d-component> </logic> |
What has changed is that Uiml.net now checks for a protocol handler in the location attribute. If it’s xmlrpc://, we try to resolve the call using XML-RPC. Remember that local calls just specify the maps-to attribute.
We didn’t implement XML-RPC communication from scratch, but used a simple XML-RPC library for .NET: XmlRpcCS. The project seems to be dead since 2003, but it still works fine.
Takis has provided packages for XmlRpcCS (xmlrpccs) itself and for the dynamic Uiml.net XML-RPC glue library (uimlnet-xml-rpc).
