suds-community / suds

Suds is a lightweight SOAP python client for consuming Web Services. A community fork of the jurko fork.
https://suds.readthedocs.io/
GNU Lesser General Public License v3.0
173 stars 56 forks source link

Getting suds.TypeNotFound for complexType #78

Closed falk-stefan closed 2 years ago

falk-stefan commented 2 years ago

I am not sure if the following problem is caused by me, the WSDL file type-definition or whether suds has a problem parsing these complex types.

In the provided schema I have the folloing type-definitons:

<s:complexType name="BrKonsSearchRequest">
    <s:sequence>
        <!-- ... -->
        <s:element minOccurs="0" maxOccurs="1" name="Fassung" type="tns:Fassungsangabe"/>
    </s:sequence>
</s:complexType>
<!-- ... -->
<s:complexType name="Fassungsangabe"/>
<s:complexType name="StichtagFassungsangabe">
<s:complexContent mixed="false">
    <s:extension base="tns:Fassungsangabe">
        <s:sequence>
            <s:element minOccurs="1" maxOccurs="1" name="FassungVom" nillable="true" type="s:date"/>
        </s:sequence>
    </s:extension>
</s:complexContent>
</s:complexType>

My problems is that I am not able to map this to a request.

If I send a request like so:

ris_client.service.SearchDocuments({
    "BrKond": {
        "Fassung": {}
    }
})

It will work but I want to set FassungVom (the date of the document) but I am unable to.

# suds.TypeNotFound @ FassungVom
ris_client.service.SearchDocuments({
    "BrKond": {
        "Fassung": {
            "FassungVom": "2021-01-01"
        }
    }
})

# suds.TypeNotFound @ StichtagFassungsangabe
ris_client.service.SearchDocuments({
    "BrKond": {
        "StichtagFassungsangabe": {
            "FassungVom": "2021-01-01"
        }
    }
})

# etc ..

I can verify however, that these types exist. Inspecting them I'd say that these types should exist:

image

Am I doing something wrong here or is the type-definition above problematic somehow?

Thank you for any help on this!

phillbaker commented 2 years ago

Hi @falk-stefan, instead of using dicts to construct complex objects, please construct complex objects explicitly. See the docs here: https://github.com/suds-community/suds#complex-arguments

falk-stefan commented 2 years ago

@phillbaker Hi!

Thanks a lot! This worked. I had to fix a few other things using a MessagePlugin but so far things seem to work.