gpt4 book ai didi

r - 我的用户名和密码应该放在 SOAP api 的 POST 中的什么位置

转载 作者:行者123 更新时间:2023-12-04 20:27:53 25 4
gpt4 key购买 nike

我把 api 调用放在了下面。在这一点上,我什至不确定它是否正确。我需要添加我的用户名和密码,但不确定在哪里。任何有关放置用户名和密码的建议将不胜感激。

api 调用的背景是它是通过 postman 发送给我的,我可以在那里运行它。我能够从 postman 那里拉出正文,但我需要在 API 调用中包含身份验证。

在此处输入代码

library(RCurl)

headerFields =
c(Accept = "text/xml",
'Content-Type' = "text/xml; charset=utf-8")

body = '<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="http://www.sitename.com/bizconnect/SBU">
<SOAP-ENV:Body>
<ns1:GetSBUApplicationData>
<ns1:Subscriber>
<ns1:SubCode>123456</ns1:SubCode>
</ns1:Subscriber>
<ns1:UserID>xxxxxx</ns1:UserID>
<ns1:ReferenceID>A</ns1:ReferenceID>
<ns1:ResponseVersion>010</ns1:ResponseVersion>
<ns1:Application>
<ns1:Id>G020D</ns1:Id>
<ns1:Name/>
<ns1:Key>
<ns1:Field>
<ns1:Id>00920000</ns1:Id>
<ns1:Name/>
<ns1:Value>900000095</ns1:Value>
</ns1:Field>
</ns1:Key>
</ns1:Application>
</ns1:GetSBUApplicationData>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>'

curlPerform(url = "https://stg1-ss1.sitename.com/bizconnect/SBU/service",
httpheader = headerFields,
postfields = body
)

最佳答案

好的。目前,考虑到它在 postman 中工作正常,我将假设该服务正在使用基本身份验证运行。

在这种情况下,您不需要在 SOAP 信封中包含身份验证详细信息,而是在 HTTP 级别进行身份验证。

建议尝试这样的事情;

curlPerform(url = "https://stg1-ss1.sitename.com/bizconnect/SBU/service",
httpheader = headerFields,
postfields = body, userpwd = "user:password")

有关更多详细信息,我建议您查看 RCurl 的 JStatSoft 论文的第 4.2 节,此处为: http://www.omegahat.net/RCurl/RCurlJSS.pdf

我不是 inc 的忠实粉丝,在代码文件中包含凭据,因此我还建议查看论文中有关如何将凭据外部化为单独的密码文件的指南。这样您就不会意外地将凭据检查到您的版本控制中。

关于r - 我的用户名和密码应该放在 SOAP api 的 POST 中的什么位置,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54339617/

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