Connect using Basic Auth #48

nvijayap opened this Issue Aug 31, 2012 · 6 comments


None yet
2 participants


I have tried a very simple program, and got this stack trace ...

  • /Users/nvijayap/tools/jruby/lib/ruby/gems/1.8/gems/viewpoint-0.1.27/lib/soap/handsoap/ews_service.rb:95:in `on_http_error'
  • /Users/nvijayap/tools/jruby/lib/ruby/gems/1.8/gems/handsoap-1.1.8/lib/handsoap/service.rb:438:in `parse_http_response'
  • /Users/nvijayap/tools/jruby/lib/ruby/gems/1.8/gems/handsoap-1.1.8/lib/handsoap/service.rb:250:in `invoke'
  • /Users/nvijayap/tools/jruby/lib/ruby/gems/1.8/gems/viewpoint-0.1.27/lib/soap/handsoap/ews_service.rb:804:in `invoke'
  • /Users/nvijayap/tools/jruby/lib/ruby/gems/1.8/gems/viewpoint-0.1.27/lib/soap/handsoap/ews_service.rb:160:in `find_folder'
  • /Users/nvijayap/tools/jruby/lib/ruby/gems/1.8/gems/viewpoint-0.1.27/lib/model/generic_folder.rb:123:in `get_folder_by_name'

- ./tryvp.rb:9:in `(root)'

I think the issue is because Viewpoint is not supporting Basic Auth. The EWS against which I am trying uses Basic Auth.

So, the question is, how to use Basic Auth in my code below ...

!/usr/bin/env jruby -rubygems

require 'viewpoint'

Viewpoint::EWS::EWS.endpoint = ''
Viewpoint::EWS::EWS.set_auth 'abc-de\un', 'pw'

inbox = Viewpoint::EWS::Folder.get_folder_by_name('Inbox')
rescue Exception => e
y e.backtrace



zenchild commented Aug 31, 2012

The SOAP mechanism is using HTTPClient in the background which should support basic auth. Try doing a simple get of that resource with HTTPClient to make sure you can retrieve the endpoint.

require 'httpclient'
cli =
cli.set_auth nil, user, pass
resp = cli.get your_endpoint_url

Thanks for getting back to me. I appreciate.

Just tried httpclient and verified. Got the response, and status code 200. Could see the message body.

The exact same endpoint was then used, but am still seeing the above mentioned issue.

Appears there is no way to pass in the auth type, or is there some way to do it?

Naga Vijay

Further to my message above ...

set_auth of httpclient takes 3 args, with the first one (nil) indicating 'basic',
whereas the set_auth of Viewpoint::EWS::EWS takes just 2 args.

Would the issue lie there? What is the default auth? Basic?
No flexibility to use different auth(s)?


nvijayap commented Sep 6, 2012

No issue when running from within Rails Console or Rails environment. The issue surfaces only when I run it as a script, or from within irb

nvijayap commented Sep 6, 2012

Closing, as not really an issue, as I need to do it within Rails environment anyway.

@nvijayap nvijayap closed this Sep 6, 2012


zenchild commented Sep 6, 2012

Sorry I didn't get back to you sooner. I'm in the middle of a move and a job transition so things are a bit hectic right now. I also don't have access to an Exchange server any longer so I'm going to have to figure something out to vet any of your problems.



Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment