genSOAPClientInterface(SSOAP)
genSOAPClientInterface()所属R语言包:SSOAP
Create R functions to access SOAP server methods
创建R函数来访问SOAP服务器的方法
译者:生物统计家园网 机器人LoveR
描述----------Description----------
This function creates function definitions, etc. that provide access to the methods described in the SOAP server description details.
这个函数创建函数定义等,提供在SOAP服务器的描述细节描述的方法的访问。
用法----------Usage----------
genSOAPClientInterface(operations = def@operations[[1]], def, name = def@name,
env = new.env(parent = globalenv()), where = globalenv(),
server = def@server, nameSpaces = def@nameSpaces,
addSoapHeader = FALSE, verbose = FALSE, force = FALSE,
putFunctions = FALSE, verb = def@verb,
opFun = getOperationFunction(verb), opts = new("CodeGenOpts"), ...)
参数----------Arguments----------
参数:operations
a list of the descriptions of the server's methods. Each method description provides information about the parameters and the return value.
服务器的方法的描述列表。每个方法的说明,提供有关参数和返回值。
参数:def
the SOAPServerDescription-class object.
SOAPServerDescription-class对象。
参数:name
currently unused
目前未使用
参数:env
an environment object. This is used ?
环境对象。这是用来?
参数:where
the location (usually in the search path) where new S4 classes will be defined to represent the complex return types. This can be any value that is acceptable for the where argument of setClass, i.e. an integer, a package name (“package:name”) or, explicitly, an environment.
新的S4类的地方将被定义为代表的复杂的返回类型的位置(通常在搜索路径)。这可以是任何值,这是可以接受的where参数setClass,即一个整数,包的名称(“包名称”),或者明确的环境。
参数:server
an object which will be used as the server in the SOAP calls. This provides the user with a mechanism to provide an alternative server object such as one which contains a password or which already has a connection to the SOAP server, or controls the connection in different ways.
一个对象,将被用作服务器的SOAP调用。这提供了一个机制,以提供一个替代,如一个服务器对象,其中包含一个密码或已经有一个SOAP服务器的连接,或以不同的方式控制连接的用户。
参数:nameSpaces
a character vector that identifies the namespace-URI mappings used for calls to this server. This maps the namespace abbreviations to the actual URIs. This can be a named character vector of these mappings, or alternatively a simple character string that identifies the name of the element in the .SOAPDefaultNameSpaces list. And if we don't know the collection of namespaces, we use NA to indicate that we shall determine this later.
一个字符向量标识命名空间的URI用于调用此服务器的映射。这将映射到实际的URI命名空间的缩写。这可能是这些映射的命名特征向量,或者一个简单的字符串,标识.SOAPDefaultNameSpaces列表元素的名称。如果我们不知道的命名空间的集合,我们使用NA表明,我们应确定以后。
参数:addSoapHeader
controls whether a .soapHeader parameter is added to each function that is generated for the SOAP server. If this is a logical, TRUE indicates to add the .soapHeader parameter; FALSE indicates it is omitted. If this is not a logical value, it is taken as the value to be supplied as the default value for the .soapHeader parameter in each generated function.
.soapHeader参数是否被添加到SOAP服务器生成的每个功能的控制。如果这是一个逻辑,TRUE表示添加.soapHeader参数的;FALSE表示省略。如果这不是一个逻辑值,它提供作为.soapHeader在每个生成的函数的参数的默认值的值。
参数:verbose
a logical indicating whether information about the processing should be displayed on the console, as it occurs.
逻辑说明有关处理的信息是否应在控制台上显示,因为它发生。
参数:force
a logical value that controls how we handle the case where we would define an S4 class corresponding to a data type in the schema but for which there already exists a class of that name (within the environment in which we are defining the schema-related classes). TRUE means that we will overwrite the existing class definition; FALSE means to leave the existing class definition. This is useful when we run the interface generation code a second time and so have existing class defintions from the first run.
一个逻辑值,控制我们如何处理的情况下,我们将定义一个S4类对应到架构中的数据类型,但其中有已经存在的类名称(在我们所处的环境定义模式相关的类)。 TRUE意味着我们将覆盖现有的类的定义;FALSE意味着离开现有的类定义。这是有用的,当我们运行界面生成代码的第二次,所以从第一次运行现有类defintions。
参数:putFunctions
either a logical value or an environment or something that can be passed as the third argument to assign. This controls whether we assign the individual functions as variables in where or another environment.
无论是逻辑值或环境或东西,可以作为第三个参数传递到assign。这控制,无论我们作为where或其他环境中的变量分配的个别功能。
参数:opts
an instance of the class CodeGenOpts or a derived sub-class that is used to specify the parameters that control the sub-functions that generate the code. At present, this is limited to the makePrototype slot that controls whether we map string elements to empty "" strings rather than zero-length character vectors. Whether this is a good choice depends on the Web service/interface and if it's WSDL deals with optional values properly.
类的一个实例CodeGenOpts或派生子类,用于指定的参数控制的子功能,生成的代码。目前,这是有限的makePrototype槽控制,我们是否将字符串元素映射到空""字符串,而不是零长度字符向量。这是否是一个不错的选择依赖于Web服务/接口,如果是可选值的WSDL交易正常。
参数:verb
a string identifying the type of binding/transport for the requests. This can be "GET", " OST" or NA which is the default and refers to the regular SOAP messaging.
一个字符串,确定请求的类型的绑定/运输。这可以是“GET”,“POST”,或NA这是默认的,是指正规的SOAP消息。
参数:opFun
the function for creating the R function for each operation. This depends on verb to generate different functions for different transportation mechanisms.
为每个操作创建R函数的功能。这取决于verb产生不同功能,不同的运输机制。
参数:...
additional arguments passed to processSchemaTypes
额外的参数传递processSchemaTypes
值----------Value----------
An object of class SOAPClientInterface containing both functions and class definitions.
一个类的对象SOAPClientInterface包含两个函数和类的定义。
作者(S)----------Author(s)----------
Duncan Temple Lang <duncan@wald.ucdavis.edu>
参考文献----------References----------
http://www.omegahat.org/SSOAP, http://www.omegahat.org/bugs.
参见----------See Also----------
processWSDL
processWSDL
举例----------Examples----------
kegg = processWSDL("http://soap.genome.jp/KEGG.wsdl")
# note that we force the use of the 1.1 name spaces to get arrays[我们注意到,强制使用1.1名字空间得到数组]
# handled correctly on the server side.[正确处理在服务器端。]
iface = genSOAPClientInterface(def = kegg, nameSpaces = "1.1")
## Not run: [#无法运行:]
# This KEGG.wsdl is out of date[这KEGG.wsdl是过时的]
tmp = processWSDL(system.file("examples", "KEGG.wsdl", package = "SSOAP"))
iface = genSOAPClientInterface(tmp@operations[[1]], def = tmp, tmp@name, verbose=FALSE)
## End(Not run)[#结束(不运行)]
setAs("Definition", "character",
function(from)
structure(from@entry_id, names = from@definition))
setAs("ArrayOfPathwayElement", "character",
function(from) sapply(from, as, "character"))
o = iface@functions$list_organisms()
as(o, "character")
cat("See the file", system.file("examples", "KEGG.S", package = "SSOAP"), "for more examples\n")
# Returns National Weather Service digital weather forecast data. [返回国家气象局的数字天气预报数据。]
w = processWSDL("http://www.weather.gov/forecasts/xml/SOAP_server/ndfdXMLserver.php?wsdl")
f = genSOAPClientInterface(,w)
# For the next 5 days from now.[从现在起未来5天。]
str = f@functions$NDFDgenByDay(38.9936, -77.0224, Sys.time() + 60*24*60, 5, "12 hourly")
library(XML)
xmlToList(xmlParse(str, asText = TRUE))
# Note that the result is a string containing XML. The WSDL identifies the result[请注意,结果是一个包含XML的字符串。 WSDL识别结果]
# as an xsd:string and does not tell us about the structure of the contents.[作为一个xsd:string,并没有告诉我们的内容结构。]
##[#]
## WABI[#WABI]
if(FALSE) {
# This site was not available May 4th.[这个网站是不是“五四”。]
w = processWSDL("http://xml.nig.ac.jp/wsdl/ARSA.wsdl")
f = genSOAPClientInterface(,w )
f@functions$searchSimple("Homo sapiens", 1, 100)
x = f@functions$getENTRYbySPECIMEN("ATCC 43049", 1, 100)
x = f@functions$getENTRYbyScientificName("Escherichia coli", 1, 400)
els = readLines(textConnection(x))
# get how many results are available in the database.[得到多少结果是在数据库中。]
totalCount = as.integer(substring(els[1], nchar("hitscount = ")+1))
hits = els[-1] # the 400 results in the answer[在回答的400结果]
x = f@functions$searchByXMLPath("/ENTRY/DDBJ/accessions/accn='ab0001'",
"/ENTRY/DDBJ/primary-accession,/ENTRY/DDBJ/definition",
1, 100)
els = unlist(strsplit(x, "\\n"))
totalCount = as.integer(substring(els[1], nchar("hitscount = ")+1))
values = strsplit(els[-1], "\\t")
ans = structure(sapply(values, `[`, 2), names = sapply(values, `[`, 1))
###[#]
w = processWSDL("WSDLs/MassSpecAPI.asmx?WSDL", port = 1)
f = genSOAPClientInterface(w)
# SearchByMass2 expects an object of class SearchByMass2 which has[SearchByMass2预计对象的类SearchByMass2具有]
# a mass and a range slot. But we can specify these separately, by[大规模和范围插槽。但是,我们也可以指定这些分开,由]
# name or partial name, or as a list or as a SearchByMass2 object[名称或部分名称,或作为一个列表或作为SearchByMass2对象]
f@functions$SearchByMass2(89.0476, .01)
f@functions$SearchByMass2(mass = 89.0476, range = .01)
f@functions$SearchByMass2(range = .01, mass = 89.0476)
f@functions$SearchByMass2(list(range = .01, mass = 89.0476))
f@functions$SearchByMass2(new("SearchByMass2", range = .01, mass = 89.0476))
####[###]
# A HTTP GET interface[一个HTTP GET接口]
w = processWSDL("WSDLs/MassSpecAPI.asmx?WSDL", port = 3)
f = genSOAPClientInterface(w)
f@functions$GetDatabases()
f@functions$SearchByMass2(89.0476, .01)
f@functions$SearchByFormula("H2O")
## Not run: [#无法运行:]
# ned the token[定义令牌]
f@functions$GetExtendedCompoundInfoArray(c("23500", "23543"), token)
f@functions$GetExtendedCompoundInfoArray(as.character(c(23500, 23543)), token)
## End(Not run)[#结束(不运行)]
##########[#########]
w = processWSDL("WSDLs/MassSpecAPI.asmx?WSDL", port = "MassSpecAPIHttpPost")
f = genSOAPClientInterface(w)
names(f@functions)
db = f@functions$GetDatabases()
f@functions$SearchByMass2(89.0476, .01)
## Not run: [#无法运行:]
# ned the token[定义令牌]
f@functions$GetExtendedCompoundInfoArray(c("23500", "23543"), token)
f@functions$GetExtendedCompoundInfoArray(as.character(c(23500, 23543)), token)
## End(Not run)[#结束(不运行)]
}
转载请注明:出自 生物统计家园网(http://www.biostatistic.net)。
注:
注1:为了方便大家学习,本文档为生物统计家园网机器人LoveR翻译而成,仅供个人R语言学习参考使用,生物统计家园保留版权。
注2:由于是机器人自动翻译,难免有不准确之处,使用时仔细对照中、英文内容进行反复理解,可以帮助R语言的学习。
注3:如遇到不准确之处,请在本贴的后面进行回帖,我们会逐渐进行修订。
|