mvantellingen / python-zeep

A Python SOAP client
http://docs.python-zeep.org
Other
1.89k stars 586 forks source link

issue parsing dict with array #1020

Open andreabisello opened 5 years ago

andreabisello commented 5 years ago

calling the soap services InsertDraftElectronicInvoice

image

using a dict,

answer = client.service.InsertDraftElectronicInvoice(
        paramAuth={"CustomerCode": CODICE_CLIENTE, "Password": BYTES_PASSWORD_CLIENTE_CIFRATA},
        uploadRequest={
            "UploadingFiles": [{
                "UploadElectronicInvoiceFileRequest": {
                    "TransactionId": "",
                    "FileName": filename,
                    "Content": content,
                    "StateInvoice": "ToSend",
                    "ProformaInvoice": True,
                    "PathFileInvoice": ""
                },
                "UploadElectronicInvoiceFileRequest": {
                    "TransactionId": "",
                    "FileName": filename,
                    "Content": content,
                    "StateInvoice": "ToSend",
                    "ProformaInvoice": True,
                    "PathFileInvoice": ""
                }
            }]
        }
    )

the library will send only the first element of the array

but if i use the get_type

answer = client.service.InsertDraftElectronicInvoice(
        paramAuth={"CustomerCode": CODICE_CLIENTE, "Password": BYTES_PASSWORD_CLIENTE_CIFRATA},
        uploadRequest=client.get_type('ns0:UploadElectronicInvoiceRequest')(
            client.get_type('ns0:ArrayOfUploadElectronicInvoiceFileRequest')(
                [client.get_type('ns0:UploadElectronicInvoiceFileRequest')(
                    FileName="uno.xml",
                    Content=content,
                    StateInvoice="ToSend",
                    ProformaInvoice=True
                ),
                client.get_type('ns0:UploadElectronicInvoiceFileRequest')(
                        FileName="due.xml",
                        Content=content,
                        StateInvoice="ToSend",
                        ProformaInvoice=True
                    )
                ]
            )
        )
    )

it works, sending array with two elements.

CharlieEarnup commented 3 years ago

I too am experiencing this bug.

simonryf commented 11 months ago

+1

chipytux commented 1 month ago

+1

alexsanderam commented 1 month ago

+1