Short summary:
I'm using Zeep pip package to parse the National Rail SOAP API, and some fields (like the operator name/code) are showing up as None in the parsed response. The raw XML response clearly contains these values, so the data is there. I saw some debug logs about UnresolvedCustomType , but Zeep eventually resolves those types when accessed manually via client.wsdl.types.get_type() .
Has anyone else encountered a similar issue where Zeep silently drops or nulls out fields that do exist in the raw XML?
More details: We use Zeep as a SOAP client to parse the response of the National rail SOAP api. In the response some fields are missing, most importantly the rail provider. Snippet of raw XMl response part:
<ns2:operator>
<ns3:code>XX</ns3:code>
<ns3:name>Sample Rail Provider name</ns3:name>
</ns2:operator>
However, after Zeep parses the raw XML to json object, a lot of type values are None.
After enabling debug logs in zeep, it looked likeZeep SOAP client fails with UnresolvedCustomType error due to missing schemaLocation attributes in WSDL <xsd:import> statements.
DEBUG:zeep.xsd.visitor:Ignoring import statement for namespace 'http://www...' (missing schemaLocation)
DEBUG:zeep.xsd.schema:register_type('{http://www...}OperatorMode', <UnresolvedCustomType(qname='{http://www...}OperatorMode', base_type=<UnresolvedType(qname='{http://www.w3.org/2001/XMLSchema}NMTOKEN')>)>)
At first, I suspected that due to the missing schemaLocation attribute in the WSDL, Zeep was ignoring the <xsd:import> statements. As a result, it couldn't resolve custom types defined in the imported namespaces, which I thought was preventing it from properly populating those fields in the parsed response.
It turned out that those types are just temporarily unresolved due to schema load order.
Zeep correctly resolves these types later during parsing, because the following worked:
python: client.wsdl.types.get_type('{http://www...}OperatorMode')
This returned a valid type instance, confirming successful resolution:
output: OperatorMode(value)
Question: Has anyone else encountered a similar issue where Zeep silently drops or nulls out fields that do exist in the raw XML? Does someone know a good alternative instead of using Zeep, since the problem is likely located inside the package?