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

Zeep ignores all dictionaries in list, except for the first

Open diflores opened this issue 6 years ago • 0 comments

Hello: First, I want to thank you for making this library publicly available. It has helped me a lot at work. I'm using Zeep: 4.0.0 and have the following problem: I have to send data to a website with the following WSDL: https://pre.fincaraiz.com.co/ws/wsinmobiliarias_v2.asmx?WSDL. The method I use is PublishAd_V8. I thought everything was cool, but then I noticed that only the first image of an array of image I have to post is actually included in the request. Specifically, I have a list of dicts like the following:

[
    {
        "objImagenes": {
            "URL": "https://properties-media.s3.amazonaws.com/thumbnail/be4b7c2e-77ec-43d2-8d8b-7e4924736bc220201009_111712.jpg",
            "tipoMultimedia": 1
        }
    },
    {
        "objImagenes": {
            "URL": "https://properties-media.s3.amazonaws.com/thumbnail/be4b7c2e-77ec-43d2-8d8b-7e4924736bc2_mg_1656.jpg",
            "tipoMultimedia": 2
        }
    },
    {
        "objImagenes": {
            "URL": "https://properties-media.s3.amazonaws.com/thumbnail/be4b7c2e-77ec-43d2-8d8b-7e4924736bc2_mg_1655.jpg",
            "tipoMultimedia": 2
        }
    },
    {
        "objImagenes": {
            "URL": "https://properties-media.s3.amazonaws.com/thumbnail/be4b7c2e-77ec-43d2-8d8b-7e4924736bc2_mg_1653.jpg",
            "tipoMultimedia": 2
        }
    },
    {
        "objImagenes": {
            "URL": "https://properties-media.s3.amazonaws.com/thumbnail/be4b7c2e-77ec-43d2-8d8b-7e4924736bc2_mg_1654.jpg",
            "tipoMultimedia": 2
        }
    },
    {
        "objImagenes": {
            "URL": "https://properties-media.s3.amazonaws.com/thumbnail/be4b7c2e-77ec-43d2-8d8b-7e4924736bc2_mg_1652.jpg",
            "tipoMultimedia": 2
        }
    },
    {
        "objImagenes": {
            "URL": "https://properties-media.s3.amazonaws.com/thumbnail/be4b7c2e-77ec-43d2-8d8b-7e4924736bc2_mg_1650.jpg",
            "tipoMultimedia": 2
        }
    },
    {
        "objImagenes": {
            "URL": "https://properties-media.s3.amazonaws.com/thumbnail/be4b7c2e-77ec-43d2-8d8b-7e4924736bc2_mg_1648.jpg",
            "tipoMultimedia": 2
        }
    },
    {
        "objImagenes": {
            "URL": "https://properties-media.s3.amazonaws.com/thumbnail/be4b7c2e-77ec-43d2-8d8b-7e4924736bc2_mg_1643.jpg",
            "tipoMultimedia": 2
        }
    },
    {
        "objImagenes": {
            "URL": "https://properties-media.s3.amazonaws.com/thumbnail/be4b7c2e-77ec-43d2-8d8b-7e4924736bc2_mg_1647.jpg",
            "tipoMultimedia": 2
        }
    },
    {
        "objImagenes": {
            "URL": "https://properties-media.s3.amazonaws.com/thumbnail/be4b7c2e-77ec-43d2-8d8b-7e4924736bc2_mg_1645.jpg",
            "tipoMultimedia": 2
        }
    }
]

As you can see, this list has more than one element. Sadly, when I go to check the XML built by Zeep:

      <ns0:Imagenes>
        <ns0:objImagenes>
          <ns0:tipoMultimedia>1</ns0:tipoMultimedia>
          <ns0:URL>https://properties-media.s3.amazonaws.com/thumbnail/ad7dfc78-beb9-4e15-96f8-e4bfe1478b4820200916_160541.jpg</ns0:URL>
        </ns0:objImagenes>
      </ns0:Imagenes>

There's only one element.

I can't provide an example script because this is private information from my company. But here's what I do to send my request:

client.service.PublishAd_V8(**prop, _soapheaders=CREDENTIALS[mode]["AuthHeader"], Imagenes=images)

Here, prop is a dictionary with all the attributes specified in the WSDL, CREDENTIALS is a dictionary with credentials for authentication, and Imagenes is the list of dictionaries that I have to send. Both props and CREDENTIALS are working as required.

Thank you in advance 😁

EDIT: I'm closing this issue, because I discovered that the problem is solved when using factories. Thank you!

diflores avatar Oct 16 '20 20:10 diflores