23 |
* Authors: |
* Authors: |
24 |
* Nicolai P Guba |
* Nicolai P Guba |
25 |
*/ |
*/ |
26 |
|
using System.IO; |
27 |
using DotGNU.XmlRpc; |
using DotGNU.XmlRpc; |
28 |
using DotGNU.DGEE; |
using DotGNU.DGEE; |
29 |
|
|
33 |
{ |
{ |
34 |
public String GetReply( String assemblyName, String className, String methodName ) |
public String GetReply( String assemblyName, String className, String methodName ) |
35 |
{ |
{ |
36 |
XmlRpcWriter writer = new XmlRpcWriter(); |
StringWriter sw = new StringWriter(); |
37 |
XmlRpcStruct h = new XmlRpcStruct(); |
XmlRpcWriter writer = new XmlRpcWriter( sw ); |
38 |
|
XmlRpcStruct h = new XmlRpcStruct(); |
39 |
|
|
40 |
int i = 1; |
int i = 1; |
41 |
double d = 2.99; |
double d = 2.99; |
42 |
bool b = false; |
bool b = false; |
43 |
byte[] bytes = {0x00, 0x12, 0x34, 0x56, 0xAA, 0x55, 0xFF}; |
byte[] bytes = {0x00, 0x12, 0x34, 0x56, 0xAA, 0x55, 0xFF}; |
44 |
|
|
45 |
h["one"] = i; |
h["one"] = i; |
46 |
h["two"] = d; |
h["two"] = d; |
47 |
h["three"] = b; |
h["three"] = b; |
48 |
|
|
49 |
XmlRpcStruct h0 = new XmlRpcStruct(); |
XmlRpcStruct h0 = new XmlRpcStruct(); |
61 |
a.Add( bytes ); |
a.Add( bytes ); |
62 |
h["An array"] = a; |
h["An array"] = a; |
63 |
|
|
64 |
string reply = writer.Parse( h ); |
// use the XmlRpcWriter just like you would XmlTextWriter. In |
65 |
|
// fact it inherits XmlTextWriter but detection of invalid |
66 |
|
// states is not implemented yet. That'll come soon |
67 |
|
//writer.WriteStartDocument(); |
68 |
|
writer.WriteMethodResponse( h ); |
69 |
|
//writer.WriteEndDocument(); |
70 |
|
|
71 |
|
string reply = sw.ToString(); |
72 |
|
|
73 |
|
// feed it into the reader to detect anomalies |
74 |
|
XmlRpcReader reader = new XmlRpcReader( reply ); |
75 |
|
|
76 |
|
Console.Out.WriteLine( "XmlRpcReader\n{0}", reader ); |
77 |
return reply; |
return reply; |
78 |
} |
} |
79 |
} |
} |