[Mono-bugs] [Bug 670945] New: XML Serialization output differs from Microsoft .NET Runtime (or CLR)
bugzilla_noreply at novell.com
bugzilla_noreply at novell.com
Thu Feb 10 08:14:17 EST 2011
https://bugzilla.novell.com/show_bug.cgi?id=670945
https://bugzilla.novell.com/show_bug.cgi?id=670945#c0
Summary: XML Serialization output differs from Microsoft .NET
Runtime (or CLR)
Classification: Mono
Product: Mono: Runtime
Version: 2.8.x
Platform: i686
OS/Version: Linux
Status: NEW
Severity: Major
Priority: P5 - None
Component: misc
AssignedTo: mono-bugs at lists.ximian.com
ReportedBy: charles.nepveu at verint.com
QAContact: mono-bugs at lists.ximian.com
Found By: ---
Blocker: ---
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US)
AppleWebKit/534.7 (KHTML, like Gecko) Chrome/7.0.517.41 Safari/534.7
Hi,
I'm using a generated ServiceModel.ClientBase<> implementation, generated by
ONVIF WSDL documents (e.g.: DdviceManagement.wsdl) found on onvif.org (though
web references).
I found out that when serializing an array of enum values, the output differs
when using the Mono 2.8.2 runtime compared to the Microsoft .NET runtime.
Because of this difference, the remote web service doesn't understand the
request and responds with a "400 - Bad Request" message.
However, when I do a manual serialization of instances of the problematic class
(using an XmlSerializer and StringWriter), the serialized XML output is the
same whether I use the Mono 2.8.2 or Microsoft .NET runtimes. So it seems that
the problem deep within the ServiceModel web services client classes that
perform XML serialization under the hood.
The problem is related to the serialization of an array of enum values. See the
actual and expected results.
Reproducible: Always
Steps to Reproduce:
1. Create a console app project, and add the following Web Reference to your
project: http://www.onvif.org/onvif/ver10/device/wsdl/devicemgmt.wsdl
2. Instantiate a DeviceClient object, with an HTTP basic binding, and an
endpoint.
3. Invoke the 'GetCapabilities(CapabilityCategory[]) method.
4. Check the XML request message that is output.
Actual Results:
<?xml version="1.0" encoding="utf-8"?>
<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
<s:Body>
<GetCapabilities xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns="http://www.onvif.org/ver10/device/wsdl">
<Category>
<CapabilityCategory>All</CapabilityCategory>
</Category>
</GetCapabilities>
</s:Body>
</s:Envelope>
Expected Results:
<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
<s:Body xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<GetCapabilities xmlns="http://www.onvif.org/ver10/device/wsdl">
<Category>All</Category>
</GetCapabilities>
</s:Body>
</s:Envelope>
The difference (apart from the XML header) is that the CapabilityCategory
element should not be there in the actual result.
The CapabilityCategory name is in fact the name of the enumeration from which
'All' is from. See the declarations:
public partial class GetCapabilitiesRequest
{
...
[System.Xml.Serialization.XmlElementAttribute("Category")]
public CapabilityCategory[] Category;
...
}
public enum CapabilityCategory
{
All,
...
}
--
Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.
You are the assignee for the bug.
More information about the mono-bugs
mailing list