JSON 要求を受け入れ、要求を処理し、それらを SOAP として API に転送し、応答を処理してから、応答を JSON としてクライアントに転送する django アプリケーションがあります。
応答に Iterable がないメソッドは正常に機能しています。ただし、Iterable を持つメソッドの場合、混乱した応答または内部エラーが返されます。
例えば:
class MyCitiesIterable(ComplexModel):
__namespace__ = MY_NAMESPACE
ID = Integer
Description = String
class Other(ComplexModel):
__namespace__ = MY_NAMESPACE
Errors = Integer
class MyCitiesResponse(ComplexModel):
__namespace__ = MY_NAMESPACE
Cities = Iterable(MyCitiesIterable)
Other = Other
返されたオブジェクト:
(MyCitiesResponse){
Cities =
(MyCityArray){
MyCity[] =
(MyCity){
Description = "City 1"
ID = 1
},
(MyCity){
Description = "City 2"
ID = 2
},
(MyCity){
Description = "City 3"
ID = 3
},
}
Other =
(Other){
Errors = 0
}
}
JSON レスポンス
{ "Cities":
[
{
"Description": "MyCity",
"ID": [[["Description", "City 1"],
["ID", 1]],
[["Description", "City 2"],
["ID", 2]],
[["Description", "City 3"],
["ID", 3]]]}],
"Other": {"Errors": 0}
}
]
}