wcf
wcf copied to clipboard
Missing base64 attribute in request from "dotnet-svcutil" generated client
Bug: The generated client request is missing the xsi:type="n1:base64" xmlns:n1="http://schemas.xmlsoap.org/soap/encoding/" attribute on its <file /> element. The attribute specification is defined in the schema.
Schema: https://testing.maventa.com/apis/v1.1/wsdl
...
<xsd:complexType name=“FileAttachment”>
<xsd:all>
<xsd:element name=“file” type=“soapenc:base64”/>
<xsd:element name=“attachment_type” type=“xsd:string”/>
<xsd:element name=“filename” type=“xsd:string”/>
</xsd:all>
</xsd:complexType>
...
Generated request:
...
<q3:FileAttachment id=\"id2\" xsi:type=\"q3:FileAttachment\"
xmlns:q3=\"https://secure.maventa.com/\">
<file>77u/PD94bWwgdmVyc2lvbj0iMS4wIi...ZvaWNlPg==</file>
<filename xsi:type=\"xsd:string\">invoice1341515351353135.xml</filename>
</q3:FileAttachment>
...
Expected request:
...
<q3:FileAttachment id="id2" xsi:type="q3:FileAttachment"
xmlns:q3="https://secure.maventa.com/">
<file xsi:type="n1:base64"
xmlns:n1="http://schemas.xmlsoap.org/soap/encoding/">77u/PD94bWwgdmVyc2lvbj0iMS4wIi...ZvaWNlPg==</file>
<filename xsi:type="xsd:string">invoice1341515351353135.xml</filename>
</q3:FileAttachment>
...
WSDL: https://testing.maventa.com/apis/v1.1/wsdl Version: [Microsoft.Tools.ServiceModel.Svcutil, Version 2.0.0]
Document Details
⚠ Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.
- ID: 3d0bd854-fec8-fc4a-760a-42dc22e07f99
- Version Independent ID: f04e9f8b-24d2-79fb-7521-6222c434e80f
- Content: WCF svcutil tool overview - .NET Core
- Content Source: docs/core/additional-tools/dotnet-svcutil-guide.md
- Product: dotnet-core
- GitHub Login: @mlacouture
- Microsoft Alias: mairaw
@mlacouture can you review this issue? This seems like a product bug. Should it be moved somewhere else?
@dasetser who owns this now.
@scrodde Since this issue is for the product rather than the documentation please open an issue on the WCF Core Github: https://github.com/dotnet/wcf/. When you open that issue can you also include information on if this works correctly if you use the normal svcutil and a full framework client? If we can confirm there's a difference in behavior it will be easier for us to investigate the cause of this.
I've transferred the issue to the requested repo @dasetser.
@scrodde did you manage to work your way around this? Seems that we are contacting the exact same endpoint and hit this very issue...
@imcarolwang can you please see if there is behavior change from .NET framework?
There is behavior change from Framework in XmlSerializer serializing byte[] type to soap xml.
In .Net Core, for a target class FileAttachment which has SoapTypeAttribute applied, if its public property byte[] File has applied [SoapElement(DataType = "base64Binary")] or none, the serialization result would be missing XsiType info, if applying the property with [SoapElement(DataType = "hexBinary")] then the XsiType info would be generated when serialized.
In .Net Framework, XsiType is always generated for the byte[] property in the serialization result as long as its containing class has SoapTypeAttribute applied.