肥皂水不发送属性

2024-09-27 00:15:59 发布

您现在位置:Python中文网/ 问答频道 /正文

我试图调用一个需要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移除相交道路对象,只发送

^{pr2}$

在 如果我在IntersectingRoad对象中设置一个值,它将发送它并正常工作,但没有一个也是有效的请求。 这是我正在使用的代码的摘录。。。在

Int1 = client.factory.create('ns2:IntersectingRoad')
Int1.RoadName = None
Int1.RoadType = None

Int2 = 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

有人帮忙吗!在


Tags: clientnonetruesudsnilns0xsins2
1条回答
网友
1楼 · 发布于 2024-09-27 00:15:59

Suds有特殊的null()函数来传递可选参数,因为没有参数都被视为缺少值。在

我想你的案子应该是这样的:

from suds import null

Int1 = client.factory.create('ns2:IntersectingRoad')
Int1.RoadName = null()
Int1.RoadType = null()

相关问题 更多 >

    热门问题