I am using a WCF OperationContract that takes an array of integers as an argument. It is using basicHttpBinding.
I've noticed that the generated SOAP from a client generated using Visual Studio "Add Web Reference" includes the xmlns thus:
<ids>
<string xmlns="http://schemas.microsoft.com/2003/10/Serialization/Arrays">100</string>
<string xmlns="http://schemas.microsoft.com/2003/10/Serialization/Arrays">101</string>
<string xmlns="http://schemas.microsoft.com/2003/10/Serialization/Arrays">102</string>
... etc
</ids>
This will increase the size of the serialized stream with large arrays. Is there any way to eliminate this xmlns attribute?
For a WCF client, the generated SOAP looks more like what I would expect:
<ids xmlns:a="http://schemas.microsoft.com/2003/10/Serialization/Arrays" xmlns:i="http://www.w3.org/2001/XMLSchema-instance">
<a:string>100</a:string>
<a:string>101</a:string>
<a:string>102</a:string>
... etc..
</ids>
That's really a function of the client proxy and not your service, unfortunately. In this example, you are looking at a client using XML Serialization vs. Data Contract Serialization. One is simply better than the other at making the XML more compact.
You might have better luck with the type generator in WSE 3.0 (link) It is possible there is a set of XML attribute tags you can put on a class to make it serialize better and maybe those were integrated into WSE, but I'm not 100% on that.
You should let us know what you decide. Very interesting.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With