Rails萨龙HTTPClient :: KeepAliveDisconnected问题
问题描述:
这是我第一次发布堆栈溢出,所以这里它去... 我有一个问题,当我尝试使用导轨进行api调用,但我不断得到一个HTTPClient::KeepAliveDisconnected
错误。由于我是Ruby和rails的新手,我不知道从哪里开始寻找。Rails萨龙HTTPClient :: KeepAliveDisconnected问题
这里是我的源...
site_ids = { 'int' => (An integer) }
source_credentials = { 'SourceName' => '(username)', 'Password' => '(password)', 'SiteIDs' => site_ids }
user_credentials = { 'Username' => '(another username)', 'Password' => '(another password)', 'SiteIDs' => site_ids }
#######################
## Standard API call ##
#######################
#Create Savon client using default settings
http_client = Savon.client(wsdl: "(Valid WSDL location)")
#Create request and package it for the call
http_request = { 'SourceCredentials' => source_credentials, 'UserCredentials' => user_credentials }
params = { 'Request' => http_request }
#Run the call and store the results
result = http_client.call(:get_staff, params)
尝试运行此之后,我得到以下错误:
HTTPClient::KeepAliveDisconnected
对使用http_request.call
任何建议行?
答
我有同样的问题。
我的情况的解决方案:我的资源通过https工作,但是当我通过http端点接收wsdl - 服务器响应的数据时。结果 - savon通过http发出了soap请求。
req = client.build_request(:action, message: data)
req.url
req.ssl?
在这种情况下,你可以指定端点萨翁
client = Savon.client(wsdl: YOUR_URL_WITH_WSDL, endpoint: YOUR_URL) # wsdl
HttpClient的哪个版本您使用的? – usha
我正在使用的httpclient版本是2.3.4.1 –