带有 zeep 的 xsd:string[] 的 SOAP 字符串列表

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

我必须与 WSDL 交互。当我探索 de WSDL

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

它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[]

我必须使用 recuperaAdmins 操作,它接收 listaPac: xsd:string[] 作为第一个参数。那么,从一个字符串数组开始,我如何将它转换成 xsd:string[]?

我试过了

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

但是没用。

有什么想法吗?

提前谢谢你。-

因为您使用的是 zeep,它应该自己处理转换。 因此,您的用例如下所示:

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)

如果有任何错误,请告诉我们。 希望这有帮助。