gpt4 book ai didi

r - 如何将 SOAP 请求 curl 转换为 RCurl

转载 作者:行者123 更新时间:2023-12-04 22:30:46 26 4
gpt4 key购买 nike

我应该如何转换这个类轮:

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)

关于r - 如何将 SOAP 请求 curl 转换为 RCurl,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27410580/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com