如何将SOAP请求curl转换为RCurl

use*_*682 4 curl r rcurl

我应该如何转换这一个班轮:

curl -d @request.xml -o response.xml http://www.sample.com/soap
Run Code Online (Sandbox Code Playgroud)

它正在访问请求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>
Run Code Online (Sandbox Code Playgroud)

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

had*_*ley 11

这是httr的方法:

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