我正在尝试使用 Savon 将 API Key 元素添加到 SOAP 标头,但正在打一场失败的战斗。我对 Ruby 还很陌生,我所知道的很少是自学的。根据他们的 API 文档,这是我需要添加的内容:此 ProductServe 函数将返回(SOAP-Header)身份验证元素,并且必须与每个请求一起发送。
参数
Required Name Type Description Min Occurs Max Occurs
No sToken string Unique token to identify visitor. 0 1
Yes sApiKey string User specific key to authenticate user. 1 1
http://wiki.affiliatewindow.com/index.php/UserAuthentication
我还没有找到任何类似于我想做的事情,这是我尝试过的代码:
endpoint = "http://v3.core.com.productserve.com/ProductServeService.wsdl"
client = Savon.client
response = client.request :urn, "getCategory" do
soap.endpoint = endpoint
soap.header = {
"urn:sApiKey" => "xxxx"
}
end
任何帮助将不胜感激!