R as a Service: statconnWS

statconnWS provides a web service implementation for R.


Quoting Wikipedia:

A 'web service' (also 'webservice') is traditionally defined by the W3C as “a software system designed to support interoperable machine-to-machine interaction over a network. It has an interface described in a machine-processable format (specifically Web Services Description Language WSDL). Other systems interact with the web service in a manner prescribed by its description using SOAP messages, typically conveyed using HTTP with an XML serialization in conjunction with other web-related standards.”

Web Service?

statconnWS provides full access to R by means of a SOAP/http web service. The interface has been closely modeled after statconnDCOM. While this may not be the best approach for implementing a service-oriented architecture in your application, it should be seen as a first step and can easily be used by anyone familiar with statconnDCOM.

The web service is available from http://localhost:9090/services/StatConnector, the required WSDL from http://localhost:9090/services/StatConnector?wsdl

Supported Web Servers

statconnWS is based on Apache Axis2/C and therfore can be used with the following web servers:

  • standalone (this is the default after installation of statconnWS)
  • Apache (as a module)
  • Microsoft Internet Information Server (IIS, as a module)

Operating Systems

The implementatino of statconnWS is fully cross-platform. The development and test version is available for Windows only. The release versions will be available for all our standard platforms:

  • Windows
  • Linux
  • if required, MacOS X

If you want to have a test setup for Linux, please contact mailto:info@statconn.com

64-Bit

The Windows version of statconnWS will be 32bit only as long as there is only a 32bit version of R available.

For Linux (and of course for MacOS X), 64bit versions of statconnWS will be available, too.

Cross-Platform

Web services via SOAP/http are truly cross-platform. E.g., you can create a 32bit application for Windows and use the full power of 64bit R on Linux via statconnWS.

Client Development

Currently, statconnWS only contains an example application written in C# (.NET). I am working on an example written in Java and many other languages can be used to access statconnWS, too:

  • .NET (VB.NET, C#, C++)
  • .NET Compact Framework for devices (e.g. hand-helds, CE-based displays)
  • Mono (C#) e.g. on Linux or MacOS X systems, or on the iPhone
  • MS Office
  • Java (on Windows, Linux,…)
  • PHP

Client Installation

No components of statconnWS must be installed on the client machine. In contrast to statconnDCOM, no administrative permissions on the client are required for installation.

Getting Started

Download and install statconnWS for Windows from the download page at http://rcom.univie.ac.at/. A simple example in C# is installed together with statconnWS

Installation on Windows 2000SP4

The current setup also installs OpenSSL 0.9.8l binaries. These binaries require VC++ 2008 Runtime libraries. The runtime libraries will not install on plain Windows 2000SP4.

Please also install the additional fix KB835732.

Crashes of statconnWS on the first call

Currently statconnWS is Beta only. If the R interpreter cannot be found/initialized, the web service (and the server) will crash on the first call into the service. Of course this will change in the future, but please bear with it for the moment.

Support

A special course on statconnWS (using, installing, web servers) will be provided soon. Please send a message to mailto:courses@statconn.com if you are interested.

Examples

A very simple example is installed with statconnWS. Additional examples will be provided soon.

.NET

Data Types

Scalars

  • int
  • double
  • string
  • bool

1-dimensional Arrays (always passed as Object[]) can contain

  • int
  • double
  • string
  • bool
  • mixed

2-dimensional Arrays have to be passed as jagged arrays (Object[][]) can contain any of

  • int
  • double
  • string
  • bool
  • mixed

Reading an 1-dimensional Array

localhost.StatConnector lStatConnector = new localhost.StatConnector();

Object[] lRndData;

lStatConnector.EvaluateNoReturn(“rndData←runif(10000)”);

lRndData = (Object[]) lStatConnector.GetSymbol(“rndData”);

Writing an 2-dimensional Array

localhost.StatConnector lStatConnector = new localhost.StatConnector();

Object[][] lTwoDimArray = new Object[3][];

lTwoDimArray[0] = new Object[] { 28,28.5};

lTwoDimArray[1] = new Object[] { “28”,“String”};

lTwoDimArray[2] = new Object[] { 3.28,“Juhu”};

lStatConnector.SetSymbol(“myvar”,lTwoDimArray);

Java


Personal Tools