I am attempting to connect to Bing Maps SDK through a RoR application. My goal is to calculate driving distance between two locations after geocoding them. I am new to SOAP and ROR so I may be making a simple mistake.
Two days of Googling (Binging?) and I'm coming up short. Here is what I am doing:
Environment
Ruby 1.8.7 on Windows Vista (getting a Mac next week). gem install httpclient --source http://dev.ctor.org/download/ gem install soap4r --include-dependencies
Browser Test
Going to https://staging.common.virtualearth.net/find-30/common.asmx?wsdl I am prompted with User Name and Password. I can enter both successfully and receive the WSDL file. So the URL, userid, and password are correct.
Code
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]
Console Output
driver = SOAP::WSDLDriverFactory.new(wsdl).create_rpc_driver
HTTPClient::BadResponseError: unexpected response: <#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=[["Connection", "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> from c:/ruby/lib/ruby/gems/1.8/gems/httpclient-2.1.5.2/lib/httpclient.rb:840:in `follow_redirect'
References I've reviewed
Quite possible that one of these has the answer. I just don't have enough background in SOAP to find it...
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/consuming-soap-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-consuming-soap-services-in-ruby