writeInterface: Serialize generated interface to a file

Description Usage Arguments Details Value Author(s) See Also Examples

View source: R/writeGeneratedCode.R

Description

This function allows the user to take a programmatically generated interface such as with genSOAPClientInterface and write the code to a file for inclusion in an R package or to be source'd into a different R session.

Note that this is not essential. One can save the interface generated by genSOAPClientInterface in RDA format and then use load that into a different R session, potentially on a different machine, and the interface will work as is.

Usage

1
writeInterface(iface, file = stdout(), where = globalenv())

Arguments

iface

the interface object created via a call to genSOAPClientInterface

file

the name of the file to which to write the code.

where

the position or package name used to find the class definitions associated with this interface. This is passed to getClass.

Details

Currently, this has to handle deparseing S4 objects directly. Also, it undoes the use of environments within the functions to store the "cached" information about the operation and the SOAP server location. Instead, it adds these as explicit parameters and to the body of the code.

Value

This function is used for its side effect of writing content in the specified file

Author(s)

Duncan Temple Lang

See Also

genSOAPClientInterface processWSDL

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
w = processWSDL(system.file("examples", "KEGG.wsdl", package = "SSOAP"))
iface = genSOAPClientInterface(w)
f = tempfile()
writeInterface(iface, f)
source(f)
## Not run: 
db = list_databases()
class(db)
class(db[[1]])

## End(Not run)

u = "http://gmd.mpimp-golm.mpg.de/webservices/wsGoBioSpace.asmx?WSDL"
z = processWSDL(u, port = 1)
iface = genSOAPClientInterface(z)
f = tempfile()
writeInterface(iface, f)
source(f)

a = GetAdducts()
d = GetDepositors()

session = CreateSession(DepositorIds = c(3, 6, 8), AdductIds = c(2L, 3L))
sm = SearchMass12C(SessionID = session, mass = 579.1705, tolerance = 0.001)

sckott/SSOAP documentation built on Sept. 16, 2020, 5:49 p.m.