简体   繁体   中英

Python Suds complex types confusion

I am trying to use Python and the suds library to pull some data from a SOAP webservice that is housing my data. Unfortunately, I haven't done this through a SOAP web service before and am running into a bit of confusion. Here is the code that I have so far:

from suds.client import Client
wsdl = 'http://ws-argos.clsamerica.com/argosDws/services/DixService?wsdl'
client =Client(wsdl)
f1 = client.factory.create('ns0:baseRequestType')
f1.username ='xxxxx'
f1.password='xxxxx'
f1.programNumber='9999'
f1.nbDaysFromNow = '5'
print f1
print client.service.getObsCsv(f1)

Running this code gives me a generic WebFault error. As such, I am having a hard time debugging and finding out what I'm doing wrong. I suspect it has to do with the complex request types I'm trying to create with factory from suds. Anyone have any insight into what I'm doing wrong here?

Being a bit of a n00b myself, I think I can at least contribute by telling you that the signature of the getObsCsv() service does not call for a BaseRequestType object but for individual values which are all base types:

getObsCsv(xs:string username, xs:string password, xs:string programNumber, xs:string platformId, xs:string wmo, xs:int nbMaxObs, ns0:periodType period, xs:int nbDaysFromNow)

If it did, printing the client using:

print client

would yield a signature like this one in the list of methods:

getObsCsv(baseRequestType baseRequestType)

Basically, your service signature is NOT expecting a complex type, so I guess you're not calling your service correctly.

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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM