我应该如何转换这一个班轮:
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)