I am trying to call a service that requires Null(None) attributes but suds removes them. I need to send..
<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>
but suds removes the IntersectingRoad object and only sends
<ns1:Body>
<ns0:QueryIntersection>
<ns0:subjectRoad>
<ns2:RoadName>BURKE</ns2:RoadName>
<ns2:RoadType>ROAD</ns2:RoadType>
</ns0:subjectRoad>
</ns0:QueryIntersection>
If I set one of the values in IntersectingRoad object it will send it and work correctly but None is also a valid request. This is an extract of the code I am using...
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
Any help please!
Suds has special null() function for passing optional parameters, because None is treated as absence of value.
I think your case would look like this:
from suds import null
Int1 = client.factory.create('ns2:IntersectingRoad')
Int1.RoadName = null()
Int1.RoadType = null()