Learn R Programming

rneos (version 0.4-0)

xml.rpc: Invoke XML-RPC method from R

Description

This function can be used to invoke a method provided by an XML-RPC (remote procedure call) server. It can pass R objects in the request by serializing them to XML format and also converts the result back to R.

Usage

xml.rpc(url, method, ..., .args = list(...), .opts = list(),
        .defaultOpts = list(httpheader = c("Content-Type" = "text/xml"),
                            followlocation = TRUE,
                            useragent = useragent),
         .convert = TRUE, .curl = getCurlHandle(),
          useragent = "R-XMLRPC")

Arguments

url

the URL of the XML-RPC server

method

a string giving the name of the XML-RPC method to invoke

a collection of argument valuesn

.args

an alternative way to specify the collection (list) of arguments

.opts

a list of options passed on to postForm. This is for the caller to specify server-specific curl options as opposed to general XML-RPC options which are set via .defaultOpts.

.defaultOpts

standard/default RCurl options used when making this call

.convert

either a logical value indicating whether to perform the defalt conversion (via convertToR) or not, or alternatively a function which is called with a string giving the body of the HTTP response of the XML-RPC call.

.curl

a CURLHandle object that the caller can specify to allow reusing existing handles and connections. This can greatly improve efficiency.

useragent

the string identifying the application that is reported to the Web server as making the request.

Value

If .convert is a logical value and TRUE, an R object giving the result of the XML-RPC method invocation. If .convert is FALSE, a string giving the body of the response.

If .convert is a function, it is called with the body of the XML-RPC response as a string.

References

http://www.xmlrpc.com http://www.cafeconleche.org/books/xmljava/chapters/ch02s05.html for a DTD for XML-RPC and examples and discussion.

See Also

postForm getURL and REST Web services SSOAP package.