环境:
- Python v2.6.2
- 肥皂水 v0.3.7
我使用的 WSDL(服务器)具有以下架构子部分(我尝试使用纯文本清楚地编写它) -
[小节#1]
searchRequest: (searchRequest){
userIdentification = (userIdentification){
username = ""
password = ""
}
itineraryArr = (itineraryArray){
_arrayType = ""
_offset = ""
_id = ""
_href = ""
_arrayType = ""
}
...
...
[小节#2]
itinerary: (itinerary){
departurePoint = (locationPoint){
locationId = None
radius = None
}
arrivalPoint = (locationPoint){
locationId = None
radius = None
}
...
...
'userIdentification' 没有问题(这是一个“简单”类型)
但是,'itineraryArr' 是 'itinerary' 的数组,我不知道如何使用 python 创建 XML 数组。
我尝试了几种组合,例如
itinerary0 = self.client.factory.create('itinerary')
itineraryArray = self.client.factory.create('itineraryArray')
itineraryArray = [itinerary0]
searchRequest.itineraryArr = itineraryArray
但是我所有的试验都导致了同样的服务器错误——
Server raised fault: 'Cannot use object of type itinerary as array'
(Fault){
faultcode = "SOAP-ENV:Server"
faultstring = "Cannot use object of type itinerary as array"
}