tags:

views:

293

answers:

2

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"&gt;100&lt;/string&gt;
  <string xmlns="http://schemas.microsoft.com/2003/10/Serialization/Arrays"&gt;101&lt;/string&gt;
  <string xmlns="http://schemas.microsoft.com/2003/10/Serialization/Arrays"&gt;102&lt;/string&gt;
   ... 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"&gt;
  <a:string>100</a:string>
  <a:string>101</a:string>
  <a:string>102</a:string>
  ... etc..
</ids>
A: 

I'm not too familiar with serialization, but could this be the difference between SOAP 1.1 and 1.2? I'm betting that you can specify either format. Is there a compelling reason to not just use the WCF client?

Adam Fyles
I'm using SOAP 1.1 in both cases (basicHttpBinding). I need so support legacy non-WCF clients (.NET 3.0 is not installed everywhere).
Joe
+1  A: 

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.

Anderson Imes