[Mono-bugs] [Bug 49589][Wis] New - Webservices cant handle a method with [return:XmlAnyElement]

bugzilla-daemon@bugzilla.ximian.com bugzilla-daemon@bugzilla.ximian.com
Mon, 12 Jan 2004 20:45:05 -0500 (EST)


Please do not reply to this email- if you want to comment on the bug, go to the
URL shown below and enter your comments there.

Changed by gonzalo@ximian.com.

http://bugzilla.ximian.com/show_bug.cgi?id=49589

--- shadow/49589	2004-01-12 20:45:05.000000000 -0500
+++ shadow/49589.tmp.29587	2004-01-12 20:45:05.000000000 -0500
@@ -0,0 +1,100 @@
+Bug#: 49589
+Product: Mono/Class Libraries
+Version: unspecified
+OS: unknown
+OS Details: 
+Status: NEW   
+Resolution: 
+Severity: Unknown
+Priority: Wishlist
+Component: Sys.Web.Services
+AssignedTo: lluis@ximian.com                            
+ReportedBy: bmaurer@users.sf.net               
+QAContact: mono-bugs@ximian.com
+TargetMilestone: ---
+URL: 
+Cc: 
+Summary: Webservices cant handle a method with [return:XmlAnyElement]
+
+Description of Problem:
+If you have a method that returns a type, and has the attribute
+[return:XmlAnyElement], the element should be deserialized as an xml node.
+The attribute should just remove the extra metadata from the service
+
+Steps to reproduce the problem:
+<%@ WebService Language="c#" Class="TestService" %>
+
+using System.Web.Services;
+using System.Xml.Serialization;
+
+public class TestService : WebService {
+	[WebMethod]
+	[return:XmlAnyElement]
+	public DivQuot DivWithRemainder (int n, int d)
+	{
+		DivQuot ret = new DivQuot ();
+		ret.dividend = n / d;
+		ret.quotent = n % d;
+		return ret;
+	}
+}
+
+public class DivQuot {
+	public int dividend, quotent;
+}
+
+
+Actual Results:
+System.InvalidOperationException: XmlAnyElementAttribute can only be
+applied to members of type XmlElement, XmlElement[] or XmlNode[]
+in [0x00135] (at
+/devel/mcs/class/System.XML/System.Xml.Serialization/XmlReflectionImporter.cs:503)
+System.Xml.Serialization.XmlReflectionImporter:CreateMapMember
+(System.Xml.Serialization.XmlReflectionMember,string)
+in [0x0001a] (at
+/devel/mcs/class/System.XML/System.Xml.Serialization/XmlReflectionImporter.cs:80)
+System.Xml.Serialization.XmlReflectionImporter:ImportMembersMapping
+(string,string,System.Xml.Serialization.XmlReflectionMember[],bool)
+in [0x003c5] (at
+/devel/mcs/class/System.Web.Services/System.Web.Services.Protocols/Methods.cs:147)
+System.Web.Services.Protocols.SoapMethodStubInfo:.ctor
+(System.Web.Services.Protocols.TypeStubInfo,System.Web.Services.Protocols.LogicalMethodInfo,object,System.Xml.Serialization.XmlReflectionImporter,System.Xml.Serialization.SoapReflectionImporter)
+in [0x00051] (at
+/devel/mcs/class/System.Web.Services/System.Web.Services.Protocols/Methods.cs:385)
+System.Web.Services.Protocols.SoapTypeStubInfo:CreateMethodStubInfo
+(System.Web.Services.Protocols.TypeStubInfo,System.Web.Services.Protocols.LogicalMethodInfo,bool)
+in [0x00084] (at
+/devel/mcs/class/System.Web.Services/System.Web.Services.Protocols/TypeStubManager.cs:124)
+System.Web.Services.Protocols.TypeStubInfo:BuildTypeMethods ()
+in [0x000c6] (at
+/devel/mcs/class/System.Web.Services/System.Web.Services.Protocols/TypeStubManager.cs:232)
+System.Web.Services.Protocols.TypeStubManager:GetTypeStub (System.Type,string)
+in [0x00058] (at
+/devel/mcs/class/System.Web.Services/System.Web.Services.Protocols/SoapDocumentationHandler.cs:39)
+System.Web.Services.Protocols.SoapDocumentationHandler:.ctor
+(System.Type,System.Web.HttpContext)
+in [0x00079] (at
+/devel/mcs/class/System.Web.Services/System.Web.Services.Protocols/WebServiceHandlerFactory.cs:69)
+System.Web.Services.Protocols.WebServiceHandlerFactory:GetHandler
+(System.Web.HttpContext,string,string,string)
+in [0x0005f] (at
+/devel/mcs/class/System.Web/System.Web/HttpApplication.cs:746)
+System.Web.HttpApplication:CreateHttpHandler
+(System.Web.HttpContext,string,string,string)
+in [0x0004c] (at
+/devel/mcs/class/System.Web/System.Web/HttpApplication.cs:435)
+.CreateHandlerState:Execute ()
+in [0x0001f] (at
+/devel/mcs/class/System.Web/System.Web/HttpApplication.cs:677)
+.StateMachine:ExecuteState (System.Web.HttpApplication/IStateHandler,bool&)
+
+Expected Results:
+You are able to view the service page. You can call the method and will get
+the same return as without the [return:...]
+
+------- Additional Comments From lluis@ximian.com  2003-10-14 11:00 -------
+According to the documentation, XmlAnyElement can only be applied to
+members of type XmlElement or XmlNode. I tried that test case on MS,
+and although it compiles, it crashes when the method is invoked. I can
+remove the check in XmlSerializer, but it does not make any sense to
+me, since the code won't run anyway.