带有 WSDL for R 的 SOAP 客户端 [英] SOAP Client with WSDL for R

查看:29
本文介绍了带有 WSDL for R 的 SOAP 客户端的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用 SSOAP 包为带有 R 的 SOAP 客户端编写代码.这是我的初始代码:

I'm trying to write a code for a SOAP client with R using the SSOAP package. This was my inicial code:

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 功能,但我还不能生成客户端功能.错误信息是:

But I think the WSDL documentation is too complex (multi-dimensional) for the functions. I tried (this and many other things) to simplify the WSDL choosing just one service, and it helped me with the processWSDL function, but I cannot generate the client functions yet. The error message is:

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

请问,有人可以帮我吗?

Please, could somebody help me?

推荐答案

RCurl 包帮助我们做到这一点(参见 http://www.stat.wvu.edu/~jharner/courses/stat623/docs/RCurlJSS.pdf):

The RCurl package helps us to do this (see an example on 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

如果你有更简单(或更优雅)的东西并想分享,欢迎分享!

If you have something easier (or more elegant) and want to share will be welcome!

谢谢!

这篇关于带有 WSDL for R 的 SOAP 客户端的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆