2

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 オブジェクトに値の 1 つを設定すると、それが送信されて正しく機能しますが、None も有効な要求です。これは私が使用しているコードの抜粋です...

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

助けてください!

4

1 に答える 1

8

None は値の不在として扱われるため、Suds にはオプションのパラメーターを渡すための特別な null() 関数があります。

あなたのケースは次のようになると思います:

from suds import null

Int1 = client.factory.create('ns2:IntersectingRoad')
Int1.RoadName = null()
Int1.RoadType = null()
于 2013-05-27T10:18:51.367 に答える