R: Serialize generated interface to a file

writeInterface {SSOAP} | R Documentation

## Serialize generated interface to a file

### 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

    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

    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)

[Package SSOAP version 0.91-0 Index]