From: "NAKAMURA, Hiroshi" Date: 2004-08-04T19:17:08+09:00 Subject: Re: soap4r via https (ssl) Hi, On Tue, 3 Aug 2004 22:43:07 +0900, Florian Weber wrote: > does soap4r also work via https? is it tested and works well? Yes and yes, I hope. SSL feature of soap4r has been already imported into ruby's CVS. With coming ruby/1.8.2, you can use SSL feature at both client side and server side. cf. http://www.ruby-lang.org/cgi-bin/cvsweb.cgi/ruby/sample/soap/ssl/ Here's a client in above sample. SSL client needs http-access2 library. (see RAA) require 'http-access2' require 'soap/rpc/driver' url = "https://localhost:17443/" client = SOAP::RPC::Driver.new(url, 'urn:sslhelloworld') client.add_method("hello_world", "from") client.loadproperty('files/sslclient.properties') p client.hello_world(__FILE__) =begin files/sslclient.properties # verify server's certificate protocol.http.ssl_config.verify_mode = OpenSSL::SSL::VERIFY_PEER # certificates for verification protocol.http.ssl_config.ca_file = files/ca.cert protocol.http.ssl_config.ca_file = files/subca.cert =end Here's an SSL SOAP server with WEBrick require 'soap/rpc/httpserver' require 'webrick/https' require 'logger' class HelloWorldServer < SOAP::RPC::HTTPServer private def on_init @default_namespace = 'urn:sslhelloworld' add_method(self, 'hello_world', 'from') end def hello_world(from) "Hello World, from #{ from }" end end if $0 == __FILE__ DIR = File.dirname(File.expand_path(__FILE__)) def cert(filename) OpenSSL::X509::Certificate.new(File.open(File.join(DIR, filename)) { |f| f.read }) end def key(filename) OpenSSL::PKey::RSA.new(File.open(File.join(DIR, filename)) { |f| f.read }) end $server = HelloWorldServer.new( :BindAddress => "0.0.0.0", :Port => 17443, :AccessLog => [], :SSLEnable => true, :SSLCACertificateFile => File.join(DIR, 'files/ca.cert'), :SSLCertificate => cert('files/server.cert'), :SSLPrivateKey => key('files/server.key'), :SSLVerifyClient => nil, :SSLCertName => nil ) trap(:INT) do $server.shutdown end $server.start end Regards, // NaHi