Click here to Skip to main content
14,390,949 members
Rate this:
Please Sign up or sign in to vote.
See more:
Hi,

I am getting internal server error while try to call server funtion using XmlRpc in c#.
Please look into code:
Client App code:
static void Main(string[] args)
       {
           int[] str = { 1,2,3,4,5,6,7,8,9 };
           while (true)
           {
               try
               {
                   HttpListenerController _controller = null;

                   string[] prefixes = new string[] {
                   "http://localhost:5678/"
                    };
                   string curDir = System.Environment.CurrentDirectory;
                   string vdir = "/";
                   string pdir = curDir; ;

                   _controller = new HttpListenerController(prefixes, vdir, pdir);
                   _controller.Start();
                   IName proxy = XmlRpcProxyGen.Create<IName>();
                   (proxy as XmlRpcClientProtocol).Url = "http://localhost:5678/name.rem";
 //Error           string s = proxy.XMLConversion(str);

                   Console.Write(s);
                   _controller.Stop();
               }
               catch (XmlRpcFaultException fx)
               {
                   Console.Write(fx);
               }
           }
       }
   }


Server App:
public class Program : MarshalByRefObject, Interface.Iname
   {
       public string XMLConversion(int[] str)
       {
           string k = "Kuldeep Dwivedi";
           return k;
       }
       public string XMLConversions(StructRequest request)
       {
           string ret = "Dwivedi";
           return ret;
       }
   }
   class _
   {
       static void Main(string[] args)
       {
           IDictionary props = new Hashtable();
           props["name"] = "localhost";
           props["port"] = 5678;
           HttpChannel channel = new HttpChannel(
              props,
              null, null
           );
           ChannelServices.RegisterChannel(channel, false);

           RemotingConfiguration.RegisterWellKnownServiceType(
             typeof(Program),
             "name.rem",
             WellKnownObjectMode.Singleton);
           Console.WriteLine("Press <ENTER> to shutdown");
           Console.ReadLine();
       }
   }


Error Detail:
CookComputing.XmlRpc.XmlRpcServerException was unhandled
Message=Internal Server Error
Source=CookComputing.XmlRpcV2
StackTrace:
at CookComputing.XmlRpc.XmlRpcClientProtocol.ReadResponse(XmlRpcRequest req, WebResponse webResp, Stream respStm)
at CookComputing.XmlRpc.XmlRpcClientProtocol.Invoke(Object clientObj, MethodInfo mi, Object[] parameters)
at CookComputing.XmlRpc.XmlRpcClientProtocol.Invoke(MethodInfo mi, Object[] Parameters)
at XmlRpcProxyed97aecc-bdea-49b2-a2a7-0f9dbae8a8b3.XMLConversion(Int32[] str)
at ConsoleApplication1.Program.Main(String[] args) in F:\Latest\ConsoleApplication1\ConsoleApplication1\Program.cs:line 32
at System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args)
at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean ignoreSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.ThreadHelper.ThreadStart()
InnerException:

Thanks in Advance
Kuldeep Dwivedi
Posted

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100