带有WSDL for R的SOAP客户端

时间:2015-09-15 19:49:56

标签: r web-services soap wsdl

我正在尝试使用SSOAP包为R编写SOAP客户端的代码。这是我的官方代码:

wsdl <- getURL("http://sistemas.cvm.gov.br/webservices/Sistemas/SCW/CDocs/WsDownloadInfs.asmx?WSDL")
def <- processWSDL(doc, verbose = TRUE)
ff  <- genSOAPClientInterface(def = def, verbose = TRUE)

但我认为WSDL文档对于函数来说过于复杂(多维)。我尝试(这个和许多其他的东西)来简化WSDL只选择一个服务,它帮助我使用processWSDL函数,但我还不能生成客户端函数。错误消息是:

Error: evaluation nested too deeply: infinite recursion / options(expressions=)?
Error during wrapup: evaluation nested too deeply: infinite recursion / options(expressions=)?

拜托,有人能帮助我吗?

1 个答案:

答案 0 :(得分:3)

RCurl包帮助我们执行此操作(请参阅http://www.stat.wvu.edu/~jharner/courses/stat623/docs/RCurlJSS.pdf上的示例):

library(RCurl)
library(XML)

###############
#### Login ####
###############

headerfields = c(
Accept = "text/xml",
Accept = "multipart/*",
'Content-Type' = "text/xml; charset=utf-8",
SOAPAction = "http://www.cvm.gov.br/webservices/Login"
)

body = "<?xml version='1.0' encoding='utf-8'?>
<soap:Envelope xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' xmlns:xsd='http://www.w3.org/2001/XMLSchema' xmlns:soap='http://schemas.xmlsoap.org/soap/envelope/'>
<soap:Header>
<sessaoIdHeader xmlns='http://www.cvm.gov.br/webservices/'>
<Guid>8200ac01-bfb5-46d6-a625-38108141fb33</Guid>
<IdSessao>135128883</IdSessao>
</sessaoIdHeader>
</soap:Header>
<soap:Body>
<Login xmlns='http://www.cvm.gov.br/webservices/'>
<iNrSist>XXXX</iNrSist>
<strSenha>XXXXX</strSenha>
</Login>
</soap:Body>
</soap:Envelope>"

reader = basicTextGatherer()

curlPerform(
url = "http://sistemas.cvm.gov.br/webservices/Sistemas/SCW/CDocs/WsDownloadInfs.asmx",
httpheader = headerfields,
postfields = body,
writefunction = reader$update
)

xml <- reader$value()
xml

您必须对http://sistemas.cvm.gov.br/webservices/Sistemas/SCW/CDocs/WsDownloadInfs.asmx

中的每个功能执行类似的操作

如果你有更容易(或更优雅)的东西,欢迎分享,欢迎光临!

韩国社交协会!

相关问题