2

I'm trying to send a request to a WSDL WebServices. According to documentation, the requests must be formatted in XML.

I'm using Python and Zeep module. The operation a want to use is called 'Consulta' and parameters are called 'Comercio' and 'NumPedido' (first one is numeric type and second is alphanumeric). The code I've tried is the following:

from zeep import Client, Settings

settings = Settings(strict=False, xml_huge_tree=True)
client = Client('https://testws.punto-web.com/wcfadproc/srvproceso.svc?wsdl', settings=settings)

request_data = { 'Comercio': '8004749', 'NumPedido': '7030510'}
client.service.Consulta_Marca(**request_data)

But this gives me error TypeError: {http://tempuri.org/}Consulta_Marca() got an unexpected keyword argument 'NumPedido'. Signature: `xml: xsd:string`

Can anyone give me some advice about fixing this? Because seems that the operation is correct, but do not why the parameters are bad.

EDIT:

I've tried this little new code

from zeep import Client, xsd, Settings
settings = Settings(strict=False, xml_huge_tree=True)
client = Client('https://testws.punto-web.com/wcfadproc/srvproceso.svc?wsdl', settings = settings)
parameters = xsd.Element(
    'Consulta',
    xsd.ComplexType([
        xsd.Element(
            'Comercio', xsd.Integer()
        ),
        xsd.Element(
            'NumPedido', xsd.String()
        )
    ])
)

parameters_values = parameters( Comercio=8004749, NumPedido='7030510')
operation = client.service.Consulta_Marca(parameters_values)
operation

This gives me another error

The formatter threw an exception while trying to deserialize the message: Error in deserializing body of request message for operation 'Consulta_Marca'. End element 'xml' from namespace 'http://tempuri.org/' expected. Found element 'Comercio' from namespace ''. Line 2, position 465

But think I'm closer because if I execute client.service.Consulta_Marca(parameters), I get a valid response, but with null values because no parameters values were passed.

Please some help!

NaejF
  • 109
  • 1
  • 8

0 Answers0