0

RoR アプリケーションを介してBing Maps SDKに接続しようとしています。私の目標は、2 つの場所をジオコーディングした後、それらの間の運転距離を計算することです。私は SOAP と ROR を初めて使用するので、単純な間違いを犯している可能性があります。

2 日間の Google 検索 (Binging?) で、あと少しです。これが私がやっていることです:

環境

Windows Vista 上の Ruby 1.8.7 (来週 Mac を入手)。gem install httpclient --source http://dev.ctor.org/download/ gem install soap4r --include-dependencies

ブラウザ テスト

https://staging.common.virtualearth.net/find-30/common.asmx?wsdlに移動すると、ユーザー名とパスワードの入力を求められます。どちらも正常に入力でき、WSDL ファイルを受け取ることができます。したがって、URL、ユーザー ID、およびパスワードは正しいです。

コード

require 'rubygems'
gem 'soap4r'
require 'httpclient'
require "soap/wsdlDriver"
  user = "XXXXXX"
  pass = "XXXXXXX"
  wsdl = "https://staging.common.virtualearth.net/find-30/common.asmx?wsdl"
  driver = SOAP::WSDLDriverFactory.new(wsdl).create_rpc_driver
  driver.options["protocol.http.basic_auth"] << [wsdl,user,pass]

コンソール出力

driver = SOAP::WSDLDriverFactory.new(wsdl).create_rpc_driver


HTTPClient:: BadResponseError: 予期しない応答: <#HTTP::Message::Headers:0x4f6cabc @reason_phrase=" Unauthorized", @request_uri=nil, @body_date=nil, @status_code=401, @dumped=false, @request_method=nil, @chunked=false, @body_charset=nil, @request_via_proxy=nil, @header_item=[["接続" , "close"], ["Date", "Thu, 09 Jul 2009 02:53:59 GMT"], ["Server", "Microsoft-IIS/6.0"], ["P3P", "CP=\" BUS CUR CONo FIN IVDo ONL OUR PHY SAMo TELo\""], ["X-Powered-By", "ASP.NET"], ["WWW-Authenticate", "Digest qop=\"auth\", realm= \" MapPoint\", nonce=\"87b3d5847da867f7930801742100f2e55de88fd216317a696fe1411f79e3\""], ["Content-Length", "0"]], @body_size=0, @http_version="1.1", @body_type=nil, @request_query=nil 、 @is_request=false> c:/ruby/lib/ruby/gems/1 より。8/gems/httpclient-2.1.5.2/lib/httpclient.rb:840:`follow_redirect' で

私が見直した参考書

これらのいずれかに答えがある可能性は十分にあります。私はそれを見つけるのに十分なSOAPのバックグラウンドを持っていません...

http://hideoustriumph.wordpress.com/2008/05/05/ws-deathstar-for-the-rest-of-us/ http://s2.diffuse.it/blog/show/62-Consume_SSL_protected_Web_Services_with_soap4r http:/ /dev.ctor.org/doc/soap4r/RELEASE_en.html#samples http://markthomas.org/2007/09/12/getting-started-with-soap4r/ http://www.elctech.com/articles/消費する石鹸-with-ruby-and-soap-mapping-object http://wso2.org/project/wsf/ruby/1.1.0/docs/manual.html http://www.globalnerdy.com/2009/ 06/29/learnhub-powered-by-rails-searches-with-bing/ http://rpheath.com/posts/298-using-soap-services-in-ruby

4

2 に答える 2

0

Ruby で群を抜いて最高の SOAP クライアントである Ruby ライブラリSavonを調べてください。

于 2010-07-21T02:13:32.670 に答える