如何将SOAP请求curl转换为RCurl [英] How to convert SOAP request curl to RCurl

查看:76
本文介绍了如何将SOAP请求curl转换为RCurl的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我应该如何转换这支班轮:

How should I convert this one liner:

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

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

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>

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

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

推荐答案

httr的用法如下:

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)

这篇关于如何将SOAP请求curl转换为RCurl的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆