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

AttributeError: 'lxml.etree.QName' object has no attribute 'resolve' when parsing WSDL #803

Open
gabejackson opened this issue Aug 12, 2018 · 2 comments

Comments

@gabejackson
Copy link

@gabejackson gabejackson commented Aug 12, 2018

Hi, I'm receiving an AttributeError: 'lxml.etree.QName' object has no attribute 'resolve' exception when parsing the attached WSDL (It is huge and contains lots of XSDs and imports)

wsdl.zip

The code leading to the issue is simple:

from zeep import Client
client = Client('wsdl/1.wsdl')

Zeep version: 3.1.0

Any idea what could be causing this? It took me a while to download all the WSDL and related XSD files since they were behind a VPN.. hope it helps.

@gabejackson

This comment has been minimized.

Copy link
Author

@gabejackson gabejackson commented Aug 12, 2018

just as a quick update: I think the culprit is in owsCommon.xsd, namely the element PositionType2D:

  <simpleType name="PositionType2D">
    <annotation>
      <documentation>Two-dimensional position instances hold the longitude and latitude coordinates of a position in the 2D WGS 84 coordinate reference system. The longitude value shall be listed first, followed by the latitude value, both in decimal degrees. Latitude values shall range from -90 to +90 degrees, and longitude values shall normally range from -180 to +180 degrees. For the longitude axis, special conditions apply when the bounding box is continuous across the +/- 180 degrees meridian longitude value discontinuity:
a)  If the bounding box is continuous clear around the Earth, then longitude values of minus and plus infinity shall be used.
b)  If the bounding box is continuous across the value discontinuity but is not continuous clear around the Earth, then some non-normal value can be used if specified for a specific OWS use of the WGS84BoundingBoxType. For more information, see Subclauses 10.4.5 and C.13.</documentation>
    </annotation>
    <restriction base="ows:PositionType">
      <length value="2"/>
    </restriction>
  </simpleType>

Replacing

<restriction base="ows:PositionType">
  <length value="2"/>
</restriction>

with

<list itemType="double"/>

removes the problem.

Maybe there is a problem when processing restrictions? must be somewhere around lines 477 in xsd/visitor.py

if child.tag == tags.restriction:
    base_type = self.visit_restriction_simple_type(child, node)
    xsd_type = UnresolvedCustomType(qname, base_type, self.schema)

The next exception AttributeError: 'RefElement' object has no attribute 'attr_name' might be related to Issue #377 but let's check that when the first one is resolved.

Thanks for any help with this! Kind regards

@gabejackson

This comment has been minimized.

Copy link
Author

@gabejackson gabejackson commented Aug 13, 2018

This Issue seems related to #513 (if not a duplicate)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
1 participant
You can’t perform that action at this time.