I'm writing a soap client that must connect to a https soap server.
My problem is that the server requires Authentication with a username
and a password.
Up to now, I have this:
class abcAPI < SOAP::RPC::Driver
......
DefaultEndpointUrl = "https://www.abc.com:443/soap/"
def initialize(endpoint_url = nil)
endpoint_url ||= DefaultEndpointUrl
super(endpoint_url, nil)
self.mapping_registry = MappingRegistry
init_methods
end
....
But I don't know how to setup the username and password to login at
https://www.abc.com:443/soap/
Thanks,
dan...
ps: www.abc.com is a fictif domain.
It's the kind of Auth that should make your browser popup a dialog to
ask you for a username and password.
Anyway, here the backtrace that I get:
/usr/local/lib/ruby/1.8/soap/streamHandler.rb:206:in `send_post': 401:
Authorization Required (SOAP::HTTPStreamError)
from /usr/local/lib/ruby/1.8/soap/streamHandler.rb:100:in `send'
from /usr/local/lib/ruby/1.8/soap/rpc/proxy.rb:95:in `invoke'
from /usr/local/lib/ruby/1.8/soap/rpc/proxy.rb:108:in `call'
from /usr/local/lib/ruby/1.8/soap/rpc/driver.rb:190:in `call'
.....
Thanks,
dan...
Unfortunatly, it's doesn't work. Now I have:
class abcAPI < SOAP::RPC::Driver
......
DefaultEndpointUrl = "https://www.abc.com:443/soap/"
Username = "aaaa"
Password = "bbbb"
def initialize(endpoint_url = nil)
endpoint_url ||= DefaultEndpointUrl
super(endpoint_url, nil)
self.mapping_registry = MappingRegistry
options["protocol.http.basic_auth"] << [endpoint_url, Username,
Password]
init_methods
end
....
end
But I still get the same error message.
If I look into the wiredump_dev output. The username and password
are not used. I also tried:
options["protocol.https.basic_auth"] << [endpoint_url, Username,
Password]
with https, but same result.
Any Idea?
dan...
I'm using Ruby 1.8.1 and I downloaded soap4r 1.5.2 from your site.
I didn't not install http-access2 as I though soap4r would use the
Net::HTTP libs that Ruby provides.
I will download the latest http-access2 and try again. I can I instruct
soap4r to use http-access2 lib and not the Net::HTTP lib?
For the wiredump, please send me an email directly. I don't want to
leave the real dump on this site.
Thanks,
dan...
I installed http-access2 and now it's blocking on the certificate
verification.
How can I say to http-access2 to not verify the certificate?
(....ssl_config.verify_mode = 0)
How do I access the ssl_config object?
Current back trace:
! CONNECTION ESTABLISHED
at depth 0 - 18: self signed certificate
! CONNECTION CLOSED
/usr/local/lib/ruby/site_ruby/1.8/http-access2.rb:939:in `connect':
certificate verify failed (OpenSSL::SSL::SSLError)
from /usr/local/lib/ruby/site_ruby/1.8/http-access2.rb:939:in
`ssl_connect'
from /usr/local/lib/ruby/site_ruby/1.8/http-access2.rb:1258:in
`connect'
from /usr/local/lib/ruby/site_ruby/1.8/http-access2.rb:1251:in
`timeout'
from /usr/local/lib/ruby/1.8/timeout.rb:55:in `timeout'
...
Thanks,
dan...