, 당신은 쉽게 그렇게 할 수 있습니다
import csv
import suds
WSDL = 'http://some.wsdl.somewhere/'
METHOD = 'theMethodToTest'
CSVFN = '/some/csv/file.csv'
client = suds.client.Client(WSDL)
with open(CSVFN, 'rb') as f:
reader = csv.DictReader(f)
for kwargs in reader:
getattr(client.service, METHOD)(**kwargs)
UPDATE 1
매핑 할 경우 CSV 플랫 파일 구조를 복잡한 구조에 매핑하면 CSV 헤더를 사용하여 매핑을 나타낼 수 있습니다.
dict에 매핑하여 SUDS 설명서에 설명 된대로 WSDL 메서드에 전달할 수 있습니다. ComplexArgumentsUsingDict. :-) ...
kwargs = {
'person': {
'name': {'first':'Elmer', 'last':'Fudd'},
'age': 35,
'phone': [
{'npa':202, 'nxx':555, 'number':1212},
]
}
}
가 그래도 난 당신을 제공 할 샘플 코드가 없습니다 : 변환 될 수
person.name.first,person.name.last,person.age,person.phone.0.npa,person.phone.0.nxx,person.phone.0.number
"Elmer","Fudd",35,202,555,1212
:
귀하의 CSV 헤더는 뭔가를 할 수
발생할 수있는 한 가지 문제는 형식 관련입니다.
person.name.first,person.name.last,person.age:int,person.phone.0.npa:int,person.phone.0.nxx:int,person.phone.0.number:int,married:bool
또는 : 당신은
하나의 아이디어가 헤더의 유형을 표시하는 것입니다 ... 명시 적으로 CSV 파일 int로 (텍스트), 플로트, 부울에서 데이터를 변환 할 수 있습니다 저장하여 XML의 데이터 테스트 ...
예, SOAP 클라이언트는 특정 호출에 대한 XML을 생성합니다. –