0

Is there any example of WSDL Parser using SOAP4R? I'm trying to list all operations of WSDL file but I can't figure it out :( Can you post me some tutorial? Thx

Mr Black
  • 219
  • 4
  • 15

1 Answers1

5

Maybe that isn't answer you want, but I recommend you switch to Savon. For example, your task looks like this snippet (this example taken from github's savon page):

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" } }
WarHog
  • 8,622
  • 2
  • 29
  • 23
  • basically I need just to interpret the wsdl in user-friendly way. I need to list operations, bindings, endpoints, types etc. Do you think this "Savon" thing could do it? – Mr Black Oct 22 '11 at 21:47
  • You can look at these pages: http://rubydoc.info/gems/savon/0.7.9/Savon/WSDL and http://rubydoc.info/gems/wasabi/2.0.0/Wasabi/Document. All methods that available through Soap.Client instance are listed there. You can use :soap_endpoint, :soap_actions, :operations, :type_definitions etc. But unfortunately I'm not sure about bindings :( – WarHog Oct 22 '11 at 22:49
  • 2
    so I've tried to use SOAP4R again and with `require "wsdl/import"` and `@wsdl = WSDL::Importer.import(urlOfWsdl)` I've managed to print all needed data (except address location of non-soap endpoint/port). But I've also figured out that it doesn't recognize WSDL 2.0 file :( – Mr Black Oct 24 '11 at 09:11