[Mono-bugs] [Bug 52228][Blo] New - Generated WSDL is not fully compatible with Visual Studio 2003

bugzilla-daemon@bugzilla.ximian.com bugzilla-daemon@bugzilla.ximian.com
Tue, 16 Dec 2003 07:46:20 -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 mordechait@mainsoft.com.

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

--- shadow/52228	2003-12-16 07:46:19.000000000 -0500
+++ shadow/52228.tmp.1842	2003-12-16 07:46:19.000000000 -0500
@@ -0,0 +1,79 @@
+Bug#: 52228
+Product: Mono/Class Libraries
+Version: unspecified
+OS: All
+OS Details: 
+Status: NEW   
+Resolution: 
+Severity: 
+Priority: Blocker
+Component: System.XML
+AssignedTo: mono-bugs@ximian.com                            
+ReportedBy: mordechait@mainsoft.com               
+QAContact: mono-bugs@ximian.com
+TargetMilestone: ---
+URL: 
+Cc: 
+Summary: Generated WSDL is not fully compatible with Visual Studio 2003
+
+Description of Problem:
+When a web method returns some valuetype (for example DataTime) the Mono
+WSDL generator describes that type attribute as maxoccurs=1 and minoccurs=0
+. When VS2003 builds a client proxy for such WSDL it interpatate it as
+return void ! 
+if only the minoccurs would raise to 1 , everything could work in Micorsoft
+client and in XSP server too.
+
+
+Steps to reproduce the problem:
+1. write a simple web service that returns the current date.
+2. Open Visual Studio 2003 and write a client that consumes that service
+   (use Add Web Reference to reference the service in step 1)
+3. 
+
+Actual Results:
+The web method signature in the client returns void.
+
+Expected Results:
+The web method signature in the client should returns DateTime.
+
+
+How often does this happen? 
+allways
+
+
+Additional Information:
+This bug doesn't reflected in Mono XSP server. The service works OK there.
+I guess Mono's XSP understands the WSDL differently then Microsoft.
+The bug is in :
+ System.Xml.Serialization.XmlSchemaExporter.cs line 316  method:
+AddSchemaElement 
+where:
+"if (isTypeMember)
+	{
+	selem.MaxOccurs = 1;
+	selem.MinOccurs = einfo.IsNullable ? 1 : 0;
+				
+	if ((einfo.TypeData.Type.IsPrimitive && einfo.TypeData.Type !=
+typeof(string)) || einfo.TypeData.Type.IsEnum || encodedFormat) 
+	selem.MinOccurs = 1;
+"
+
+Fix:
+check "if (einfo.TypeD..." condition .
+The condition in words: if the element is primitive but not a String or if
+it is an Enum or in encoded format set the selem.MinOccurs to 1.
+
+For some unknown reason it doesn't evaluate to True even if the type
+is a primitive and not a string. I suspect the the typeof operator...
+The if parts must be evaluated in advance.
+
+The Fix:
+                                  
+bool isPrimitive = einfo.IsPrimitive;
+bool isString = einfo.TypeData.Type == typeof(string);
+bool isEnum = einfo.TypeData.Type.IsEnum;
+if ((isPrimitive && !isString) || isEnum || encodedFormat) 
+    selem.MinOccurs = 1;
+
+This has been tested and works.