I am trying to speak to a SOAP server of which I received a WSDL files and multiple XSD files. The python module I am using for that is zeep 4.2.1 with python 3.12. When I call a service, I get an error message that one of my attributes is not valid.
How can I specify the codingScheme as ‘A10’ without getting the ValidationError?
This is the code I use to call a service:
'sender_MarketParticipant.mRID': {'_value_1': 'EAN', 'codingScheme': 'A10'},
return service.sendSchedule(**parameters)
<code>parameters = {
...
'sender_MarketParticipant.mRID': {'_value_1': 'EAN', 'codingScheme': 'A10'},
...
}
return service.sendSchedule(**parameters)
</code>
parameters = {
...
'sender_MarketParticipant.mRID': {'_value_1': 'EAN', 'codingScheme': 'A10'},
...
}
return service.sendSchedule(**parameters)
This is the error that I get:
<code>ValidationError: The attribute codingScheme is not valid: Value is required (Schedule_MarketDocument.domain.mRID.codingScheme)
<code>ValidationError: The attribute codingScheme is not valid: Value is required (Schedule_MarketDocument.domain.mRID.codingScheme)
</code>
ValidationError: The attribute codingScheme is not valid: Value is required (Schedule_MarketDocument.domain.mRID.codingScheme)
This is how the final XML should look like:
<sender_MarketParticipant.mRID codingScheme="A10">EAN</sender_MarketParticipant.mRID>
<code>...
<sender_MarketParticipant.mRID codingScheme="A10">EAN</sender_MarketParticipant.mRID>
...
</code>
...
<sender_MarketParticipant.mRID codingScheme="A10">EAN</sender_MarketParticipant.mRID>
...
There is a lot of information in the WSDL and XSD files. I will include some snippets that might be relevant.
<code> <xs:complexType name="Schedule_MarketDocument" sawsdl:modelReference="http://iec.ch/TC57/2013/CIM-schema-cim16#MarketDocument">
<xs:element name="sender_MarketParticipant.mRID" type="PartyID_String" minOccurs="1" maxOccurs="1" sawsdl:modelReference="http://iec.ch/TC57/2013/CIM-schema-cim16#IdentifiedObject.mRID"/>
<code> <xs:complexType name="Schedule_MarketDocument" sawsdl:modelReference="http://iec.ch/TC57/2013/CIM-schema-cim16#MarketDocument">
<xs:sequence>
...
<xs:element name="sender_MarketParticipant.mRID" type="PartyID_String" minOccurs="1" maxOccurs="1" sawsdl:modelReference="http://iec.ch/TC57/2013/CIM-schema-cim16#IdentifiedObject.mRID"/>
...
</xs:sequence>
</xs:complexType>
</code>
<xs:complexType name="Schedule_MarketDocument" sawsdl:modelReference="http://iec.ch/TC57/2013/CIM-schema-cim16#MarketDocument">
<xs:sequence>
...
<xs:element name="sender_MarketParticipant.mRID" type="PartyID_String" minOccurs="1" maxOccurs="1" sawsdl:modelReference="http://iec.ch/TC57/2013/CIM-schema-cim16#IdentifiedObject.mRID"/>
...
</xs:sequence>
</xs:complexType>
<code> <xs:complexType name="PartyID_String" sawsdl:modelReference="http://iec.ch/TC57/2013/CIM-schema-cim16#String">
<xs:extension base="PartyID_String-base">
<xs:attribute name="codingScheme" type="cl:CodingSchemeTypeList" use="required"/>
<code> <xs:complexType name="PartyID_String" sawsdl:modelReference="http://iec.ch/TC57/2013/CIM-schema-cim16#String">
<xs:simpleContent>
<xs:extension base="PartyID_String-base">
<xs:attribute name="codingScheme" type="cl:CodingSchemeTypeList" use="required"/>
</xs:extension>
</xs:simpleContent>
</xs:complexType>
</code>
<xs:complexType name="PartyID_String" sawsdl:modelReference="http://iec.ch/TC57/2013/CIM-schema-cim16#String">
<xs:simpleContent>
<xs:extension base="PartyID_String-base">
<xs:attribute name="codingScheme" type="cl:CodingSchemeTypeList" use="required"/>
</xs:extension>
</xs:simpleContent>
</xs:complexType>
<code> <xsd:simpleType name="CodingSchemeTypeList">
<xsd:union memberTypes="cl:StandardCodingSchemeTypeList cl:LocalCodingSchemeType"/>
<code> <xsd:simpleType name="CodingSchemeTypeList">
<xsd:union memberTypes="cl:StandardCodingSchemeTypeList cl:LocalCodingSchemeType"/>
</xsd:simpleType>
</code>
<xsd:simpleType name="CodingSchemeTypeList">
<xsd:union memberTypes="cl:StandardCodingSchemeTypeList cl:LocalCodingSchemeType"/>
</xsd:simpleType>
<code> <xsd:simpleType name="StandardCodingSchemeTypeList">
<Definition>Codification scheme used to identify the coding scheme used for the set of coded values to identify specific objects.</Definition>
<xsd:restriction base="xsd:NMTOKEN">
<xsd:enumeration value="A01">
<Definition>The coding scheme is an Identification Coding Scheme</Definition>
<xsd:enumeration value="A10">
<Definition>The coding scheme for the preceding attribute is a location number.</Definition>
<code> <xsd:simpleType name="StandardCodingSchemeTypeList">
<xsd:annotation>
<xsd:documentation>
<Uid>ET0004</Uid>
<Definition>Codification scheme used to identify the coding scheme used for the set of coded values to identify specific objects.</Definition>
</xsd:documentation>
</xsd:annotation>
<xsd:restriction base="xsd:NMTOKEN">
<xsd:enumeration value="A01">
<xsd:annotation>
<xsd:documentation>
<CodeDescription>
<Title>IC</Title>
<Definition>The coding scheme is an Identification Coding Scheme</Definition>
</CodeDescription>
</xsd:documentation>
</xsd:annotation>
</xsd:enumeration>
...
<xsd:enumeration value="A10">
<xsd:annotation>
<xsd:documentation>
<CodeDescription>
<Title>LOCNR</Title>
<Definition>The coding scheme for the preceding attribute is a location number.</Definition>
</CodeDescription>
</xsd:documentation>
</xsd:annotation>
</xsd:enumeration>
</xsd:restriction>
</xsd:simpleType>
</code>
<xsd:simpleType name="StandardCodingSchemeTypeList">
<xsd:annotation>
<xsd:documentation>
<Uid>ET0004</Uid>
<Definition>Codification scheme used to identify the coding scheme used for the set of coded values to identify specific objects.</Definition>
</xsd:documentation>
</xsd:annotation>
<xsd:restriction base="xsd:NMTOKEN">
<xsd:enumeration value="A01">
<xsd:annotation>
<xsd:documentation>
<CodeDescription>
<Title>IC</Title>
<Definition>The coding scheme is an Identification Coding Scheme</Definition>
</CodeDescription>
</xsd:documentation>
</xsd:annotation>
</xsd:enumeration>
...
<xsd:enumeration value="A10">
<xsd:annotation>
<xsd:documentation>
<CodeDescription>
<Title>LOCNR</Title>
<Definition>The coding scheme for the preceding attribute is a location number.</Definition>
</CodeDescription>
</xsd:documentation>
</xsd:annotation>
</xsd:enumeration>
</xsd:restriction>
</xsd:simpleType>
<code> <xsd:simpleType name="LocalCodingSchemeType">
<xsd:restriction base="xsd:NMTOKEN">
<xsd:enumeration value="A01"/>
<code> <xsd:simpleType name="LocalCodingSchemeType">
<xsd:restriction base="xsd:NMTOKEN">
<xsd:enumeration value="A01"/>
</xsd:restriction>
</xsd:simpleType>
</code>
<xsd:simpleType name="LocalCodingSchemeType">
<xsd:restriction base="xsd:NMTOKEN">
<xsd:enumeration value="A01"/>
</xsd:restriction>
</xsd:simpleType>
I tried client.get_type('ns5:PartyID_String')
but that gave the same error. I also tried to prefix the string ‘A10’ with extra type information but that didn’t seem to have any effect.