开发者

What class will be used to create SOAP?

开发者 https://www.devze.com 2023-03-10 16:06 出处:网络
I need a class for easy formation of such structures str += \"<?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?>\\r\\n\";

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消