2013-05-27 1 views
1

Null (없음) 속성이 필요한 서비스를 호출하려고하는데 suds가 속성을 제거하려고합니다. 나는 보낼 필요 ..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> 

하지만, 비눗물이 IntersectingRoad 개체를 제거하고 난 IntersectingRoad의 값 중 하나가 그것을 전송하고 제대로 작동 개체를 설정 한 경우에만

<ns1:Body> 
    <ns0:QueryIntersection> 
    <ns0:subjectRoad> 
     <ns2:RoadName>BURKE</ns2:RoadName> 
     <ns2:RoadType>ROAD</ns2:RoadType> 
    </ns0:subjectRoad> 
    </ns0:QueryIntersection> 

전송하지만 없음 유효한 요청이기도합니다. 이 ...

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 

어떤 도움을 주시기 바랍니다 내가 사용하고있는 코드의 추출입니다!

답변

7

Suds에는 선택적 매개 변수를 전달하기위한 특별한 null() 함수가 있습니다. 왜냐하면 None은 값 부재로 처리되기 때문입니다.

나는 귀하의 경우는 다음과 같이 것이라고 생각 :

from suds import null 

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