我正在尝试调用需要Null(None)属性但将suds删除的服务。我需要发送..<ns1:Body> <ns0:QueryIntersection> <ns0:intersectingRoad> <ns2:RoadName xsi:nil="true"/> <ns2:RoadType xsi:nil="true"/> </ns0:intersectingRoad> <ns0:subjectRoad> <ns2:RoadName>BURKE</ns2:RoadName> <ns2:RoadType>ROAD</ns2:RoadType> </ns0:subjectRoad> </ns0:QueryIntersection>但suds删除了IntersectingRoad对象,仅发送<ns1:Body> <ns0:QueryIntersection> <ns0:subjectRoad> <ns2:RoadName>BURKE</ns2:RoadName> <ns2:RoadType>ROAD</ns2:RoadType> </ns0:subjectRoad> </ns0:QueryIntersection>如果我在IntersectingRoad对象中设置值之一,它将发送它并正常工作,但None也是有效的请求。这是我正在使用的代码的一部分...Int1 = client.factory.create('ns2:IntersectingRoad')Int1.RoadName = NoneInt1.RoadType = NoneInt2 = client.factory.create('ns2:SubjectRoad')Int2.RoadName = "BURKE"Int2.RoadType = "ROAD"try: Ints = client.service.QueryIntersection(Int1,Int2, )except Exception as e: print e.message请帮忙!
1 回答

慕村9548890
TA贡献1884条经验 获得超4个赞
Suds具有用于传递可选参数的特殊null()函数,因为None被视为缺少值。
我认为您的情况将如下所示:
from suds import null
Int1 = client.factory.create('ns2:IntersectingRoad')
Int1.RoadName = null()
Int1.RoadType = null()
添加回答
举报
0/150
提交
取消