I have to construct a SOUP method Agw_typeGenerarDespachoIn from wsdl
<xsd:complexType name="Agw_typeGenerarDespachoIn">
<xsd:all>
<xsd:element name="guias" type="soap-enc:Array"/>
<xsd:element name="margen_izquierdo" type="xsd:float"/>
<xsd:element name="margen_superior" type="xsd:float"/>
<xsd:element name="tipo_impresion" type="xsd:string"/>
<xsd:element name="usuario" type="xsd:string"/>
<xsd:element name="clave" type="xsd:string"/>
</xsd:all>
</xsd:complexType>
I construct the param guias of type soap-enc:Array
array_type = self.client.get_type('ns1:Array')
guias = array_type()
values = xsd.AnyObject(array_type, array_type(_attr_1={'guias': '98516000037'}))
Agw_typeGenerarDespachoIn = self.factory.Agw_typeGenerarDespachoIn(guias=values,
margen_izquierdo=float(0),
margen_superior=float(0),
tipo_impresion=unicode('LASER'),
usuario=unicode(self.usuario),
clave=unicode(self.clave))
I get return
'`list`' object has no attribute '`_xsd_name`'
If i try with other value for param guias like
guia = dict(item='98516000056')
i get the return error
TypeError: {http://schemas.xmlsoap.org/soap/encoding/}Array() got an unexpected keyword argument 'item'. Signature: `_value_1: ANY[], arrayType: xsd:string, offset: {http://schemas.xmlsoap.org/soap/encoding/}arrayCoordinate, id: xsd:ID, href: xsd:anyURI, _attr_1: {}`
So i try with the sugered value "_value_1"
guia = dict(_value_1=['98516000056'])
And get the error
Any element received object of type 'unicode', expected lxml.etree._Element or __builtin__.dict or zeep.xsd.valueobjects.AnyObject
I have tried different ways to build the soup-enc:Array parameter but I always get an error. You know how I can fix it. I appreciate all the help you can give me
My mistake in creating the array in the Agw_typeGenerarDespachoIn method of the Coordinadora transporter was to try to create the Array type. Actually the type Array should be taken as a normal python array.
guias = []
String elements must be created that will be added to the array.
guias_type = client.get_element('ns1:string')
Finally, append elements string type to the array.
for remesa in remesas:
guias.append(xsd.AnyObject(guias_type, remesa))
Put all params in the method
Agw_typeGenerarDespachoIn = factory.Agw_typeGenerarDespachoIn(guias=guias, # array Codigos de guia a las que se les va a generar un despacho (array de strings)
margen_izquierdo=float(0), # float Margen izquierdo para la generacion del PDF, en caso que el tipo impresion seleccionado genere un PDF
margen_superior=float(0), # float Margen superior para la generacion del PDF, en caso que el tipo impresion seleccionado genere un PDF
tipo_impresion=unicode('LASER'), # string Tipo de impresion que se desea obtener las opciones son (LASER, LASER_RESUMIDA, POS_PDF, POS_PLANO).
usuario=unicode(self.usuario), # string Usuario asignado. Ej: prefijo.usuario
clave=unicode(self.clave) # string Clave codificada con el algoritmo sha256.
)
print Agw_typeGenerarDespachoIn
response = client.service.Guias_generarDespacho(Agw_typeGenerarDespachoIn)
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.