Skip to content
This repository has been archived by the owner on Apr 29, 2023. It is now read-only.

AssertionError: name tns:customValue #20

Closed
jonblack opened this issue Sep 25, 2014 · 1 comment
Closed

AssertionError: name tns:customValue #20

jonblack opened this issue Sep 25, 2014 · 1 comment

Comments

@jonblack
Copy link

Generating bindings from the following WSDL (http://wiws.cmbi.umcn.nl/wsdl) results in the error:

AssertionError: name tns:customValue

I'm not sure if this is a WSDL problem or a PyXB problem. The WSDL does have xmlns:tns="..." at the beginning.

<wsdl:definitions targetNamespace="http://swift.cmbi.ru.nl/wiws" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:tns="http://swift.cmbi.ru.nl/wiws" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/" xmlns:sawsdl="http://www.w3.org/ns/sawsdl">

I'm using version 1.2.3 installed via pip.

The full stack trace is:

Retrieving WSDL from http://wiws.cmbi.ru.nl/wsdl
WARNING:pyxb.binding.basis:Unable to convert DOM node {http://www.w3.org/2001/XMLSchema}schema at wsdl[3:4] to binding
WARNING:pyxb.binding.basis:Unable to convert DOM node {http://www.w3.org/ns/sawsdl}attrExtensions at wsdl[2873:6] to binding
PS urn:uuid:239c8f3e-4498-11e4-9de8-842b2b9f326f
Traceback (most recent call last):
File "/home/jon/.virtualenvs/hope-flask/bin/pyxbgen", line 51, in
generator.resolveExternalSchema()
File "/home/jon/.virtualenvs/hope-flask/local/lib/python2.7/site-packages/pyxb/binding/generate.py", line 2647, in resolveExternalSchema
schema = converter(self, sl)
File "/home/jon/.virtualenvs/hope-flask/bin/pyxbgen", line 28, in WSDLToSchema
spec = wsdl.definitions.createFromDOM(pyxb.utils.domutils.StringToDOM(xmld, location_base=wsdl_uri), process_schema=True, generation_uid=generator.generationUID())
File "/home/jon/.virtualenvs/hope-flask/local/lib/python2.7/site-packages/pyxb/binding/basis.py", line 1767, in createFromDOM
return self._createFromDOM(node, expanded_name, *_kw)
File "/home/jon/.virtualenvs/hope-flask/local/lib/python2.7/site-packages/pyxb/binding/basis.py", line 1791, in _createFromDOM
return element.CreateDOMBinding(node, self.elementForName(expanded_name), *_kw)
File "/home/jon/.virtualenvs/hope-flask/local/lib/python2.7/site-packages/pyxb/binding/basis.py", line 1681, in CreateDOMBinding
rv = type_class.Factory(_dom_node=node, *_kw)
File "/home/jon/.virtualenvs/hope-flask/local/lib/python2.7/site-packages/pyxb/binding/basis.py", line 308, in Factory
rv._postFactory_vx(state)
File "/home/jon/.virtualenvs/hope-flask/local/lib/python2.7/site-packages/pyxb/bundles/wssplat/wsdl11.py", line 224, in _postFactory_vx
self.__processSchema(generation_uid)
File "/home/jon/.virtualenvs/hope-flask/local/lib/python2.7/site-packages/pyxb/bundles/wssplat/wsdl11.py", line 288, in __processSchema
self.__schema = pyxb.xmlschema.schema.CreateFromDOM(wc, namespace_context=self.namespaceContext(), generation_uid=generation_uid)
File "/home/jon/.virtualenvs/hope-flask/local/lib/python2.7/site-packages/pyxb/xmlschema/structures.py", line 4858, in CreateFromDOM
rv = schema.__processTopLevelNode(cn)
File "/home/jon/.virtualenvs/hope-flask/local/lib/python2.7/site-packages/pyxb/xmlschema/structures.py", line 5037, in __processTopLevelNode
return self._addNamedComponent(component.CreateFromDOM(node, *_kw))
File "/home/jon/.virtualenvs/hope-flask/local/lib/python2.7/site-packages/pyxb/xmlschema/structures.py", line 2053, in CreateFromDOM
return rv.__setContentFromDOM(node, *_kw)
File "/home/jon/.virtualenvs/hope-flask/local/lib/python2.7/site-packages/pyxb/xmlschema/structures.py", line 2459, in __setContentFromDOM
self.__setComplexContentFromDOM(node, content_node, definition_node_list, self.__pendingDerivationMethod, *_kw)
File "/home/jon/.virtualenvs/hope-flask/local/lib/python2.7/site-packages/pyxb/xmlschema/structures.py", line 2303, in __setComplexContentFromDOM
effective_content = Particle.CreateFromDOM(typedef_node, *_kw)
File "/home/jon/.virtualenvs/hope-flask/local/lib/python2.7/site-packages/pyxb/xmlschema/structures.py", line 3141, in CreateFromDOM
rv.__term = ModelGroup.CreateFromDOM(node, *_kw)
File "/home/jon/.virtualenvs/hope-flask/local/lib/python2.7/site-packages/pyxb/xmlschema/structures.py", line 2884, in CreateFromDOM
particles.append(Particle.CreateFromDOM(node=cn, *_kw))
File "/home/jon/.virtualenvs/hope-flask/local/lib/python2.7/site-packages/pyxb/xmlschema/structures.py", line 3123, in CreateFromDOM
rv.__term = ElementDeclaration.CreateFromDOM(node=node, *_kw)
File "/home/jon/.virtualenvs/hope-flask/local/lib/python2.7/site-packages/pyxb/xmlschema/structures.py", line 1590, in CreateFromDOM
rv = cls(name=name, node=node, **kw)
File "/home/jon/.virtualenvs/hope-flask/local/lib/python2.7/site-packages/pyxb/xmlschema/structures.py", line 1556, in init
super(ElementDeclaration, self).init(_args, *_kw)
File "/home/jon/.virtualenvs/hope-flask/local/lib/python2.7/site-packages/pyxb/xmlschema/structures.py", line 170, in init
super(_SchemaComponent_mixin, self).init(_args, *_kw)
File "/home/jon/.virtualenvs/hope-flask/local/lib/python2.7/site-packages/pyxb/xmlschema/structures.py", line 764, in init
assert (name is None) or (0 > name.find(':')), 'name %s' % (name,)
AssertionError: name tns:customValue

@pabigot
Copy link
Owner

pabigot commented Sep 25, 2014

This is an error in the schema that is part of the wsdl. The problem occurs on line 1729, where a QName is improperly used as the name of an element. The schema correction to apply is:

--- cmbi.wsdl-orig  2014-09-25 05:43:15.293861521 -0500
+++ cmbi.wsdl       2014-09-25 05:42:40.930075975 -0500
@@ -1726,7 +1726,7 @@
       </xsd:complexType>
       <xsd:complexType name="CUSTOMVALUE">
         <xsd:sequence>
-          <xsd:element name="tns:customValue"/>
+          <xsd:element name="customValue" type="tns:customValue"/>
         </xsd:sequence>
       </xsd:complexType>
       <xsd:complexType name="customValue">

If you are not already doing so, you can run pyxbwsdl on a locally modified version with:

wget -O cmbi.wsdl  http://wiws.cmbi.umcn.nl/wsdl
# apply fix described above
pyxbwsdl file:cmbi.wsdl

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants