jeudi 16 juin 2016

suds.TypeNotFound when acessing webservice

Using suds to consume a ASMX webservice (created with ASP.NET), it throws the suds.TypeNotFound: Type not found: '(schema, http://www.w3.org/2001/XMLSchema, )' error:

def consume_webservice():
    url = 'http://telemetriaws1.ana.gov.br/ServiceANA.asmx?wsdl'
    imp = Import('http://www.w3.org/2001/XMLSchema', location='http://www.w3.org/2001/XMLSchema.xsd')
    imp.filter.add('http://telemetriaws1.ana.gov.br/')
    client = Client(url, doctor=ImportDoctor(imp))
    print client

if __name__ == "__main__":
    consume_webservice()

There is data being served: http://telemetriaws1.ana.gov.br/ServiceANA.asmx/ListaEstacoesTelemetricas?statusEstacoes=0&origem=0

Tried something with JavaEE, and that was the result of ./wsimport -keep -verbose http://telemetriaws1.ana.gov.br/ServiceANA.asmx?wsdl:

parsing WSDL...

[WARNING] src-resolve.4.2: Error resolving component 's:schema'. It was detected that 's:schema' is in namespace 'http://www.w3.org/2001/XMLSchema', but components from this namespace are not referenceable from schema document 'http://telemetriaws1.ana.gov.br/ServiceANA.asmx?wsdl#types?schema1'. If this is the incorrect namespace, perhaps the prefix of 's:schema' needs to be changed. If this is the correct namespace, then an appropriate 'import' tag should be added to 'http://telemetriaws1.ana.gov.br/ServiceANA.asmx?wsdl#types?schema1'.

line 65 of http://telemetriaws1.ana.gov.br/ServiceANA.asmx?wsdl#types?schema1

[WARNING] src-resolve: Cannot resolve the name 's:schema' to a(n) 'element declaration' component.

line 65 of http://telemetriaws1.ana.gov.br/ServiceANA.asmx?wsdl#types?schema1

[ERROR] undefined element declaration 's:schema'

line 65 of http://telemetriaws1.ana.gov.br/ServiceANA.asmx?wsdl

And many other ERRORs like the last.

Aucun commentaire:

Enregistrer un commentaire