SOAP list of strings to xsd:string[] with zeep

I have to interact with a WSDL. When I explore de WSDL

$ python3 -mzeep "http://xxxxxxxxx/xxxxx/xxxx?wsdl" 

It returns

Prefixes:
     xsd: http://www.w3.org/2001/XMLSchema
     ns0: http://sina/

Global elements:
     ns0:recuperaAdmins(ns0:recuperaAdmins)
     ns0:recuperaAdminsResponse(ns0:recuperaAdminsResponse)

Global types:
     xsd:anyType
     ns0:administracion(codUser: xsd:string, codigVia: xsd:string, descripVia: xsd:string, dia: xsd:dateTime, dosis: xsd:double, estadoAdmin: xsd:string, hora: xsd:string, id_administracion: xsd:int, prn: xsd:boolean, prnMotivo: xsd:string, unidades: xsd:string)
     ns0:episodio(codigoPrescripcion: xsd:int, episodio: xsd:string, listaTratamientos: ns0:tratamiento[])
     ns0:paciente(apellidos: xsd:string, listaEpisodios: ns0:episodio[], nhc: xsd:string, nombre: xsd:string)
     ns0:presentacion(codNacional: xsd:string, codNavision: xsd:string, nombre: xsd:string)
     ns0:recuperaAdmins(listaPac: xsd:string[], fechaHoraInicio: xsd:dateTime, fechaHoraFin: xsd:dateTime, estado: xsd:string)
     ns0:recuperaAdminsResponse(return: ns0:paciente[])
     ns0:tratamiento(codTrat: xsd:int, descripTrat: xsd:string, listaAdmin: ns0:administracion[], listaPresent: ns0:presentacion[])
     xsd:ENTITIES
     xsd:ENTITY
     xsd:ID
     xsd:IDREF
     xsd:IDREFS
     xsd:NCName
     xsd:NMTOKEN
     xsd:NMTOKENS
     xsd:NOTATION
     xsd:Name
     xsd:QName
     xsd:anySimpleType
     xsd:anyURI
     xsd:base64Binary
     xsd:boolean
     xsd:byte
     xsd:date
     xsd:dateTime
     xsd:decimal
     xsd:double
     xsd:duration
     xsd:float
     xsd:gDay
     xsd:gMonth
     xsd:gMonthDay
     xsd:gYear
     xsd:gYearMonth
     xsd:hexBinary
     xsd:int
     xsd:integer
     xsd:language
     xsd:long
     xsd:negativeInteger
     xsd:nonNegativeInteger
     xsd:nonPositiveInteger
     xsd:normalizedString
     xsd:positiveInteger
     xsd:short
     xsd:string
     xsd:time
     xsd:token
     xsd:unsignedByte
     xsd:unsignedInt
     xsd:unsignedLong
     xsd:unsignedShort

Bindings:
     Soap11Binding: {http://sina/}FarhosPortBinding

Service: Farhos
     Port: FarhosPort (Soap11Binding: {http://sina/}FarhosPortBinding)
         Operations:
            recuperaAdmins(listaPac: xsd:string[], fechaHoraInicio: xsd:dateTime, fechaHoraFin: xsd:dateTime, estado: xsd:string) -> return: ns0:paciente[]

I have to consume the recuperaAdmins operation which recives listaPac: xsd:string[] as first parameter. So, starting with an array of strings, how do I convert it into a xsd:string[]?

I tried

stringArray_type = client.get_type('xsd:string[]')

but it doesn't work.

Any ideas?

Thank you in advance.-

Upvotes: 1

Views: 1074

Answers (1)

Tarique
Tarique

Reputation: 1461

since you are using zeep, it should take care of the conversion itself. So a use-case for you would look like this:

from zeep import Client
client = Client("http://xxxxxxxxx/xxxxx/xxxx?wsdl")

listaPac = ['abc', 'def', 'ghi']

response = client.service.recuperaAdmins(listaPac=listaPac, fechaHoraInicio=dateTime, fechaHoraFin=dateTime, estado=string)

If there is some error please do let us know. hope this helps.

Upvotes: 1

Related Questions