使用 SOAP4R 解析 WSDL 文件

Mr *_*ack 0 ruby wsdl soap4r

有使用 SOAP4R 的 WSDL 解析器的示例吗?我正在尝试列出 WSDL 文件的所有操作,但我无法弄清楚:( 你能给我发布一些教程吗?谢谢

War*_*Hog 5

也许这不是您想要的答案,但我建议您切换到Savon。例如,您的任务类似于以下代码片段(此示例取自 github 的 savon 页面):

require "savon"

# create a client for your SOAP service
client = Savon::Client.new("http://service.example.com?wsdl")

client.wsdl.soap_actions
# => [:create_user, :get_user, :get_all_users]

# execute a SOAP request to call the "getUser" action
response = client.request(:get_user) do
  soap.body = { :id => 1 }
end

response.body
# => { :get_user_response => { :first_name => "The", :last_name => "Hoff" } }
Run Code Online (Sandbox Code Playgroud)

  • 所以我尝试再次使用 SOAP4R 并使用 `require "wsdl/import"` 和 `@wsdl = WSDL::Importer.import(urlOfWsdl)` 我成功地打印了所有需要的数据(除了非地址位置)肥皂端点/端口)。但我也发现它无法识别 WSDL 2.0 文件:( (2认同)