Sachin Prasad
Sachin Prasad

Reputation: 5411

Get the XML request sent by Savon gem rails

I want to get the XML request sent by Savon 2 gem in rails.

I tried setting log: true while initializing the Savon but it doesn't seem to be working as I'm not getting the request that is sent by the Savon in the log file.

I also tried Savon.client: :pretty_print_xml => true and client.config.pretty_print_xml = true , but they are also not working.

Upvotes: 0

Views: 688

Answers (2)

Dmitry Vershinin
Dmitry Vershinin

Reputation: 156

Try using Rails logger and debug log level by passing appropriate arguments:

Savon.client(log: true, logger: Rails.logger, log_level: :debug)

Upvotes: 1

Tauqeer Ahmad
Tauqeer Ahmad

Reputation: 540

To sent XML request using Savon first you need to establish connect.

client = Savon.client(wsdl: 'abc.com?wsdl', ssl_verify_mode: :none, basic_auth: ['username', 'password'])

then call your desired procedure using this call

client.call(:method_name, :message_tag => 'MethodName', :message => {book_id: 1, AuthorName: 'xyz'})

It is for rails 3.

Upvotes: 0

Related Questions