Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

wsdl2py fails if 'operation' element has no 'output' child element #81

Closed
madsweitling opened this issue Feb 24, 2016 · 9 comments
Closed
Labels
Milestone

Comments

@madsweitling
Copy link

When running the following, an exception is raised in soapfish.wsdl12.Operation.get_OutputMessage:

mads@work:~/test$ wsdl2py -s minimal.wsdl 
Traceback (most recent call last):
  File "/home/mads/.virtualenvs/hvitserk/bin/wsdl2py", line 9, in <module>
    load_entry_point('soapfish==0.6.dev0', 'console_scripts', 'wsdl2py')()
  File "/home/mads/.virtualenvs/hvitserk/local/lib/python2.7/site-packages/soapfish/wsdl2py.py", line 112, in main
    code = generate_code_from_wsdl(xml, target, opt.use_wsa, cwd=cwd)
  File "/home/mads/.virtualenvs/hvitserk/local/lib/python2.7/site-packages/soapfish/wsdl2py.py", line 84, in generate_code_from_wsdl
    use_wsa=use_wsa,
  File "/home/mads/.virtualenvs/hvitserk/local/lib/python2.7/site-packages/jinja2/environment.py", line 989, in render
    return self.environment.handle_exception(exc_info, True)
  File "/home/mads/.virtualenvs/hvitserk/local/lib/python2.7/site-packages/jinja2/environment.py", line 754, in handle_exception
    reraise(exc_type, exc_value, tb)
  File "/home/mads/.virtualenvs/hvitserk/local/lib/python2.7/site-packages/soapfish/templates/wsdl", line 41, in top-level template code
    {%- set outputMessage = operation.get_OutputMessage() -%}
  File "/home/mads/.virtualenvs/hvitserk/local/lib/python2.7/site-packages/soapfish/wsdl11.py", line 99, in get_OutputMessage
    messageName = portTypeOperation.output.message
AttributeError: 'NoneType' object has no attribute 'message'

minimal.wsdl

@FelixSchwarz
Copy link
Member

Thank you very much for reporting the issue. I can reproduce this. One thing I have to double check is if this is a valid WSDL (is "output" optional?). You could help me here by looking for some spec and/or suggest a fix.

@madsweitling
Copy link
Author

I'm not too sure myself :) But the original WSDL file loads in Eclipse and Wizdler (Chrome extension). Validating minimal.wsdl against validwsdl.com gives no errors.
Validating minimal.wsdl against wsdl-analyzer.com gives an (unrelated?) error regarding the use attribute on the soap12:body child element. See http://www.wsdl-analyzer.com/service/service/1807005354?version=1

Although I don't like quoting w3schools.com, http://www.w3schools.com/xml/xml_wsdl.asp has an example of an operation element without an output child element (under the paragraph "WSDL One-Way Operation"). In fact, "one-way operation" would well describe the use case I'm trying to support.

@FelixSchwarz
Copy link
Member

@madsweitling I just checked and I think your WSDL is correct ( https://www.w3.org/TR/wsdl#_one-way ). I don't have much time available right now. Can you work around the problem locally right now?

@ngnpope
Copy link
Member

ngnpope commented Mar 21, 2016

I have been working on a lot of fixes and this one should be solved in my improvements branch by the commit range fe05c22...1dff9fd. I still have a few more things to finish before I submit a pull request.

@madsweitling
Copy link
Author

@FelixSchwarz I'm working around the issue locally.
@pope1ni Thanks for your fixes, I'll see if I can try them out with my offending WSDL.

@madsweitling
Copy link
Author

@pope1ni I gave your improvements branch a spin, however I'm getting a different exception using the same minimal.wsdl posted earlier. I get the same exception when trying the original offending WSDL file.

(.venv)mads@work:~/github/soapfish-improvements$ python -m soapfish.wsdl2py -s ~/minimal.wsdl                                                                                                 
Traceback (most recent call last):
  File "/usr/lib/python2.7/runpy.py", line 162, in _run_module_as_main
    "__main__", fname, loader, pkg_name)
  File "/usr/lib/python2.7/runpy.py", line 72, in _run_code
    exec code in run_globals
  File "/home/mads/github/soapfish-improvements/soapfish/wsdl2py.py", line 93, in <module>
    main()
  File "/home/mads/github/soapfish-improvements/soapfish/wsdl2py.py", line 84, in main
    code = generate_code_from_wsdl(xml, target, opt.use_wsa, cwd=cwd)
  File "/home/mads/github/soapfish-improvements/soapfish/wsdl2py.py", line 56, in generate_code_from_wsdl
    use_wsa=use_wsa,
  File "/usr/local/lib/python2.7/dist-packages/jinja2/environment.py", line 969, in render
    return self.environment.handle_exception(exc_info, True)
  File "/usr/local/lib/python2.7/dist-packages/jinja2/environment.py", line 742, in handle_exception
    reraise(exc_type, exc_value, tb)
  File "soapfish/templates/wsdl", line 32, in top-level template code
    def {{ operation.name }}(request, {{ _im.part.element|remove_namespace }}):
  File "/usr/local/lib/python2.7/dist-packages/jinja2/environment.py", line 397, in getattr
    return getattr(obj, attribute)
  File "soapfish/wsdl11.py", line 67, in part
    raise ValueError('expected exactly one part', self.name, self.parts)
ValueError: ('expected exactly one part', 'operationRequest', [<soapfish.wsdl12.Part object at 0x7fd93aac6910>, <soapfish.wsdl12.Part object at 0x7fd93aac6950>])

@ngnpope
Copy link
Member

ngnpope commented Apr 5, 2016

Right. So I have solved the issue raised in the original report in my branch as mentioned. What you are seeing now is a bug being tracked in #75. The ValueError was introduced in e04a585. Before this commit only a single <wsdl:part> element was supported in soapfish and after some areas of the code were corrected to support multiple elements, but the support for it is incomplete.

@madsweitling
Copy link
Author

@pope1ni You are right, I'm seeing #75 now. @FelixSchwarz Feel free to close this bug since it's probably a duplicate of #75 now.

@FelixSchwarz
Copy link
Member

@madsweitling you could do it yourself :-)

closing as duplicate of #75 as per comments above.

@ngnpope ngnpope added this to the 0.6.0 milestone Jul 5, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

No branches or pull requests

3 participants