我应该如何转换这一个班轮:
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
答案 0 :(得分:11)
以下是httr:
的方法library(httr)
r <- POST("http://www.sample.com/soap", body = upload_file("request.xml"))
stop_for_status(r)
content(r)