【发布时间】:2019-01-24 04:57:52
【问题描述】:
我把 api 调用放在下面。在这一点上,我什至不确定它是否正确。我需要在其中添加我的用户名和密码,但不确定在哪里。任何有关用户名和密码位置的建议将不胜感激。
api 调用的背景是它是通过邮递员发送给我的,我可以在其中运行它。我能够从邮递员那里提取正文,但我需要在 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
)
【问题讨论】:
-
这个没看过,我去看看。
-
能否提供更多细节?对于如何保护 SOAP ebservice 有很多不同的方法,例如基本身份验证、WS-Security 等...更多关于身份验证方法的详细信息将很容易提供正确的答案。