Warning: byte[], [XmlAttribute] and MTOM

  • Thread starter Thread starter Marc Gravell
  • Start date Start date
M

Marc Gravell

I don't know if this is an intentional feature change, or simply a bug...
but!

I recently upgraded a web service to WSE3, specifically to use MTOM in a
particular call. This worked, however something else unrelated went "snap"
in the process...

After much head-scratching, I identified it as a public byte[] property that
was marked with as [XmlAttribute] - i.e. to be serialized inline with the
containing object-element. Under vanilla .Net WS everything was fine, but
with MTOM enabled this field ceased working - it would be read as 0 instead.
As it happens this represented a database timestamp, so it (oddly enough)
stopped a few things from working.

Changing this property to [XmlElement] and regenerating my proxy class
resolved this; this was the only change.

For ref, the markers in the proxy class changed from:
[System.Xml.Serialization.XmlAttributeAttribute()]
[System.ComponentModel.DefaultValueAttribute(0)]

To
[System.Xml.Serialization.XmlElementAttribute(DataType="base64Binary")]

Also note that I generate the proxies via
@"C:\Program Files\Microsoft WSE\v3.0\Tools\WseWsdl3.exe" /edb
/type:webClient /nologo /l:CS /n:%2 /out:%1 %3

(with obvious %1...%3; just included to indicate full calling syntax)

I've resolved it now, so I'm not panicking, but does anybody know if this is
by design? As I wasn't expecting it!!!

Marc
 
Oops - wrong group open in Outlook; will repost to
microsoft.public.dotnet.framework.webservices

Please disregard in this location

Marc
 
Back
Top