Ticket #45 (closed defect: fixed)

Opened 6 years ago

Last modified 5 years ago

tns not mapped to prefix

Reported by: newspire@… Owned by: jortel
Priority: major Milestone: 0.3.2
Component: suds (general) Version: 0.3
Keywords: Cc:
Blocked By: Blocking:

Description

I get an exception when I try to load the following WSDL. Not sure if this is a problem with suds or with the WSDL. The same WSDL works with other clients. I do not have access to the server but I think it is WebLogic? v10. Thanks! I'm excited about suds.

c = Client('https://vsptest.i-911.net/I911Impl/i911ws?WSDL')

DEBUG:suds.wsdl:reading wsdl at: https://vsptest.i-911.net/I911Impl/i911ws?WSDL ... DEBUG:suds.wsdl:importing (https://vsptest.i-911.net:443/I911Impl/i911ws?WSDL/i9 11.xsd) DEBUG:suds.wsdl:reading wsdl at: https://vsptest.i-911.net:443/I911Impl/i911ws?W SDL/i911.xsd ... DEBUG:suds.wsdl:warning: tns (http://www.hbfgroup.com/sosubmit), not mapped to p refix DEBUG:suds.wsdl:importing (None) Traceback (most recent call last):

File "<stdin>", line 1, in <module> File "C:\Python25\lib\site-packages\python_suds-0.3.1-py2.5.egg\suds\client.py

", line 67, in init

File "C:\Python25\lib\site-packages\python_suds-0.3.1-py2.5.egg\suds\client.py

", line 369, in init

File "C:\Python25\lib\site-packages\python_suds-0.3.1-py2.5.egg\suds\wsdl.py",

line 185, in init

File "C:\Python25\lib\site-packages\python_suds-0.3.1-py2.5.egg\suds\wsdl.py",

line 233, in open_imports

File "C:\Python25\lib\site-packages\python_suds-0.3.1-py2.5.egg\suds\wsdl.py",

line 313, in load

File "C:\Python25\lib\site-packages\python_suds-0.3.1-py2.5.egg\suds\wsdl.py",

line 185, in init

File "C:\Python25\lib\site-packages\python_suds-0.3.1-py2.5.egg\suds\wsdl.py",

line 233, in open_imports

File "C:\Python25\lib\site-packages\python_suds-0.3.1-py2.5.egg\suds\wsdl.py",

line 311, in load

TypeError?: argument of type 'NoneType?' is not iterable

Change History

comment:1 Changed 6 years ago by anonymous

Hey newspire,

Glad to have you using suds!

After review, I'm surprised this works with other clients.

The import

<s0:import 
   location="https://vsptest.i-911.net:443/I911Impl/i911ws?WSDL/i911.xsd"
   namespace="http://www.hbfgroup.com/sosubmit"/>

is directly importing an XSD into the root of the WSDL (definitions). The document referenced by (location=) should be a WSDL document not an XSD document. Something like:

<definitions>
  <types>
    <xsd:schema>
       ...
    </xsd:schema>
  </types>
</definitions>

The WSDL specification ( http://www.w3.org/TR/wsdl#_Toc492291093 ) section 2.1. requires that <xsd:schema/> nodes be placed under the <types/> node. Also, the <wsdl:import/> is designed to import other WSDL documents, not XSD documents.

One thing I did find however, is that suds was blindly processing nodes within the WSDL and XSD documents. That is, it was not qualifying the contents by namespace which accounts for the strange exception in your case. The Definitions class was trying to process the imported XSD document as a WSDL document. So, by processing the child nodes of the documents by name and namespace, this type of exception will no longer by raised when a <wsdl:import/> is used to import an XSD document. Further, if a non-wsdl node is found in a WSDL and and non-schema nodes is found in an XSD document, they will be ignored. This change is in 0.3.2 (r320).

As for your case, I want suds to work for you! However, I'm not sure what to do. If other clients are processing this wsdl, then these other clients must have been built to tolerate deviation from the specs. Which other clients work for this?

comment:2 Changed 5 years ago by newspire@…

I tried the current trunk version (326) and now I get the following exception.

C:\Projects\trunk\HBF>python hbftest.py Traceback (most recent call last):

File "hbftest.py", line 3, in <module>

c = Client('https://vsptest.i-911.net/I911Impl/i911ws?WSDL')

File "build\bdist.win32\egg\suds\client.py", line 71, in init File "build\bdist.win32\egg\suds\servicedefinition.py", line 49, in init File "build\bdist.win32\egg\suds\servicedefinition.py", line 76, in addports File "build\bdist.win32\egg\suds\bindings\document.py", line 95, in param_defs

File "build\bdist.win32\egg\suds\bindings\binding.py", line 349, in part_types

suds.TypeNotFound?: Type not found: '(VerifyTnData?, http://www.hbfgroup.com/sosubmit, )'

I have not personally tried other clients. However, I do know that others are using this webservice. I did try a couple of online wsdl validators. This one seems to parse it.

http://www.soapclient.com/soaptest.html

The publishers of this server also sent me back an example java client. This makes me think that this webservice does work with at least some implementations.

You said it is not proper to import an xsd document into the root. Please understand I know little about the complexities of SOAP, but I found an example on the w3.org site that seems to do this kind of import.

http://www.w3.org/TR/wsdl#_style

Thanks for your help! Andy

comment:3 Changed 5 years ago by newspire@…

SOAPpy and XMLSpy can parse this WSDL file.

comment:4 Changed 5 years ago by jortel

  • Resolution set to fixed
  • Status changed from new to closed

Added support for <wsdl:import/> to import schema documents in (r358).

comment:5 Changed 5 years ago by jortel

  • Milestone set to 0.3.2

Tag for release on 0.3.2.

Note: See TracTickets for help on using tickets.