From BioAssist
Jump to: navigation, search

Matlab has no build in support for XML-RPC. You can use the Apache XML-RPC libraries to connect to XML-RPC servers from Matlab.



Make sure that the jars are added to your Matlab java path. Use 'edit classpath.txt' and add the jars to this file. Don't forget to include the ws-commons jar.

Calling a web-service

Java objects are created with the javaObject command. We'll use that to setup a connection to CytoscapeRPC.

  1. % Setting up the client
  2. client = javaObject('org.apache.xmlrpc.client.XmlRpcClient')
  3. config = javaObject('org.apache.xmlrpc.client.XmlRpcClientConfigImpl')
  4. url = javaObject('', 'http://localhost:9000/Cytoscape')
  5. config.setServerURL(url)
  6. client.setConfig(config)
  7. % We now have a working client and we can execute remote functions.
  8. client.execute('Cytoscape.test', '')
  9. % This command returns 'It works!', which shows that the connection works correctly.