我需要使用Heroku的IP白名单访问服务,因此需要HTTP代理。
我配置了Proximo插件,并且有一个类似于http://proxy:secret-key@proxy-0-0-0-0.proximo.io
的代理网址
在Savon中,我尝试过像这样配置代理:
client = Savon.client(wsdl: my_wsdl, proxy: "http://proxy:secret-key@proxy-0-0-0-0.proximo.io")
但是当我提出请求时:
client.operations
我收到了代理错误:
Wasabi::Resolver::HTTPError: Error: 407 for url http://mywsdl
from /Users/ahamon/.gem/ruby/2.3.0/gems/wasabi3.5.0/lib/wasabi/resolver.rb:45:in `load_from_remote'
from /Users/ahamon/.gem/ruby/2.3.0/gems/wasabi3.5.0/lib/wasabi/resolver.rb:33:in `resolve'
from /Users/ahamon/.gem/ruby/2.3.0/gems/wasabi3.5.0/lib/wasabi/document.rb:142:in `xml'
from /Users/ahamon/.gem/ruby/2.3.0/gems/wasabi-3.5.0/lib/wasabi/document.rb:160:in `parse'
from /Users/ahamon/.gem/ruby/2.3.0/gems/wasabi-3.5.0/lib/wasabi/document.rb:147:in `parser'
from /Users/ahamon/.gem/ruby/2.3.0/gems/wasabi-3.5.0/lib/wasabi/document.rb:64:in `soap_actions'
from /Users/ahamon/.gem/ruby/2.3.0/gems/savon-2.11.1/lib/savon/client.rb:28:in `operations'
from (irb):7
from /Users/ahamon/.gem/ruby/2.3.0/gems/railties-4.2.4/lib/rails/commands/console.rb:110:in `start'
from /Users/ahamon/.gem/ruby/2.3.0/gems/railties-4.2.4/lib/rails/commands/console.rb:9:in `start'
from /Users/ahamon/.gem/ruby/2.3.0/gems/railties-4.2.4/lib/rails/commands/commands_tasks.rb:68:in `console'
from /Users/ahamon/.gem/ruby/2.3.0/gems/railties-4.2.4/lib/rails/commands/commands_tasks.rb:39:in `run_command!'
from /Users/ahamon/.gem/ruby/2.3.0/gems/railties-4.2.4/lib/rails/commands.rb:17:in `<top (required)>'
from bin/rails:4:in `require'
from bin/rails:4:in `<main>'
但是没有代理选项,一切正常。
答案 0 :(得分:3)
我想我找到了解决方案。 不方便的是手动获取WSDL并将其保存到本地文件中。 例如
curl http://www.webservicesx.net/globalweather.asmx?wsdl > globalweather.wsdl
您必须将以下内容添加到客户端定义
...
secret = Base64.strict_encode64("#{user}:#{password}")
client = Savon.client(
wsdl: 'globalweather.wsdl',
proxy: "http://my-proxy.example.com:8080",
headers: { "Proxy-Authorization" => "Basic #{secret}" },
...
)
基本上就是这样。
通过直接指定namespace
和endpoint
,您也可以在没有WSDL的情况下完全工作。
Savon使用Wasabi来处理WSDL。它还从服务器获取文档。 Wasabi没有使用Savon客户定义中的参数。要改变它,就必须扩展芥末宝石。
可以在此处找到正在运行的脚本:http://pastebin.com/t8NTuGKK。
答案 1 :(得分:0)
我认为这应该有用
16/03/21 20:52:29 ERROR ErrorMonitor: AssociationError [akka.tcp://sparkDriver@ipaddress10:47915] -> [akka.tcp://sparkExecutor@hostname02:48703]: Error [Association failed with [akka.tc
p://sparkExecutor@hostname02:48703]] [
akka.remote.EndpointAssociationException: Association failed with [akka.tcp://sparkExecutor@hostname02:48703]
Caused by: akka.remote.transport.netty.NettyTransport$$anonfun$associate$1$$anon$2: No route to host
]
akka.event.Logging$Error$NoCause$
16/03/21 20:52:29 ERROR ErrorMonitor: AssociationError [akka.tcp://sparkDriver@ipaddress10:47915] -> [akka.tcp://sparkExecutor@hostname02:48703]: Error [Association failed with [akka.tc
p://sparkExecutor@hostname02:48703]] [
akka.remote.EndpointAssociationException: Association failed with [akka.tcp://sparkExecutor@hostname02:48703]
Caused by: akka.remote.transport.netty.NettyTransport$$anonfun$associate$1$$anon$2: No route to host
]
akka.event.Logging$Error$NoCause$
16/03/21 20:52:32 ERROR YarnScheduler: Lost executor 3 on hostname01: remote Rpc client disassociated
16/03/21 20:52:32 INFO DAGScheduler: Executor lost: 3 (epoch 0)
16/03/21 20:52:32 INFO BlockManagerMasterEndpoint: Trying to remove executor 3 from BlockManagerMaster.
16/03/21 20:52:32 INFO BlockManagerMasterEndpoint: Removing block manager BlockManagerId(3, hostname01, 37497)
16/03/21 20:52:32 INFO BlockManagerMaster: Removed 3 successfully in removeExecutor
16/03/21 20:52:32 INFO ExecutorAllocationManager: Existing executor 3 has been removed (new total is 0)