SAVON 将 XML 作为请求传递给 wsdl 并得到响应 xml

SAVON passing XML as a request to wsdl and getting response as xml

我有一个第三方应用程序,这个应用程序的输出是一个请求xml,需要传递给网络服务 (WSDL)

我需要进行集成测试,我将在其中收到此请求 xml。

如何在 Ruby 中使用 savon 传递此请求 xml? 有没有其他方法可以传递请求 xml 并得到响应的输出 xml

我尝试使用 soapui 并且它有效,但我正在寻找本地 ruby 解决方案

您好,我找到了答案,下面是代码

然后(/^我测试wsdl$/)做 需要 'savon'

require 'nokogiri'

xml_file = File.read("/test.xml")

client = Savon.client(wsdl: '/globalweather.wsdl', ssl_verify_mode: :none, ssl_version: :TLSv1)

response = client.call(:get_cities_by_country, xml: xml_file)
puts response.to_xml
print response.to_xml

结束