我试图使用SSOAP包访问web服务器。我很难弄清楚如何处理成功的.SOAP()调用的结果。
下面是来自用户指南的一个例子
s1 <- SOAPServer("services.soaplite.com", "interop.cgi")
test <- .SOAP(s1,
"echoString", "From R",
action="urn:soapinterop",
xmlns=c(namesp1="http://soapinterop.org/"),
handlers =NULL)这似乎有效,返回的列表为2,其中头信息在第一个列表中,内容位于第二个列表中:
> str(test)
List of 2
$ header : Named chr [1:8] "Wed, 25 Jun 2014 15:53:31 GMT" "Apache" "SOAP::Lite/Perl/0.55" "534" ...
..- attr(*, "names")= chr [1:8] "Date" "Server" "SOAPServer" "Content-Length" ...
$ content: chr "<?xml version=\"1.0\" encoding=\"UTF-8\"?><SOAP-ENV:Envelope xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:SOAP"| __truncated__
- attr(*, "class")= chr "SOAPHTTPReply"我需要对content做一些有用的事情,即将它转换为某种类型的R对象。如果我正确地遵循用户手册,我应该能够使用convertFromSOAP()。注意-手册引用了一个似乎不再存在的fromSOAP()函数,但是仔细阅读包内容显示了covertFromSOAP()。然而,这是失败的:
> convertFromSOAP(test)
Error in (function (classes, fdef, mtable) :
unable to find an inherited method for function ‘convertFromSOAP’ for signature ‘"SOAPHTTPReply"’就像我尝试过的其他功能的化身一样。
有人想过如何从.SOAP()命令中获取可用的R对象吗?或者,您可以建议SSOAP包的替代方案吗?
谢谢!-Chase
发布于 2014-07-02 09:49:23
该示例关闭所有处理程序,以便自己解析XML字符串:
xpathApply(xmlParseDoc(test$content),'//return',xmlValue)SSOAP文档是很困难的。
https://stackoverflow.com/questions/24413505
复制相似问题