R 中的 SOAP 请求 [英] SOAP request in R

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

问题描述

有谁知道如何用 R 制定以下 SOAP 请求?

Does anyone know how to formulate following SOAP request with R?

POST /API/v201010/AdvertiserService.asmx HTTP/1.1
Host: advertising.criteo.com
Content-Type: text/xml; charset=utf-8
Content-Length: length
SOAPAction: "https://advertising.criteo.com/API/v201010/clientLogin"

<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
  <soap:Body>
    <clientLogin xmlns="https://advertising.criteo.com/API/v201010">
      <username>string</username>
      <password>string</password>
      <source>string</source>
    </clientLogin>
  </soap:Body>
</soap:Envelope>

推荐答案

这样就解决了问题:

library(RCurl)

headerFields =
  c(Accept = "text/xml",
    Accept = "multipart/*",
    'Content-Type' = "text/xml; charset=utf-8",
    SOAPAction = "https://advertising.criteo.com/API/v201010/clientLogin")

body = '<?xml version="1.0" encoding="utf-8"?>
  <soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
  <soap:Body>
  <clientLogin xmlns="https://advertising.criteo.com/API/v201010">
  <username>string</username>
  <password>string</password>
  <source>string</source>
  </clientLogin>
  </soap:Body>
  </soap:Envelope>'

curlPerform(url = "https://advertising.criteo.com/API/v201010/AdvertiserService.asmx",
                          httpheader = headerFields,
                          postfields = body
                          )

这篇关于R 中的 SOAP 请求的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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