/[dgee]/dgee/cslib/DotGNU/DGEE/Protocols/XmlRpc/XmlRpcReplyHandler.cs
ViewVC logotype

Diff of /dgee/cslib/DotGNU/DGEE/Protocols/XmlRpc/XmlRpcReplyHandler.cs

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.1.2.4.2.8 by npg, Fri Jul 25 11:42:14 2003 UTC revision 1.1.2.4.2.8.2.1 by npg, Mon Jul 28 19:16:36 2003 UTC
# Line 35  namespace DotGNU.DGEE.Protocols.XmlRpc Line 35  namespace DotGNU.DGEE.Protocols.XmlRpc
35      public String GetReply( String assemblyName, String className, String methodName )      public String GetReply( String assemblyName, String className, String methodName )
36      {      {
37    
       XmlRpcStruct h      = new XmlRpcStruct();  
   
       int i = 1;  
       double d = 2.99;  
       bool b = false;  
       byte[] bytes = {0x00, 0x12, 0x34, 0x56, 0xAA, 0x55, 0xFF};  
   
       h["one"]   = i;  
       h["two"]   = d;  
       h["three"] = b;  
   
       XmlRpcStruct h0 = new XmlRpcStruct();  
       h0["nested one"] = 11;  
       h0["nested two"] = 22;  
       h["A structure"] = h0;  
         
       XmlRpcArray a = new XmlRpcArray();  
       a.Add( i );  
       a.Add( d );  
       a.Add( b );  
       a.Add( "some dodgy text");  
       a.Add( h0 );  
       a.Add( DateTime.Now );  
       a.Add( bytes );  
       h["An array"] = a;  
   
   
       // use the XmlRpcWriter just like you would XmlTextWriter.  In  
       // fact it inherits XmlTextWriter but detection of invalid  
       // states is not implemented yet.  That'll come soon  
         
       // Write a methodCall  
       StringWriter sw;  
       XmlRpcWriter writer;  
   
       sw = new StringWriter();  
       writer = new XmlRpcWriter( sw );  
       writer.Formatting = Formatting.Indented;  
         
       writer.WriteStartDocument();  
       writer.WriteMethodCall( "ThinkOfALady", a );  
       writer.WriteEndDocument();  
       sw.Flush();  
       string call = sw.ToString();  
       sw.Close();  
       // feed it into the reader to detect anomalies  
       XmlRpcReader reader = new XmlRpcReader( call );  
       Console.Out.WriteLine( "XmlRpcReader: methodCall\n{0}", call );  
       sw = null;  
       writer = null;  
   
       // Write a methodResponse  
       sw     = new StringWriter();  
       writer = new XmlRpcWriter( sw );      
       writer.Formatting = Formatting.Indented;  
   
       writer.WriteStartDocument();  
       writer.WriteMethodResponse( h );  
       writer.WriteEndDocument();  
       sw.Flush();  
       string reply = sw.ToString();  
       sw.Close();  
       reader = new XmlRpcReader( reply );  
         
       //      Console.Out.WriteLine( "XmlRpcWriter\n{0}", reply );  
       Console.Out.WriteLine( "XmlRpcReader: methodResponse\n{0}", reply );  
   
       // Write an error      
       sw     = new StringWriter();  
       writer = new XmlRpcWriter( sw );      
       writer.Formatting = Formatting.Indented;  
   
       writer.WriteStartDocument();  
       writer.WriteMethodResponse( new XmlRpcInvalidStateException( "Test Exception Thrown" ));  
       writer.WriteEndDocument();  
       sw.Flush();  
       sw.Close();  
       Console.Out.WriteLine( "XmlRpcWriter: exception\n{0}", sw );  
38    
39        return "end";        return "end";
40      }      }

Legend:
Removed from v.1.1.2.4.2.8  
changed lines
  Added in v.1.1.2.4.2.8.2.1

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26