使用SOAP4R解析WSDL文件

时间:2011-10-22 17:39:04

标签: ruby wsdl soap4r

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

1 个答案:

答案 0 :(得分:4)

也许这不是你想要的答案,但我建议你切换到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" } }