<?xml version="1.0"?> <methodCall> <methodName /> <params> <param> <value> <string>12</string> </value> </param> </params> </methodCall>
public string XMLConversion(BaseS exa) { Stream stm = new MemoryStream(); XmlRpcRequest req = new XmlRpcRequest(); req.args = new Object[] { exa }; XmlRpcSerializer ser = new XmlRpcSerializer(); ser.SerializeRequest(stm, req); stm.Position = 0; TextReader tr = new StreamReader(stm); string reqstr = tr.ReadToEnd(); return exa.Val1; }
[Serializable] public struct BaseS { //public string val11; public string Val1 { set { Val1 = "12"; } } } ----------------------------------- public interface Iname { [XmlRpcMethod("Server.XmlCnversion")] //string XMLConversion(XMLValues exa); string XMLConversion(BaseS request); } ------------------------------- BaseS bs ; bs.Val1 = "12"; try { IName svr = (IName)Activator.GetObject( typeof(IName), "http://localhost:5678/name.rem"); string s = svr.XMLConversion(bs); Console.Write(s); } catch (XmlRpcFaultException fx) { Console.Write(fx); }
<?xml version="1.0"?> <methodCall> <methodName /> <params> <param> <value> <struct> <member> <name>Val1</name> <value> <string>12</string> </value> </member> </struct> </value> </param> </params> </methodCall>
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)