![]() | |
![]() |
| | Thread Tools | Search this Thread | Display Modes |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
I'm looking for the most efficient way to pass an XML document into a remoting call. I know that I can return an XMLDocument from a remoting call, but passing one as an argument causes errors. |
|
If I pass the XML as a string, I believe that all tags will get URL-encoded, making the document much bigger. |
|
I supposed that I could base64 encode it. Is there a way to just pass it as straight binary data? |
#3
| |||
| |||
|
|
Hello! I'm looking for the most efficient way to pass an XML document into a remoting call. I know that I can return an XMLDocument from a remoting call, but passing one as an argument causes errors. Because the XML-Document is not derived by MarshalByRef object and not serializable you cannot pass it through remoting directly. If I pass the XML as a string, I believe that all tags will get URL-encoded, making the document much bigger. This depends on the kind of formatter you use. A Xml / Soap Formatter MAY encode the XML-String. A binary formatter does not. I supposed that I could base64 encode it. Is there a way to just pass it as straight binary data? This depends on the formatter. The Binary Formatter can do it (others can also do it, but the data may be encoded in most cases (depends on the implementation)). If you have to deal with really "big" xml-files, and you can control both the client and the server, it may be an option for you to use some kind of compression (like GZipStream). Because XML is very redundant GZIP will compress the data very well. Example: // compress XmlDocument doc = ...; MemoryStream ms = new MemoryStream(); GZipStream zipStream = new GZipStream(ms, CompressionMode.Compress); doc.Save(zipStream); zipStream.Close(); byte[] compressed = ms.ToArray(); ms.Close(); //decompress MemoryStream ms = new MemoryStream(data); GZipStream zipStream = new GZipStream(ms, CompressionMode.Decompress); doc.Load(zipStream); zipStream.Close(); ms.Close(); OK? GP |
#4
| ||||
| ||||
|
|
The documents are about 100K, so there's probably not a lot of need for compression (I'd be trading bandwidth for CPU time to compress and deflate). |
|
I tested one of these documents and found that URLEncode expands it by about 50%, as opposed to 33% for base64. |
|
That's probably not a huge deal. What exactly happens with binary encoding, and how does it affect the document size? Do you have a good example of using binary encoding? |
|
Is there a way to see exactly what gets passed via the remoting call and determine its size? |
![]() |
| Thread Tools | Search this Thread |
| Display Modes | |
| |