An XML-RPC interface to AMICO. It runs and XML-RPC server, enabling other modules to update and read variables, and in also enables definition of XML-RPC adapters, that map variables from the communicator to method calls on other XML-RPC servers (see Configuration section in this document for details).
java -jar %AMICO_HOME%/bin/amico-xmlrpc.jar [<conf-url>]
Return type | Method name | Argument(s) | Description |
string | updateVariable | string variableName, string variableValue |
Updates the variable. If the variable does not exist, it will be added. Always returns an empty string*. |
string | deleteVariable | string variableName | Deletes the variable. If the variable does not exists, nothing happens. Always returns an empty string*. |
string | loadTransformation | string transformationURL | Loads XSLT transformation for derivation of new variables. |
string | removeTransformation | string transformationURL | Removes XSLT transformation for derivation of new variables. |
string | populateTemplate | string template | On request population of templates. Values inside <%=variable-name%> will be replaced with the value of the variable. For example template "User age = <%=age%>", with variable age updated to 27, will be populated to "User age 27". |
string | get | string listOfVariables | Returns comma separated list of values for given variable names. |
string | getXml | string listOfVariables | Returns comma separated, XML encoded list of values for given variable names. For example "<varaibles><variable name='age'>26</variable></variables>" |
string | getAllXml | string listOfVariables | Returns comma separated, XML encoded list of values for all variables. |
* AS XML-RPC does not support function with void return type, updateVariable,
deleteVariable, loadTransformation, removeTransformation are defined with as
string type, but they always return an empty string.
A main configuration file:
This is a minimal configuration file that uses default
parameters for missing attributes. --------------------------------------------- <?xml version="1.0"
encoding="UTF-8"?> <xml-rpc-adapter
url="file:conf/xmlrpc/concept-net-adapter.xml"/> |
This is a full configuration file that overrides default parameters. --------------------------------------------- <?xml version="1.0"
encoding="UTF-8"?> <communicator host="localhost"
port="3320"> <command>UPDATE
last-loaded-module XML-RPC</command>
|
A configuration file for XML-RPC adapter variables (linked from a main
configuration file):
<?xml version="1.0" encoding="UTF-8"?> <xml-rpc-adapter default-server="http://localhost:8000"> <!-- When a variable text-context changes,
call a method guess_mood on XML-RPC server http://localhost:8000
with one parameter (value of variable text-context)
<method-call server="http://localhost:3096"
method="test.<%=math%>" trigger-variables="a,b,math"> </xml-rpc-adapter> |
This is simple Java program that call updateVariable method using Apache Java XML-RPC library.
import java.util.Vector;
public class XmlRpcTest { public static void main( String
args[] ) {
Vector params = new Vector (); params.addElement( "27" );
xmlrpc.execute( "updateVariable", params );
e.printStackTrace(); } } |