How to convert SOAP request curl to RCurl

蹲街弑〆低调 提交于 2021-02-09 00:26:34

问题


How should I convert this one liner:

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

It is accessing request xml which looks like this:

<?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>

The response is written into response.xml I would like to read the response directly into r


回答1:


Here's how with httr:

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


来源:https://stackoverflow.com/questions/27410580/how-to-convert-soap-request-curl-to-rcurl

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!