【问题标题】:Setting proxy authentication on ServiceMix在 ServiceMix 上设置代理身份验证
【发布时间】:2013-06-01 11:28:00
【问题描述】:

我在 Web 代理后面安装了 ServiceMix,我需要它来通过 Internet 调用 Web 服务。

我尝试使用

在我的代码中设置代理设置
System.setProperty("http.proxyHost" .....

(丑陋而骇人听闻,我知道) 以及设置

http.proxyHost=myproxy
http.proxyPort=8080
http.proxyUser=myuser
http.proxyPassword=mypassword

ServiceMix 的 etc/system.properties 文件中。

这些都不起作用。 任何建议,将不胜感激。 谢谢。

【问题讨论】:

    标签: apache-servicemix


    【解决方案1】:

    由于您使用 ServiceMix,您很可能正在使用带有 CXF 的 Camel 来调用此 Web 服务。 您需要通过设置 http-client 配置在 Camel 上下文中设置此代理,尤其是对于 CXF。看看这个link,它告诉你如何配置CXF的http管道。 我相信您也可以通过这种方式设置代理。

    【讨论】:

    • 我确实使用 Camel,但我使用的是带有 url 的 ProducerTemplate,所以我认为 Camel 不会通过 CXF。我想知道是否应该进行更改,所以我使用 CXF,但我不确定我是否有时间进行所有必要的更改,而且我的 url 是动态的,基于以前请求的响应。
    • 那你在做什么?您是否正在向其他服务器发送原始 xml 请求?那么你是如何做到这一点的,通过使用 commons http-client。我很确定有一种与 cxf 客户端类似的方式来配置它(它使用内部的 http-client)
    • 这是我目前所做的:stackoverflow.com/questions/16984812/…我不知道是否有人会再提出这个问题,所以我重新提出了这个问题并添加了更多细节。
    【解决方案2】:

    使用 http:conduit:

      <http:conduit name="*.http-conduit">
        <http:authorization>
          <sec:UserName>Betty</sec:UserName>
          <sec:Password>password</sec:Password>
        </http:authorization>
        <http:client ProxyServer="x.x.x.x" ProxyServerPort="xxxx"/>
    
      </http:conduit>
    

    见:http://cxf.apache.org/docs/client-http-transport-including-ssl-support.html

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2010-10-17
      • 1970-01-01
      • 1970-01-01
      • 2019-11-06
      • 1970-01-01
      • 2013-12-22
      • 1970-01-01
      相关资源
      最近更新 更多