savonrb / wasabi

A simple WSDL parser
MIT License
90 stars 84 forks source link

undefined method `element_children' for nil:NilClass in parser.rb #54

Open derekmwright opened 9 years ago

derekmwright commented 9 years ago

It appears that while looping through @messages and setting message to @messages[port_message_type] can break if the port_message_type isn't defined within that message. Being new to SOAP, I'm not sure how "valid" this is but soapui doesnt complain when parsing the WSDL. I added a check before the assignment to see if message is nil and if so just skip over the section. Let me know if you want me to provide the WSDL for validation.

wasabi-3.3.1/lib/wasabi/parser.rb:318:in `output_for': undefined method `element_children' for nil:NilClass (NoMethodError)
    from /home/dmwrigh1/.rbenv/versions/2.0.0-p353/lib/ruby/gems/2.0.0/gems/wasabi-3.3.1/lib/wasabi/parser.rb:149:in `block in parse_operations'
    from /home/dmwrigh1/.rbenv/versions/2.0.0-p353/lib/ruby/gems/2.0.0/gems/nokogiri-1.6.6.2/lib/nokogiri/xml/node_set.rb:187:in `block in each'
    from /home/dmwrigh1/.rbenv/versions/2.0.0-p353/lib/ruby/gems/2.0.0/gems/nokogiri-1.6.6.2/lib/nokogiri/xml/node_set.rb:186:in `upto'
    from /home/dmwrigh1/.rbenv/versions/2.0.0-p353/lib/ruby/gems/2.0.0/gems/nokogiri-1.6.6.2/lib/nokogiri/xml/node_set.rb:186:in `each'
    from /home/dmwrigh1/.rbenv/versions/2.0.0-p353/lib/ruby/gems/2.0.0/gems/wasabi-3.3.1/lib/wasabi/parser.rb:137:in `parse_operations'
    from /home/dmwrigh1/.rbenv/versions/2.0.0-p353/lib/ruby/gems/2.0.0/gems/wasabi-3.3.1/lib/wasabi/parser.rb:60:in `parse'
    from /home/dmwrigh1/.rbenv/versions/2.0.0-p353/lib/ruby/gems/2.0.0/gems/wasabi-3.3.1/lib/wasabi/document.rb:161:in `parse'
    from /home/dmwrigh1/.rbenv/versions/2.0.0-p353/lib/ruby/gems/2.0.0/gems/wasabi-3.3.1/lib/wasabi/document.rb:147:in `parser'
    from /home/dmwrigh1/.rbenv/versions/2.0.0-p353/lib/ruby/gems/2.0.0/gems/wasabi-3.3.1/lib/wasabi/document.rb:64:in `soap_actions'
    from /home/dmwrigh1/.rbenv/versions/2.0.0-p353/lib/ruby/gems/2.0.0/gems/savon-2.8.1/lib/savon/operation.rb:22:in `ensure_exists!'
    from /home/dmwrigh1/.rbenv/versions/2.0.0-p353/lib/ruby/gems/2.0.0/gems/savon-2.8.1/lib/savon/operation.rb:15:in `create'
    from /home/dmwrigh1/.rbenv/versions/2.0.0-p353/lib/ruby/gems/2.0.0/gems/savon-2.8.1/lib/savon/client.rb:32:in `operation'
    from /home/dmwrigh1/.rbenv/versions/2.0.0-p353/lib/ruby/gems/2.0.0/gems/savon-2.8.1/lib/savon/client.rb:36:in `call'
    from test.rb:12:in `<main>'
tjarratt commented 9 years ago

Merged and fixed. I will be trying to release a new version of Wasabi this week.

mount986 commented 6 years ago

I just had to debug through this myself. Turned out the WSDL had an operation but did not include the message. Some better error messaging at least would save a lot of debug time.