如何在soap4r中为soap调用设置http头?
@drv = SOAP::RPC::Driver.new('x', 'y')如何设置http头"vmware_soap_session“来调用从@drv发出的调用?
发布于 2011-02-07 23:39:58
SOAP::NetHttpClient.get_content和SOAP::NetHttpClient.post方法提供了一个header散列参数:
以下是第一个帮助“拆分它”的源代码:
# File 'lib/soap/netHttpClient.rb', line 95
def get_content(url, header = {})
if str = @test_loopback_response.shift
return str
end
unless url.is_a?(URI)
url = URI.parse(url)
end
extra = header.dup
extra['User-Agent'] = @agent if @agent
res = start(url) { |http|
http.get(url.request_uri, extra)
}
res.body
end尝试将header哈希值设置为{"vmware_soap_session" => true}或任何应该用作该值的值。
https://stackoverflow.com/questions/4920098
复制相似问题