[Mono-bugs] [Bug 670956] New: error reflecting type when using generated Web Reference code

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Thu Feb 10 09:06:58 EST 2011


https://bugzilla.novell.com/show_bug.cgi?id=670956

https://bugzilla.novell.com/show_bug.cgi?id=670956#c0


           Summary: error reflecting type when using generated Web
                    Reference code
    Classification: Mono
           Product: Mono: Runtime
           Version: 2.8.x
          Platform: i686
        OS/Version: Windows 7
            Status: NEW
          Severity: Normal
          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 code that was generated by the addition of a Web Reference WSDL file
(i.e.: http://www.onvif.org/onvif/ver10/device/wsdl/devicemgmt.wsdl).

When invoking a certain method, the runtime tries to deserialize a reply from a
remote web service server and fails with an System.InvalidOperationException
exception. The message is "There was an error reflecting type '...'", which
originated from a XmlAnyElementAttribute that isn't understood:

System.InvalidOperationException: The element Any has been attributed with an
XmlAnyElementAttribute and a namespace 'http://www.onvif.org/ver10/schema', but
no name. When a namespace is supplied, a name is also required. Supply a name
or remove the namespace.

Effectively, the declaration is as follows:

  [System.Xml.Serialization.XmlAnyElementAttribute(Namespace =
"http://www.onvif.org/ver10/schema", Order = 0)]
  public System.Xml.XmlElement[] Any {
    ...
  }

I checked with the generated code when using Microsoft VS 2008, and it's the
same: The 'Namespace' value is specified, but not the 'Name' value. The runtime
should be able to cope with the generated code.


Reproducible: Always

Steps to Reproduce:
1. Generate the code from the web reference at
http://www.onvif.org/onvif/ver10/device/wsdl/devicemgmt.wsdl
2. Instantiate a DeviceClient object with an HTTP binding and an endpoint.
3. Invoke the 'GetNetworkInterfaces' function.
4. Deserialization of reply will fail.
Actual Results:  
-> System.InvalidOperationException: There was an error reflecting type
'onvif_proto.ONVIFDeviceManagement.NetworkInterface'.
---> System.InvalidOperationException: There was an error reflecting field
'Extension'. 
---> System.InvalidOperationException: There was an error reflecting type
'onvif_proto.ONVIFDeviceManagement.NetworkInterfaceExtension'. 
---> System.InvalidOperationException: There was an error reflecting field
'Extension'. 
---> System.InvalidOperationException: There was an error reflecting type
'onvif_proto.ONVIFDeviceManagement.NetworkInterfaceExtension2'.
---> System.InvalidOperationException: There was an error reflecting field
'Any'. 
---> System.InvalidOperationException: The element Any has been attributed with
an XmlAnyElementAttribute and a namespace 'http://www.onvif.org/ver10/schema',
but no name. When a namespace is supplied, a name is also required. Supply a
name or remove the namespace.

Expected Results:  
Reply is correctly deserialized.

For now I can fix it by adding the 'Name="Any"' value to the
XmlAnyElementAttribute.

-- 
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