rubiii/savon — Issue #273: Invalid URL coming out of HTTPI via URI.split?
Author: ephekt
Created: 2012-02-23 20:03:51+00:00
State: open

Hi Rubiii/Community,

I've been porting over my php->ruby soap api's and I'm trying to access the wsdl at https://api5120.apt.yahooapis.com/services/V10/AccountService?wsdl. However, this is thrown as a bad URL in two places.

`
D, [2012-02-23T11:36:35.248917 #7329] DEBUG -- : HTTPI executes HTTP GET using the httpclient adapter
/Users/miker/.rvm/gems/ree-1.8.7-2011.03/gems/httpi-0.9.5/lib/httpi/request.rb:85:in `normalize_url!': Invalid URL: (ArgumentError)
from /Users/miker/.rvm/gems/ree-1.8.7-2011.03/gems/httpi-0.9.5/lib/httpi/request.rb:26:in `url='
from /Users/miker/.rvm/gems/ree-1.8.7-2011.03/gems/savon-0.9.9/lib/savon/soap/request.rb:40:in `configure'
from /Users/miker/.rvm/gems/ree-1.8.7-2011.03/gems/savon-0.9.9/lib/savon/soap/request.rb:24:in `initialize'
from /Users/miker/.rvm/gems/ree-1.8.7-2011.03/gems/savon-0.9.9/lib/savon/client.rb:79:in `new'
from /Users/miker/.rvm/gems/ree-1.8.7-2011.03/gems/savon-0.9.9/lib/savon/client.rb:79:in `request'
from apt_api.rb:44:in `initialize'
from apt_api.rb:69:in `new'
from apt_api.rb:69
`

When calling Savon::Client.new with that URL. I then dug a bit into the httpi/request.rb class and found that the regular expression matching the beginning of a string with http seems to cause an issue so I commented that out to see what URI's class complained about it. Re-running the script I received this via URI:

`

D, [2012-02-23T11:26:23.338238 #5978] DEBUG -- : HTTPI executes HTTP GET using the httpclient adapter
validating...
/Users/miker/.rvm/rubies/ree-1.8.7-2011.03/lib/ruby/1.8/uri/common.rb:436:in `split': bad URI(is not URI?): (URI::InvalidURIError)
from /Users/miker/.rvm/rubies/ree-1.8.7-2011.03/lib/ruby/1.8/uri/common.rb:485:in `parse'
from /Users/miker/.rvm/rubies/ree-1.8.7-2011.03/lib/ruby/1.8/uri/common.rb:608:in `URI'
from /Users/miker/.rvm/gems/ree-1.8.7-2011.03/gems/httpi-0.9.5/lib/httpi/request.rb:87:in `normalize_url!'
from /Users/miker/.rvm/gems/ree-1.8.7-2011.03/gems/httpi-0.9.5/lib/httpi/request.rb:26:in `url='
from /Users/miker/.rvm/gems/ree-1.8.7-2011.03/gems/savon-0.9.9/lib/savon/soap/request.rb:40:in `configure'
from /Users/miker/.rvm/gems/ree-1.8.7-2011.03/gems/savon-0.9.9/lib/savon/soap/request.rb:24:in `initialize'
from /Users/miker/.rvm/gems/ree-1.8.7-2011.03/gems/savon-0.9.9/lib/savon/client.rb:79:in `new'
from /Users/miker/.rvm/gems/ree-1.8.7-2011.03/gems/savon-0.9.9/lib/savon/client.rb:79:in `request'
from apt_api.rb:42:in `initialize'
from apt_api.rb:67:in `new'
from apt_api.rb:67
`

All in all I'm a bit confused why this URL is not being accepted. Is URI a super strict class compared to a more relaxed PHP environment? Any help would be appreciated. Thanks.