views:

442

answers:

2

We have Flex applications that connect to our ASP.NET 3.5 Web Applications and usually download lot of data. Now considering XML as transport, for every item, it transmits meta data twice for example.. instead of transferring int value as <Customer CustomerID=23/> it transmits <Customer><CustomerID>23</CustomerID></Customer> .. now here is where bandwidth conservation becomes an issue.

  1. FLEX Can not read GZip and DEFLATE compressed HTTP Response ( So cant use any of them )
  2. I heard of some WSCompression but it requires WSE 3.0 now I am skeptical to introduce too many dependency in my hosting environment which requires too much management and overheads. Is WSE 3.0 only dll library which requires no installation on production server? Does it require rewriting all WebService attribute? Or is it simple one time configuration and more or less, anyone knows does it work with Flex ?
  3. Flex dynamically generates web services, and we use lot of its auto generated code, now if we want to support compression then do we need to rewrite lot of code?

Simplest solution I can think of is, reduce unnecessary XML tags and reduce them down to attributes to save bandwidth. Is there an easy way to achieve it, our classes has more then 50-70 properties, I understand it will be nightmare to add attributes to each property but we dont know how to do it in case of SOAP.

Question:

  1. What is WSE 3.0 anyway, does it need to be installed on production server? To enable WSCompression do we need additional code to be integrated in our web service code like with each WebMethod attribute, do we need to add more code in attributes?

  2. Is there an easy way to tag properties with attributes and force serialization in simple form like [SoapAttribute], which transforms data as attribute instead of tag and does it work with FLEX or will it work with any client?

  3. Does SOAP has standard format of only elements or it can support attributes?

A: 

SOAP supports attributes as well as elements.

John Saunders
Well thats Microsoft again, never support the standard 100%, I applied [SoapAttribute] to all the properties of one class, tried various combinations, the serialization is always in elements, it doesnt do it in attributes !!!
Akash Kava
Ok, as documented [SoapAttribute] should work but it doesnt, instead [XmlAttribute] works, well still need to check with implementation details in FLEX.. i will update the answer once I have checked everything.
Akash Kava
Please read the documentation carefully. I know it's confusing, but `[SoapAttribute]` is _not_ meant to work in your situation. Note the example at http://msdn.microsoft.com/en-us/library/system.xml.serialization.soapattributeattribute.aspx and compare to http://msdn.microsoft.com/en-us/library/system.xml.serialization.xmlattributeattribute.aspx.
John Saunders
Also, out of curiosity, what does `[SoapAttribute]` have to do with supporting any standard?
John Saunders
A: 

Finally I found workaround by using XmlAttribute

[XmlAttribute]
public long CustomerID;

Forces field to be serialized as "Attribute" however MSDN Documentation of SoapAttribute says following "Apply the SoapAttributeAttribute to a public field to specify that the XmlSerializer serializes the field as an XML attribute." and according to SOAP standard, it should do it, but it does not !!

Akash Kava