SoapCore icon indicating copy to clipboard operation
SoapCore copied to clipboard

can't serialize fields as xml attributes

Open DmitryBryluk opened this issue 8 years ago • 3 comments

this is needed for making legacy-compatible code in .net core

    [XmlType(Namespace = ServiceNamespace.Value)]
    [Serializable]
    public class SomeInfo
    {
        [XmlAttribute]
        public string SomeValue; // need this as xml attribute
    }

using DataContractSerializer fields are always xml elements

using XmlSerializer fields are just skipped from output (for the reference - this is out param as in previous issue) upd: this is actual for complex out types, when using old-style single request/response param, it is almost ok (however extra response xml element, as in this issue)

is it SoapCore intrinsic problem (i.e. can fix by myself)?

DmitryBryluk avatar Aug 02 '18 18:08 DmitryBryluk

the problem is inside ServiceBodyWriter.OnWriteBodyContents here: value = reader.ReadInnerXml(); it just skips attributes, will fix it asap

DmitryBryluk avatar Aug 03 '18 19:08 DmitryBryluk

fix for this: https://github.com/DigDes/SoapCore/pull/112

DmitryBryluk avatar Aug 06 '18 18:08 DmitryBryluk

https://www.nuget.org/packages/SoapCore/0.9.8.4

kotovaleksandr avatar Aug 07 '18 11:08 kotovaleksandr