The XML generation in WSDLTools.py::WSDL::toDom() leads to attributes with None values, in particular for <soap:body>'s @namespace attribute. While for some reason Python's minidom lets this happen, serialising the XML via WSDL::document.toprettyxml() fails in its _write_data() method. A fix is to modify SoapBodyBinding::toDom() to add the @namespace attribute conditionally whenever it's not None.