savonrb / savon

Heavy metal SOAP client
https://www.savonrb.com
MIT License
2.07k stars 616 forks source link

Savon do not show client.operations under HTTPS #690

Closed pashagray closed 6 years ago

pashagray commented 9 years ago

I have problem with getting operation from WSDL after setting up https. I'm trying to get operations from this wsdl:

https://test.processing.kz/CNPMerchantWebServices/CNPMerchantWebService.wsdl

If I do it from my localhost or server without https, I successfully get a list of available operations. But when I configured my nginx to serve https, operations can not be obtained (no matter what ssl_verify_mode is enabled). I just receive an empty array.

> client = Savon.client(wsdl: 'https://test.processing.kz/CNPMerchantWebServices/CNPMerchantWebService.wsdl', ssl_verify_mode: :none, log: true) 
 => #<Savon::Client:0x00000005f27a88 @globals=#<Savon::GlobalOptions:0x00000005f27a60 @option_type=:global, @options={:encoding=>"UTF-8", :soap_version=>1, :namespaces=>{}, :logger=>#<Logger:0x00000005f279e8 @progname=nil, @level=0, @default_formatter=#<Logger::Formatter:0x00000005f279c0 @datetime_format=nil>, @formatter=nil, @logdev=#<Logger::LogDevice:0x00000005f27970 @shift_size=nil, @shift_age=nil, @filename=nil, @dev=#<IO:<STDOUT>>, @mutex=#<Logger::LogDevice::LogDeviceMutex:0x00000005f27920 @mon_owner=nil, @mon_count=0, @mon_mutex=#<Mutex:0x00000005f278a8>>>>, :log=>true, :filters=>[], :pretty_print_xml=>false, :raise_errors=>true, :strip_namespaces=>true, :convert_response_tags_to=>#<Proc:0x00000005f27830@/home/deployer/.rvm/gems/ruby-2.1.3/ruby/2.1.0/gems/savon-2.11.0/lib/savon/options.rb:85 (lambda)>, :convert_attributes_to=>#<Proc:0x00000005f27808@/home/deployer/.rvm/gems/ruby-2.1.3/ruby/2.1.0/gems/savon-2.11.0/lib/savon/options.rb:86 (lambda)>, :multipart=>false, :adapter=>nil, :use_wsa_headers=>false, :no_message_tag=>false, :follow_redirects=>false, :unwrap=>false, :wsdl=>"https://test.processing.kz/CNPMerchantWebServices/CNPMerchantWebService.wsdl", :ssl_verify_mode=>:none}>, @wsdl=#<Wasabi::Document:0x00000005f276c8 @document="https://test.processing.kz/CNPMerchantWebServices/CNPMerchantWebService.wsdl", @adapter=nil, @request=#<HTTPI::Request:0x00000005f27678 @follow_redirect=false, @auth=#<HTTPI::Auth::Config:0x00000005f27628 @ssl=#<HTTPI::Auth::SSL:0x00000005f27600 @verify_mode=:none>>>>> 
2.1.3 :046 > client.operations
D, [2015-05-25T17:31:41.817858 #25654] DEBUG -- : HTTPI GET request to test.processing.kz (net_http)
 => [] 

My nginx.conf

server {
  listen 80;
  listen 443 ssl;

  server_name my_server;

  ssl_protocols TLSv1 TLSv1.1 TLSv1.2;

  ssl_certificate /opt/nginx/ssl/my_cert.crt;
  ssl_certificate_key /opt/nginx/ssl/my_cert.key;

  root /home/deployer/qiwiexline/current/public;
  passenger_enabled on;

  location ^~ /assets/
  { gzip_static on;
  expires max;
  add_header Cache-Control public;
  }
}
tjarratt commented 9 years ago

Hey @PavelTkachenko I'm sorry that you're having this problem, but it sounds unique to your own personal setup. Your nginx config looks reasonable, but I'm going to guess that the problem is with the configuration itself.

You may want to verify that you can actually receive a valid response from the server. I tried this locally with Savon v2.11.0 and received an SSL error -- likely because my client does not accept your certificate.

± bundle exec irb
2.2.0 :001 > require 'savon'
 => true 
2.2.0 :002 > client = Savon.client(wsdl: 'https://test.processing.kz/CNPMerchantWebServices/CNPMerchantWebService.wsdl')
 => #<Savon::Client:0x007fda032f9880 @globals=#<Savon::GlobalOptions:0x007fda032f9858 @option_type=:global, @options={:encoding=>"UTF-8", :soap_version=>1, :namespaces=>{}, :logger=>#<Logger:0x007fda032f97e0 @progname=nil, @level=0, @default_formatter=#<Logger::Formatter:0x007fda032f97b8 @datetime_format=nil>, @formatter=nil, @logdev=#<Logger::LogDevice:0x007fda032f9768 @shift_size=nil, @shift_age=nil, @filename=nil, @dev=#<IO:<STDOUT>>, @mutex=#<Logger::LogDevice::LogDeviceMutex:0x007fda032f9740 @mon_owner=nil, @mon_count=0, @mon_mutex=#<Mutex:0x007fda032f96f0>>>>, :log=>false, :filters=>[], :pretty_print_xml=>false, :raise_errors=>true, :strip_namespaces=>true, :convert_response_tags_to=>#<Proc:0x007fda032f9650@/Users/tjarratt/git/savon/lib/savon/options.rb:85 (lambda)>, :convert_attributes_to=>#<Proc:0x007fda032f9628@/Users/tjarratt/git/savon/lib/savon/options.rb:86 (lambda)>, :multipart=>false, :adapter=>nil, :use_wsa_headers=>false, :no_message_tag=>false, :follow_redirects=>false, :unwrap=>false, :host=>nil, :wsdl=>"https://test.processing.kz/CNPMerchantWebServices/CNPMerchantWebService.wsdl"}>, @wsdl=#<Wasabi::Document:0x007fda032f9470 @document="https://test.processing.kz/CNPMerchantWebServices/CNPMerchantWebService.wsdl", @adapter=nil, @request=#<HTTPI::Request:0x007fda032f9420 @follow_redirect=false>>> 
2.2.0 :003 > client.operations
HTTPI::SSLError: SSL_connect returned=1 errno=0 state=SSLv3 read server hello A: sslv3 alert handshake failure
    from /Users/tjarratt/.rvm/gems/ruby-2.2.0@savon/gems/httpi-2.4.0/lib/httpi/adapter/httpclient.rb:28:in `rescue in request'
    from /Users/tjarratt/.rvm/gems/ruby-2.2.0@savon/gems/httpi-2.4.0/lib/httpi/adapter/httpclient.rb:25:in `request'
    from /Users/tjarratt/.rvm/gems/ruby-2.2.0@savon/gems/httpi-2.4.0/lib/httpi.rb:160:in `request'
    from /Users/tjarratt/.rvm/gems/ruby-2.2.0@savon/gems/httpi-2.4.0/lib/httpi.rb:126:in `get'
    from /Users/tjarratt/.rvm/gems/ruby-2.2.0@savon/gems/wasabi-3.5.0/lib/wasabi/resolver.rb:43:in `load_from_remote'
    from /Users/tjarratt/.rvm/gems/ruby-2.2.0@savon/gems/wasabi-3.5.0/lib/wasabi/resolver.rb:33:in `resolve'
    from /Users/tjarratt/.rvm/gems/ruby-2.2.0@savon/gems/wasabi-3.5.0/lib/wasabi/document.rb:142:in `xml'
    from /Users/tjarratt/.rvm/gems/ruby-2.2.0@savon/gems/wasabi-3.5.0/lib/wasabi/document.rb:160:in `parse'
    from /Users/tjarratt/.rvm/gems/ruby-2.2.0@savon/gems/wasabi-3.5.0/lib/wasabi/document.rb:147:in `parser'
    from /Users/tjarratt/.rvm/gems/ruby-2.2.0@savon/gems/wasabi-3.5.0/lib/wasabi/document.rb:64:in `soap_actions'
    from /Users/tjarratt/git/savon/lib/savon/client.rb:28:in `operations'
    from (irb):3
    from /Users/tjarratt/.rvm/rubies/ruby-2.2.0/bin/irb:11:in `<main>'
2.2.0 :004 > Savon::VERSION
 => "2.11.0" 
pashagray commented 9 years ago

Magic is happening. Even http have stopped working on production. Development version is working fine. This WSLD is not changing over time, so I just downloaded it and have set it locally and now it's working fine. I think the problem is that my server located in Amsterdam, while WSDL provider in Astana, Kazakhstan (my development machine is in Almaty, Kazakhstan). This is Visa/Mastercard processing service, so probably they block requests for wsdl from other countries. Also I will try to obtain wsdl via proxy.

stale[bot] commented 6 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

stale[bot] commented 6 years ago

This issue is now closed due to inactivity. If you believe this needs further action, please re-open to discuss.