railslove/epics

problem with INI

Closed this issue · 8 comments

Hey,

we have run into a problem following the Getting started Guide.

When initially submitting the keys to our bank, we are getting the following error:

> e.INI

Nokogiri::XML::XPath::SyntaxError: ERROR: Undefined namespace prefix: //ds:DigestValue
        from /usr/local/rvm/gems/ruby-2.3.4@global/gems/nokogiri-1.8.1/lib/nokogiri/xml/searchable.rb:198:in `evaluate'
        from /usr/local/rvm/gems/ruby-2.3.4@global/gems/nokogiri-1.8.1/lib/nokogiri/xml/searchable.rb:198:in `xpath_impl'
        from /usr/local/rvm/gems/ruby-2.3.4@global/gems/nokogiri-1.8.1/lib/nokogiri/xml/searchable.rb:179:in `xpath_internal'
        from /usr/local/rvm/gems/ruby-2.3.4@global/gems/nokogiri-1.8.1/lib/nokogiri/xml/searchable.rb:154:in `xpath'
        from /usr/local/rvm/gems/ruby-2.3.4@global/gems/epics-1.5.1/lib/epics/signer.rb:30:in `digest_node'
        from /usr/local/rvm/gems/ruby-2.3.4@global/gems/epics-1.5.1/lib/epics/signer.rb:12:in `digest!'
        from /usr/local/rvm/gems/ruby-2.3.4@global/gems/epics-1.5.1/lib/epics/middleware/xmlsig.rb:10:in `call'
        from /usr/local/rvm/gems/ruby-2.3.4@global/gems/faraday-0.13.1/lib/faraday/rack_builder.rb:141:in `build_response'
        from /usr/local/rvm/gems/ruby-2.3.4@global/gems/faraday-0.13.1/lib/faraday/connection.rb:387:in `run_request'
        from /usr/local/rvm/gems/ruby-2.3.4@global/gems/faraday-0.13.1/lib/faraday/connection.rb:174:in `post'
        from /usr/local/rvm/rubies/ruby-2.3.4/lib/ruby/2.3.0/forwardable.rb:204:in `post'
        from /usr/local/rvm/gems/ruby-2.3.4@global/gems/epics-1.5.1/lib/epics/client.rb:94:in `INI'
        from (irb):16
        from /usr/local/rvm/gems/ruby-2.3.4@global/gems/railties-4.2.9/lib/rails/commands/console.rb:110:in `start'
        from /usr/local/rvm/gems/ruby-2.3.4@global/gems/railties-4.2.9/lib/rails/commands/console.rb:9:in `start'
        from /usr/local/rvm/gems/ruby-2.3.4@global/gems/railties-4.2.9/lib/rails/commands/commands_tasks.rb:68:in `console'
        from /usr/local/rvm/gems/ruby-2.3.4@global/gems/railties-4.2.9/lib/rails/commands/commands_tasks.rb:39:in `run_command!'
        from /usr/local/rvm/gems/ruby-2.3.4@global/gems/railties-4.2.9/lib/rails/commands.rb:17:in `<top (required)>'
        from bin/rails:4:in `require'
        from bin/rails:4:in `<main>'

@hhvdev can you do me a favor and maybe add a debugging statement here:

=> https://github.com/railslove/epics/blob/master/lib/epics/signer.rb#L29

puts doc.namespaces

For some reason, which is still unclear to me is Nokogiri not finding the correct namespace.

From the stacktrace I assume that your on:

  • nokogiri 1.8.1
  • epics 1.51.
  • rails 4.3.9

Any other exotic gems? Something that might mess with Nokogiri?

Output of doc.namespaces is just an empty Hash.

The Savon Gem (1.2.0) seems to be the guilty one here.

We tested with an empty Rails Rroject and just the ebics Gem, which worked:
{"xmlns:ds"=>"http://www.w3.org/2000/09/xmldsig#", "xmlns"=>"urn:org:ebics:H004"}

After adding Savon 1.2.0 to the Gemfile, we got an empty namespaces Hash again.

The latest Version of Savon (2.11.2) is working fine! So the older Version (which we unfortunately need to use due to other dependencies) should be the origin of this problem.

ah, interesting. it seems to boil down that Gyoku is causing the problems, we're also using it in Epics but due to the savon contraint, it also loads a realy old version which apparently cannot handle attributes in the way newer versions can.

we'll try to find a way to make epics compatible with the old gyoku, but cannot promise so much at the moment.

Thanks for looking into it!

could you please try this branch? it won't have the gyoku dependency and should therefore work in your environment.

using the remove-gyoku branch, it works! cheers!

nice! thats great to hear, i'd be cool if you could keep us in the loop if also everything else works, it should ;) but ya never know.

@hhvdev the branch has been merged, please switch to master to avoid any breakages when we cleanup the old branches. I'll also let you know when a new release has hit the road.