如何在soap4r中为soap调用设置http标头?

如何在soap4r中为soap调用设置http标头?

@drv = SOAP::RPC::Driver.new('x', 'y') 

如何设置http标头“vmware_soap_session”来调用@drv中的调用?

SOAP::NetHttpClient.get_contentSOAP::NetHttpClient.post方法提供了一个header哈希参数:

这是第一个帮助’splain它的源:

 # 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}或您应该用作值的任何内容。