[英]Get the XML request sent by Savon gem rails
I want to get the XML request sent by Savon 2 gem in rails. 我想获得Savon 2 gem在Rails中发送的XML请求。
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. 我尝试在初始化Savon时设置log: true
,但是由于我没有在日志文件中收到Savon发送的请求,因此它似乎没有用。
I also tried Savon.client: :pretty_print_xml => true
and client.config.pretty_print_xml = true
, but they are also not working. 我还尝试了Savon.client: :pretty_print_xml => true
和client.config.pretty_print_xml = true
,但是它们也无法正常工作。
尝试通过传递适当的参数来使用Rails记录器和调试日志级别:
Savon.client(log: true, logger: Rails.logger, log_level: :debug)
To sent XML request using Savon first you need to establish connect. 要首先使用Savon发送XML请求,您需要建立连接。
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. 适用于导轨3。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.