首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >如何在soap4r中为soap调用设置http头?

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

Stack Overflow用户
提问于 2011-02-07 18:17:40
回答 1查看 429关注 0票数 0

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

代码语言:javascript
复制
@drv = SOAP::RPC::Driver.new('x', 'y')

如何设置http头"vmware_soap_session“来调用从@drv发出的调用?

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2011-02-07 23:39:58

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

以下是第一个帮助“拆分它”的源代码:

代码语言:javascript
复制
# 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}或任何应该用作该值的值。

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/4920098

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档