加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 综合聚焦 > 服务器 > Linux > 正文

如何将SOAP请求curl转换为RCurl

发布时间:2020-12-14 01:23:53 所属栏目:Linux 来源:网络整理
导读:我应该如何转换这一个班轮: curl -d @request.xml -o response.xml http://www.sample.com/soap 它正在访问请求xml,如下所示: ?xml version="1.0" encoding="utf-8"? soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:req="ht
我应该如何转换这一个班轮:

curl -d @request.xml -o response.xml http://www.sample.com/soap

它正在访问请求xml,如下所示:

<?xml version="1.0" encoding="utf-8"?>
     <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:req="http://sample.com/">
    <soap:Body>
      <req:getEvents>
        <start>2014-12-12T00:00:00+0100</start>
        <end>2014-12-13T00:00:00+0100</end>
        <type>TYPE</type>
      </req:getEvents>
     </soap:Body>
    </soap:Envelope>

响应将写入response.xml
我想直接读回r的回复

解决方法

这是httr的方法:

library(httr)
r <- POST("http://www.sample.com/soap",body = upload_file("request.xml"))
stop_for_status(r)
content(r)

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读