Package 'xmlrpc2'

Title: Implementation of the Remote Procedure Call Protocol ('XML-RPC')
Description: The 'XML-RPC' is a remote procedure call protocol based on 'XML'. The 'xmlrpc2' package is inspired by the 'XMLRPC' package but uses the 'curl' and 'xml2' packages instead 'RCurl' and 'XML'.
Authors: Florian Schwendinger [aut, cre]
Maintainer: Florian Schwendinger <[email protected]>
License: GPL-3
Version: 1.1
Built: 2024-12-23 06:19:50 UTC
Source: CRAN

Help Index


Convert from the XML-RPC Format into an R Object.

Description

Convert an object of class "xml_code" or a character in the XML-RPC Format into an R Object.

Usage

from_xmlrpc(xml, raise_error = TRUE)

Arguments

xml

a character string containing XML in the remote procedure call protocol format.

raise_error

a logical controling the behavior if the XML-RPC signals a fault. If TRUE an error is raised, if FALSE an object inheriting from "c("xmlrpc_error", "error")" is returned.

Value

an R object derived from the input.

Examples

params <- list(1L, 1:3, rnorm(3), LETTERS[1:3], charToRaw("A"))
xml <- to_xmlrpc("some_method", params)
from_xmlrpc(xml)

Convert R Objects into the XML-RPC Format

Description

Serialize R Objects so they can be passed to to_xmlrpc as parameters.

Usage

rpc_serialize(x, ...)

Arguments

x

an R object.

...

additional optional arguments (currently ignored).

Value

an object of class "xml_node".

Examples

rpc_serialize(1L)
rpc_serialize(1:2)
rpc_serialize(LETTERS[1:2])

Create a XML-RPC Call

Description

abc

Usage

to_xmlrpc(method, params)

Arguments

method

a character string giving the name of the method to be invoked.

params

a list containing the parmeters which are added to the XML file sent via the remote procedure call.

Value

an object of class "xml_node" containing a XML-RPC call.

Examples

params <- list(1L, 1:3, rnorm(3), LETTERS[1:3], charToRaw("A"))
cat(as.character(to_xmlrpc("some_method", params)))

Call the Remote Procedure

Description

Call a reomte procedure with the XML-RPC protocol.

Usage

xmlrpc(url, method, params = list(), handle = NULL, opts = list(),
  convert = TRUE, useragent = "xmlrpc", raise_error = TRUE)

Arguments

url

a character string giving the url to the server.

method

a character string giving the name of the method to be invoked.

params

a list containing the parmeters which are added to the XML file sent via the remote procedure call.

handle

a object of class "curl_handle".

opts

a list of options passed to the function "handle_setopt".

convert

a logical, if convert is TRUE (default) the curl response is converted else it is left unchanged.

useragent

a character string giving the name of the "User-Agent".

raise_error

a logical controling the behavior if the status code of curl_fetch_memory signals an error. If raise_error is TRUE an error is raised, if raise_error is FALSE no error is raised and an object inheriting from c("fetch_error", error")} is returned. This object is the return value from \code{curl_fetch_memory} where just the class \code{c("fetch_error", error") is added.

Value

the reponse of curl or the response converted to R objects.

Examples

## Not run: 
url <- "https://www.neos-server.org"
xmlrpc(url, "listAllSolvers")
xmlrpc(url, "listSolversInCategory", params = list(category = "socp"))

## End(Not run)