I need a class for easy formation of such structures
str += "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n";
str += "<S:Envelope xmlns:S=\"http://schemas.xmlsoap.org/soap/envelope/\">\r\n";
str += "<S:Header/>\r\n";
str += "<S:Body>\r\n";
str += "\t<ns2:get_version xmlns:ns2=\"http://gdfgd/\" />\n\r";
str += "</S:Body>\r\n";
str += "<开发者_JS百科;/S:Envelope>";
The .NET framework has a SoapFormatter Class to serialize objects for you. Mark a class with the [Serializable] attribute, open a file stream and create a SoapFormatter, and you're good to go.
You might want to consider using XML as a way to serialize objects in a cross-platform manner. It's extremely similar to SOAP serialization.
You can try the System.ServiceModel.Channels.Message
class from WCF, it defines primarily a SOAP message.
精彩评论