[Mono-bugs] [Bug 643501] New: Serialization for byte array used in serialization of SOAP Web Services is not consistent to serialization of .NET SOAP services.

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Mon Oct 4 08:46:22 EDT 2010


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

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


           Summary: Serialization for byte array used in serialization of
                    SOAP Web Services is not consistent to serialization
                    of .NET SOAP services.
    Classification: Mono
           Product: Mono: Class Libraries
           Version: unspecified
          Platform: x86-64
        OS/Version: SLES 11
            Status: NEW
          Severity: Critical
          Priority: P5 - None
         Component: Sys.Web.Services
        AssignedTo: atsushi at ximian.com
        ReportedBy: araitses at gmail.com
         QAContact: mono-bugs at lists.ximian.com
          Found By: Development
           Blocker: ---


Created an attachment (id=392810)
 --> (http://bugzilla.novell.com/attachment.cgi?id=392810)
Executable specified in reproduce section

Description of Problem:
Serialization for byte array used in serialization of SOAP Web Services is not
consistent to serialization of .NET SOAP services. Mono Framework serialize
byte array in basex64 string format while .NET framework treat with byte array
with the same way as which all array e.g:
Byte array defined as:

        [System.Xml.Serialization.XmlArrayAttribute()]
        [System.Xml.Serialization.XmlArrayItemAttribute("Byte", IsNullable =
false)]
        public byte[] AAA; 

In Mono framework serialized to:

<AAA>ZAAAAAAAAAAAAAAAAAAAAA==</AAA>

In .NET framework serialized to:

<AAA><Byte>100</Byte><Byte>0</Byte><Byte>0</Byte><Byte>0</Byte><Byte>0</Byte><Byte>0</Byte><Byte>0</Byte><Byte>0</Byte><Byte>0</Byte><Byte>0</Byte><Byte>0</Byte><Byte>0</Byte><Byte>0</Byte><Byte>0</Byte><Byte>0</Byte><Byte>0</Byte></
AAA >

Both serialization type are not consistent and moreover Mono serialization type
does not match to SOAP protocol definition that should be like defined for NET
framework or like following:

<AAA href="#ref-3" />
<SOAP-ENC:Array id="ref-3"
xsi:type="SOAP-ENC:base64">ZAAAAAAAAAAAAAAAAAAAAA==</SOAP-ENC:Array>
Our web services fails to parse such kind of arrays that cause SoapException
“Failed to parse request” on the client.

Steps to reproduce the problem:

The initial issue cannot be reproduced because we using internal web services
while serialization may be compared using program attached that generate 1.xml
file in program execution directory.

1. Type to text file the code below and save to Program.cs:
using System;
using System.Text;

namespace serialize
{
    using System.Xml;
    using System.Xml.Serialization;

    class Program
    {
        static void Main(string[] args)
        {
            XmlSerializer serial = new XmlSerializer(typeof(A));
            //StreamWriter str = new StreamWriter("/home/public/1.xml");
            XmlTextWriter text = new XmlTextWriter("1.xml", Encoding.ASCII);
            A aa = new A();
            aa.AAA = new Byte[16];
            aa.AAA[0] = 100;
            aa.INT = new Int32[16];
            aa.INT[0] = 5;
            serial.Serialize(text, aa);
            text.Close();

        }
    }


    [Serializable]
    public class A
    {
        [System.Xml.Serialization.XmlArrayAttribute()]
        [System.Xml.Serialization.XmlArrayItemAttribute("Byte", IsNullable =
false)]
        public byte[] AAA;
        [System.Xml.Serialization.XmlArrayAttribute()]
        [System.Xml.Serialization.XmlArrayItemAttribute("Int32", IsNullable =
false)]
        public int[] INT;
    }

}

2. Compile using Csc.exe /noconfig  
/reference:%SystemRoot%\Microsoft.NET\Framework\v2.0.50727\System.dll
/reference: :%SystemRoot%\\Microsoft.NET\Framework\v2.0.50727\System.Xml.dll  
/out:serialize.exe /target:exe Program.cs
(Or use attached serialize.exe)
3. Execute on Windows based OS using .NET: serialize.exe

4. Execute on Linux based OS using Mono: mono serialize.exe

5. Compare 1.xml generated on both OS’s

Actual Results:
The file content should be equal. 

Expected Results:
The file content is different.

How often does this happen? 
Always

Additional Information:
SOAP services issue can be discovered using sniffer and compare message body
format. The body of message which sent using Mono client and message which sent
using Windows .NET framework client are different for byte arrays.

-- 
Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.


More information about the mono-bugs mailing list