Menu

Conflicting element declarations

Help
2013-03-08
2013-03-13
  • Daniel Banck

    Daniel Banck - 2013-03-08

    I've been working with pyxb for quite a while and every wsdl/xsd I've processed was working without problem.

    Now I'm facing a wsdl which I can't convert into class bindings:
    https://paste.welcloud.de/show/aOavmPtlRuKriZsy0MdT/

    I can't provide you the wsdl file.
    Can you tell me how to debug or fix this error?

    Thanks!

     
  • Peter A. Bigot

    Peter A. Bigot - 2013-03-08

    Error copied below for historical purposes.

    No, without seeing the complete wsdl I can't say how to fix it. I've found that a lot of schemas in WSDL simply aren't valid; if it really does have two Value elements at the top level with conflicting types, then there's nothing PyXB can do about it.

    $ pyxbgen --wsdl-location="file:///.../the.wsdl" --module=create_order
    [...]
    Exception generating bindings: Conflicting element declarations for Value: existing STD[integer:restriction of decimal fractionDigits="0",pattern=""] versus new STD[SimpleOpenDeliveries:restriction of int fractionDigits="0",pattern="",maxInclusive="2147483647",minInclusive="-2147483648",totalDigits="None",maxExclusive="None",whiteSpace="collapse",enumeration="",minExclusive="None"]
    Traceback (most recent call last):
    [...]
      File "/home/daniel/.virtualenvs/otto-wss/local/lib/python2.7/site-packages/pyxb/xmlschema/structures.py", line 2881, in _adaptForScope
        scoped_particles = [ _p._adaptForScope(maybe_rv, ctd) for _p in self.particles() ]
      File "/home/daniel/.virtualenvs/otto-wss/local/lib/python2.7/site-packages/pyxb/xmlschema/structures.py", line 3141, in _adaptForScope
        term = rv.__term._adaptForScope(maybe_rv, ctd)
      File "/home/daniel/.virtualenvs/otto-wss/local/lib/python2.7/site-packages/pyxb/xmlschema/structures.py", line 1675, in _adaptForScope
        ctd._recordLocalDeclaration(rv)
      File "/home/daniel/.virtualenvs/otto-wss/local/lib/python2.7/site-packages/pyxb/xmlschema/structures.py", line 1815, in _recordLocalDeclaration
        raise pyxb.SchemaValidationError('Conflicting element declarations for %s: existing %s versus new %s' % (decl.expandedName(), existing_type, pending_type))
    
     
  • Daniel Banck

    Daniel Banck - 2013-03-11

    Tools like SOAP UI can load the wsdl without any problems.

    Can you explain the error message to me? For what elements I have to look out and where?

     
  • Peter A. Bigot

    Peter A. Bigot - 2013-03-11

    Tools like SOAP UI don't usually don't validate the XML, so it isn't surprising that they work. It's also possible that PyXB is not extracting the schema from the WSDL correctly.

    Without seeing the cause of the error I can't explain it, but the PyXB diagnostic says there are two elements at the top level, both named Value, that have slightly different type definitions: one is a restriction of xs:decimal that appears to force an int value by disallowing fraction digits, and one is a restriction of xs:int. They are not equivalent from a type model since xs:decimal does not impose a max/min value while xs:int does. In that case the only way those declarations could be compatible is if they belong to two different namespaces.

     
  • Peter A. Bigot

    Peter A. Bigot - 2013-03-11

    It's also possible that one or both is not at the top level but that they end up both appearing at the same level in the content for some other type.

    Another way such declarations could be compatible is if the two Value element declarations were inside distinct types that are not related by restriction/extension. If that's the case then it could be a PyXB bug, but I'd have to see a schema that reproduced the problem in order to fix it.

     
  • Daniel Banck

    Daniel Banck - 2013-03-11

    The wsdl requires 25 xsd's, so it's a bit tricky to find the correct location, but I've found the following:

    <simpleType name="SimpleOpenDeliveries">
        <restriction base="int" />
    </simpleType>
    
    <complexType name="OpenDeliveries">
        <complexContent>
            <restriction base="syspara:Money">
                <sequence>
                    <element name="Value" type="debitmanagement:SimpleOpenDeliveries" />
                    <element name="Currency" type="syspara:Currency" />
                </sequence>
            </restriction>
        </complexContent>
    </complexType>
    

    In syspara Money is defined as following:

    <complexType name="Money">
        <sequence>
            <element name="Value" type="integer" />
            <element name="Currency" type="syspara:Currency" />
        </sequence>
    </complexType>
    

    Could this cause the error?

     
  • Peter A. Bigot

    Peter A. Bigot - 2013-03-11

    Yes, that seems possible. I'll try to build a standalone schema that reproduces the problem.

     
  • Peter A. Bigot

    Peter A. Bigot - 2013-03-11

    Thanks for the reproducing test case. That is a bug, now recorded as trac 193, and fixed in the branch next of the git repository. You can obtain a patch either from git, or here. The full patch includes the reproducing test case.

    Let me know if you have further issues.

     
  • Daniel Banck

    Daniel Banck - 2013-03-12

    Thanks for the fast fix! I'm sorry to bother you again, but here is another error:

    SchemaValidationError: Conflicting element declarations for Value: existing STD[anySimpleType:the ur-type] versus new STD[SimpleDunningLevel:restriction of byte fractionDigits="0",maxInclusive="9",minInclusive="0",totalDigits="None",enumeration="",maxExclusive="None",whiteSpace="collapse",pattern="",minExclusive="None"]
    

    Here is the according xml:

    <simpleType name="SimpleDunningLevel">
        <restriction base="byte">
            <minInclusive value="0" />
            <maxInclusive value="9" />
        </restriction>
    </simpleType>
    
    <complexType name="HighestDunningLevelBySeason">
        <complexContent>
            <restriction base="common:BySeason">
                <sequence>
                    <element name="Season" type="customercommon:RelativeSeasonID" />
                    <element name="Value" type="customercredit:SimpleDunningLevel" />
                </sequence>
            </restriction>
        </complexContent>   
    </complexType>
    

    From common.xsd:

    <complexType name="BySeason">
        <sequence>
            <element name="Season" type="common:RelativeSeasonID" />
            <element name="CurrencyAmount" type="syspara:Money" minOccurs="0" />
            <element name="Count" type="integer" minOccurs="0" />
            <element name="Value" type="anySimpleType" minOccurs="0" />
        </sequence> 
    </complexType>
    
     
  • Peter A. Bigot

    Peter A. Bigot - 2013-03-12

    OK, I've added another patch that extends the fix to handle cases where the base declaration references an ur type. Patch is here. Let me know if you find anything else.

     
  • Daniel Banck

    Daniel Banck - 2013-03-13

    Awesome!
    I was just able to generate the bindings.
    Thanks a lot :)

     

Log in to post a comment.

MongoDB Logo MongoDB