You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm not sure what to do about this situation, so just opening up an issue in case someone has a good idea.
I generated client code from this WSDL, using a patched gowsdl 9e1cc9a with #214 and #218 applied. The generated code returns an error when unmarshaling:
xml: name "Off-cycle_Type_Reference" in tag of payroll.Payroll_ResultType.Offcycle_Type_Reference conflicts with name "Payroll_Off-cycle_TypeObjectType" in *payroll.Payroll_Offcycle_TypeObjectType.XMLName
The crux of the issue seems to be this poorly named complexType:
<xsd:complexTypename="Payroll_Off-cycle_TypeObjectType">
<xsd:annotationwd:Is_Reference_ID="1"/>
<xsd:sequence>
<xsd:elementname="ID"type="wd:Payroll_Off-cycle_TypeObjectIDType"minOccurs="0"maxOccurs="unbounded"/>
</xsd:sequence>
<xsd:attributename="Descriptor"type="xsd:string">
<xsd:annotation>
<xsd:documentation>Display information used to describe an instance of an object. This 'optional' information is for outbound descriptive purposes only and is not processed on inbound Workday Web Services requests.</xsd:documentation>
</xsd:annotation>
</xsd:attribute>
</xsd:complexType>
Go symbols can't have dashes in their names, so the WSDL name gets mangled into Payroll_Offcycle_TypeObjectType:
But, the places where this is actually used specify a different tag name. ex the Payroll_ResultType specifies that it goes into an Off-cycle_Type_Reference tag:
<xsd:elementname="Off-cycle_Type_Reference"type="wd:Payroll_Off-cycle_TypeObjectType"minOccurs="0">
<xsd:annotation>
<xsd:documentation>Off-cycle Type Reference</xsd:documentation>
</xsd:annotation>
</xsd:element>
gowsdl generates correct output, with the field having the correct type and the metadata specifying the name from the xsd:element:
…but encoding/xml then blows up because the tag name in Payroll_ResultType.Offcycle_Type_Reference's field metadata is different than the one in Payroll_Offcycle_TypeObjectType.XMLName.
I think the most correct fix here is for encoding/xml to prefer the tag name from the containing struct, if set. In the absence of that, I'm not sure what to do other than postprocess the generated code to remove the XMLName.
Suggestions?
The text was updated successfully, but these errors were encountered:
I'm not sure what to do about this situation, so just opening up an issue in case someone has a good idea.
I generated client code from this WSDL, using a patched gowsdl 9e1cc9a with #214 and #218 applied. The generated code returns an error when unmarshaling:
The crux of the issue seems to be this poorly named
complexType
:Go symbols can't have dashes in their names, so the WSDL name gets mangled into
Payroll_Offcycle_TypeObjectType
:gowsdl/types_tmpl.go
Line 145 in 9e1cc9a
Because the struct name is now different than the type name in the WSDL, this conditional evaluates to
true
, and adds anXMLName
field to the struct:gowsdl/types_tmpl.go
Lines 151 to 153 in 9e1cc9a
But, the places where this is actually used specify a different tag name. ex the
Payroll_ResultType
specifies that it goes into anOff-cycle_Type_Reference
tag:gowsdl generates correct output, with the field having the correct type and the metadata specifying the name from the
xsd:element
:…but
encoding/xml
then blows up because the tag name inPayroll_ResultType.Offcycle_Type_Reference
's field metadata is different than the one inPayroll_Offcycle_TypeObjectType.XMLName
.I think the most correct fix here is for
encoding/xml
to prefer the tag name from the containing struct, if set. In the absence of that, I'm not sure what to do other than postprocess the generated code to remove theXMLName
.Suggestions?
The text was updated successfully, but these errors were encountered: