Discussion:
Writing Multi-Part Message to XmlDocument or File
(too old to reply)
Sree
2009-12-10 21:56:33 UTC
Permalink
How do I write a multi part message to a file. I have this message
that I populate as a request for a service and I get a response back
from the service. Since they are both Multipart message, I need a way
to write them to a file without having to send them through a send
port. I want to do that from a C# code.

All Help is Great Help

Thanks
Sree
Tomas Restrepo [MVP]
2009-12-11 22:04:23 UTC
Permalink
You can't really serialize the message directly to a single XmlDocument
without wrapping all the parts in a wrapper element. Other than that, it's
fairly simple.

Write a new C# class with a method that takes an argument of type
XLANGMessage [1]. You can then iterate over the parts contained in the
message (each one of type XLANGPart [2]). You can then call the RetrieveAs()
[3] method on each part to ask for the part's content in a usable format.
One way would be to ask for an XmlReader or a Stream and then either write
that directly to an XmlWriter or file.

[1] http://msdn.microsoft.com/en-us/library/ee277265(BTS.10).aspx
[2] http://msdn.microsoft.com/en-us/library/ee277305(BTS.10).aspx
[3] http://msdn.microsoft.com/en-us/library/ee277299(BTS.10).aspx
--
Tomas Restrepo
http://winterdom.com/
Post by Sree
How do I write a multi part message to a file. I have this message
that I populate as a request for a service and I get a response back
from the service. Since they are both Multipart message, I need a way
to write them to a file without having to send them through a send
port. I want to do that from a C# code.
All Help is Great Help
Thanks
Sree
Loading...