Closed chris5287 closed 3 years ago
stream.Seek(0, SeekOrigin.Begin); using var reader = XmlDictionaryReader.CreateMtomReader(stream, Encoding.UTF8, XmlDictionaryReaderQuotas.Max); var doc = new XmlDocument(); doc.Load(reader); return doc;
I tried to use your solution but I am getting the error The expected encoding 'utf-16LE' does not match the actual encoding 'utf-16BE'. Do you know what means? I can't be able to found nothing about it.
@JoaoSaDevdotNet what do you need fixed? It's very hard to help you based on that kind of error description.
Do you have an actual code sample? Maybe with a list of referenced NuGet packages and their versions?
Then somebody may be able to tell you what the problem is. 👍
Okay follow the code
using var mtomMessageInMemory = new MemoryStream(xml); var dataSerializer = new DataContractSerializer(typeof(ReturningType));
Here I get the error I said var reader = XmlDictionaryReader.CreateMtomReader(mtomMessageInMemory, Encoding.UTF8, lDictionaryReaderQuotas.Max);
return (ReturningType)dataSerializer.ReadObject(reader);
@JoaoSaDevdotNet , try replacing Encoding.UTF8
with Encoding.BigEndianUnicode
Hello @mconnew , I tried this solution proposed in the answers: https://github.com/dotnet/wcf/issues/1810#issuecomment-963604841 but without success, the same error reading not supported. I'm using webapi .netcore 6 is there any way to do it without needing a wcf?
Hello, @mconnew Simple answer to your question (https://github.com/dotnet/wcf/issues/1810#issuecomment-963604841): legacy or some not standard soap services (( Please make a class XmlMtomReader public. You will make a lot of people happy )
I am getting the following error when using the Visual Studio WCF Connected Service extension for Visual Studio 2017:
The WSDL/XSD file causing the issue: DocumentContentService.xsd.txt DocumentContentService.wsdl.txt
dotnet --info