python-zeep icon indicating copy to clipboard operation
python-zeep copied to clipboard

issue parsing dict with array

Open andreabisello opened this issue 6 years ago • 5 comments

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.

andreabisello avatar Oct 24 '19 07:10 andreabisello

I too am experiencing this bug.

CharlieEarnup avatar Apr 13 '21 20:04 CharlieEarnup

+1

simonryf avatar Nov 23 '23 13:11 simonryf