3

I'm trying to use Ruby's SOAP support as follows:

SERVICE_URL = 'https://...'
...
def create_driver
  ::SOAP::WSDLDriverFactory.new(SERVICE_URL).create_rpc_driver
  driver.options['protocol.http.ssl_config.verify_mode']  = OpenSSL::SSL::VERIFY_NONE
  driver.options['protocol.http.ssl_config.client_cert']  = @certificate_path
  driver
end

but the call to new(SERVICE_URL) blows up with "OpenSSL::SSL::SSLError: certificate verify failed." How do I do the equivalent of driver.options['protocol.http.ssl_config.verify_mode'] = OpenSSL::SSL::VERIFY_NONE for the first call to retrieve the WSDL itself?

0

3 Answers 3

5

I put a file called "soap/property" on my load path, e.g.:

- lib/
    - foo.rb
    - foo/
        - bar.rb
    - soap/
        - property

And put this in the file:

client.protocol.http.ssl_config.verify_mode = OpenSSL::SSL::VERIFY_NONE

Alternatively, if you have multiple settings with the same prefix, you can use the group syntax:

[client.protocol.http]
ssl_config.verify_mode = OpenSSL::SSL::VERIFY_NONE
...
0

try this:

...
  OpenSSL::SSL::VERIFY_PEER = OpenSSL::SSL::VERIFY_NONE
  ::SOAP::WSDLDriverFactory.new(SERVICE_URL).create_rpc_driver
...
2
  • 1
    You're saying I redefine VERIFY_PEER to be the value of VERIFY_NONE? That's risky since I can't be certain whether the code for checking the verification method checks for the value of VERIFY_NONE or VERIFY_PEER. Redefining constants is an absolute last resort. Oct 16, 2009 at 1:09
  • I should say, though, that it will work. It may be a last resort because it's sneaky, but if all else fails... Dec 18, 2009 at 5:06
0

I stumbled across this url : https://gist.github.com/fnichol/867550 .This might be useful for anyone who is having similar problems.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.