Reputation: 73
I'm trying to use wsdl on an https url. with reference to How do I tell Ruby's OpenSSL library to ignore a self-signed certificate error?
when i try this:
... OpenSSL::SSL::VERIFY_PEER = OpenSSL::SSL::VERIFY_NONE ::SOAP::WSDLDriverFactory.new(SERVICE_URL).create_rpc_driver ...
I'm getting this error:
SyntaxError in ReportsController#wsdlCaller
/rails-root/app/controllers/reports_controller.rb:220: dynamic constant assignment ... = OpenSSL::SSL::VERIFY_PEER = OpenSSL::SSL::VERIFY_NONE::SO...
How do i resolve this?
Thanks!
Upvotes: 1
Views: 906
Reputation: 21
Try below to disable the certificate verification:
require 'httpclient'
client = HTTPClient.new
client.ssl_config.verify_mode = OpenSSL::SSL::VERIFY_NONE
Otherwise you can try to update your certificates instead (example for macos below): $ brew upgrade ruby $ brew update --system $ gem update httpclient $ brew install openssl $ brew link openssl --force
Upvotes: 0
Reputation: 73
ok so i changed the syntax to
const_set(OpenSSL::SSL::VERIFY_PEER, OpenSSL::SSL::VERIFY_NONE)
and i resolved the dynamic constant assignment error. that was probably because i was trying to assign a value to a constant in a method.
i'm now stuck at a new error: uninitialized constant OpenSSL::SSL::VERIFY_PEER. does anyone know why this is happening?
help! thanks.
Upvotes: 1