3

I recently update on savon 2.0.2 and I'm using it for sending some xml via soap. I have to use certificates but after updating the syntax of the new savon version the certificates are ignored. Could someone help me with the new syntax - I'm probably missing something... I'm running ruby 1.9.3 and rails 3.2.9

Old (working) version:

client = Savon::Client.new do | wsdl |
  wsdl.endpoint = CONFIG['endpoint']
  wsdl.namespace = CONFIG['namespace']
end

  response = client.request(:ns, :getToken) do

    http.auth.ssl.cert = OpenSSL::X509::Certificate.new(
      File.read(Rails.root + "lib/certs/cert.pem"))
    http.auth.ssl.cert_key_file = Rails.root + "lib/certs/key.pem"
    http.auth.ssl.verify_mode = :none

    soap.body = {

      // body
    }
    soap.header={
      "ns:account"=>{
        :login=>CONFIG['login'],
        :password=>CONFIG['password']
      }      
    }
  end

Now I tried to do exactly the same in 2.0.2, but it's not working - xml is ok, but certificate is being ignored...

so far I got:

  client = Savon.client do
  endpoint CONFIG['endpoint']
  namespace CONFIG['namespace']
  namespace_identifier :ns

  ssl_cert_file OpenSSL::X509::Certificate.new(File.read(Rails.root + "lib/certs/cert.pem"))
  ssl_cert_key_file Rails.root + "lib/certs/key.pem"
  ssl_verify_mode :none


  soap_header(
      "sus:account"=>{
        :login=>CONFIG['login'],
        :password=>CONFIG['password']
      }      
   )

end

response = client.call(:getToken) do

      message(
     // body
        )

end

Any help would be very appreciated!!!

user1961461
  • 41
  • 2
  • 3
  • did you read this section of the docs? http://savonrb.com/version2.html#globals-ssl – phoet Jan 09 '13 at 15:29
  • This question covers something similar: http://stackoverflow.com/questions/15973285/does-savon-support-client-side-certificates-authentication – Chris Kimpton Jul 04 '13 at 18:54
  • Update: it looks like Savon has since changed that document quite a bit. For those still using Savon2, perhaps for compatibility with an older app, here's a permalink: https://web.archive.org/web/20130112080003/http://savonrb.com/version2.html – maurice Apr 21 '17 at 20:05

1 Answers1

0

The use of ssl_verify_mode :none tells Savon to turn off SSL checking. That is why the cert is being ignored. As pointed out in the comments full documentation can be found on the Savon site.