Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6731131
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T10:29:29+00:00 2026-05-26T10:29:29+00:00

It’s pretty hard to find information about XMLRPC.net library used with https. The only

  • 0

It’s pretty hard to find information about XMLRPC.net library used with https.

The only documentation where an “https” URL can be set is here : http://xml-rpc.net/faq/xmlrpcnetfaq-2-5-0.html#2.3 but yet it does not explain exactly how can one setup correctly.

Experimenting on the base of samples provided in the downloads http://xmlrpcnet.googlecode.com/files/xml-rpc.net.2.5.0.zip I tried this :

Changes in the client.cs file of StateNameServer solution :

IStateName svr = (IStateName)Activator.GetObject(
typeof(IStateName), "https://localhost:5678/statename.rem");

What the server code looks like

    IDictionary props = new Hashtable();
    props["name"] = "MyHttpChannel";
    props["port"] = 5678;
    HttpChannel channel = new HttpChannel(
    props,
    null,
    new XmlRpcServerFormatterSinkProvider()
    );

    ChannelServices.RegisterChannel(channel, false);

    RemotingConfiguration.RegisterWellKnownServiceType(
    typeof(StateNameServer),
    "statename.rem",
    WellKnownObjectMode.Singleton);

The client obviously drops an exception when trying to contact the server using HTTPS because I don’t know how to configure it. Could someone help in anyway please ? What kind of stuff should I look for ?

Thanks a lot !

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T10:29:30+00:00Added an answer on May 26, 2026 at 10:29 am

    First, I would like to thank warmly Charles Cook for his help on this problem and for developing XMLRPC.NET.

    Second, this sample is based on the XMLRPC.NET StateNameServer sample available for download here :
    http://xml-rpc.net/download.html

    So here is the solution :

    1. Generate or get a [self-signed] certificate (using makecert.exe for example)

    2. Add this certificate to your server configuration and specify the port you want to use with your XMLRPC.NET server (in this case 5678) using httpcfg.exe or another tool like HttpSysConfig (Open Source)

    3. Implement your XMLRPC.NET server using the following code :

    using System;
    using System.Collections;
    using System.Runtime.Remoting;
    using System.Runtime.Remoting.Channels;
    using System.Runtime.Remoting.Channels.Http;
    
    using CookComputing.XmlRpc;
    
    using System.Net;
    using System.IO;
    
    public class _
    {
        static void Main(string[] args)
        {
            HttpListener listener = new HttpListener();
            listener.Prefixes.Add("https://127.0.0.1:5678/");
            listener.Start();
            while (true)
            {
                HttpListenerContext context = listener.GetContext();
                ListenerService svc = new StateNameService();
                svc.ProcessRequest(context);
            }
    
            Console.WriteLine("Press <ENTER> to shutdown");
            Console.ReadLine();
        }
    }
    
    public class StateNameService : ListenerService
    {
        [XmlRpcMethod("examples.getStateName")]
        public string GetStateName(int stateNumber)
        {
            if (stateNumber < 1 || stateNumber > m_stateNames.Length)
                throw new XmlRpcFaultException(1, "Invalid state number");
            return m_stateNames[stateNumber - 1];
        }
    
        string[] m_stateNames
          = { "Alabama", "Alaska", "Arizona", "Arkansas",
            "California", "Colorado", "Connecticut", "Delaware", "Florida",
            "Georgia", "Hawaii", "Idaho", "Illinois", "Indiana", "Iowa", 
            "Kansas", "Kentucky", "Lousiana", "Maine", "Maryland", "Massachusetts",
            "Michigan", "Minnesota", "Mississipi", "Missouri", "Montana",
            "Nebraska", "Nevada", "New Hampshire", "New Jersey", "New Mexico", 
            "New York", "North Carolina", "North Dakota", "Ohio", "Oklahoma",
            "Oregon", "Pennsylviania", "Rhose Island", "South Carolina", 
            "South Dakota", "Tennessee", "Texas", "Utah", "Vermont", "Virginia", 
            "Washington", "West Virginia", "Wisconsin", "Wyoming" };
    }
    
    public abstract class ListenerService : XmlRpcHttpServerProtocol
    {
        public virtual void ProcessRequest(HttpListenerContext RequestContext)
        {
            try
            {
                IHttpRequest req = new ListenerRequest(RequestContext.Request);
                IHttpResponse resp = new ListenerResponse(RequestContext.Response);
                HandleHttpRequest(req, resp);
                RequestContext.Response.OutputStream.Close();
            }
            catch (Exception ex)
            {
                // "Internal server error"
                RequestContext.Response.StatusCode = 500;
                RequestContext.Response.StatusDescription = ex.Message;
            }
        }
    }
    
    public class ListenerRequest : CookComputing.XmlRpc.IHttpRequest
    {
        public ListenerRequest(HttpListenerRequest request)
        {
            this.request = request;
        }
    
        public Stream InputStream
        {
            get { return request.InputStream; }
        }
    
        public string HttpMethod
        {
            get { return request.HttpMethod; }
        }
    
        private HttpListenerRequest request;
    }
    
    public class ListenerResponse : CookComputing.XmlRpc.IHttpResponse
    {
        public ListenerResponse(HttpListenerResponse response)
        {
            this.response = response;
        }
    
        string IHttpResponse.ContentType
        {
            get { return response.ContentType; }
            set { response.ContentType = value; }
        }
    
        TextWriter IHttpResponse.Output
        {
            get { return new StreamWriter(response.OutputStream); }
        }
    
        Stream IHttpResponse.OutputStream
        {
            get { return response.OutputStream; }
        }
    
        int IHttpResponse.StatusCode
        {
            get { return response.StatusCode; }
            set { response.StatusCode = value; }
        }
    
        string IHttpResponse.StatusDescription
        {
            get { return response.StatusDescription; }
            set { response.StatusDescription = value; }
        }
    
        private HttpListenerResponse response;
    }
    
    public class StateNameServer : MarshalByRefObject, IStateName
    {
      public string GetStateName(int stateNumber)
      {
        if (stateNumber < 1 || stateNumber > m_stateNames.Length)
          throw new XmlRpcFaultException(1, "Invalid state number");
        return m_stateNames[stateNumber-1]; 
      }
    
      public string GetStateNames(StateStructRequest request)
      {
        if (request.state1 < 1 || request.state1 > m_stateNames.Length)
          throw new XmlRpcFaultException(1, "State number 1 invalid");
        if (request.state2 < 1 || request.state2 > m_stateNames.Length)
          throw new XmlRpcFaultException(1, "State number 1 invalid");
        if (request.state3 < 1 || request.state3 > m_stateNames.Length)
          throw new XmlRpcFaultException(1, "State number 1 invalid");
        string ret = m_stateNames[request.state1-1] + " "
          + m_stateNames[request.state2-1] + " " 
          + m_stateNames[request.state3-1];
        return ret;
      }
    
      string[] m_stateNames 
        = { "Alabama", "Alaska", "Arizona", "Arkansas",
            "California", "Colorado", "Connecticut", "Delaware", "Florida",
            "Georgia", "Hawaii", "Idaho", "Illinois", "Indiana", "Iowa", 
            "Kansas", "Kentucky", "Lousiana", "Maine", "Maryland", "Massachusetts",
            "Michigan", "Minnesota", "Mississipi", "Missouri", "Montana",
            "Nebraska", "Nevada", "New Hampshire", "New Jersey", "New Mexico", 
            "New York", "North Carolina", "North Dakota", "Ohio", "Oklahoma",
            "Oregon", "Pennsylviania", "Rhose Island", "South Carolina", 
            "South Dakota", "Tennessee", "Texas", "Utah", "Vermont", "Virginia", 
            "Washington", "West Virginia", "Wisconsin", "Wyoming" };
    }
    

    4. Implement your XMLRPC.NET client using the following code (the code also creates a new X509 client certificate)

    using System;
    using System.Collections;
    using System.Runtime.Remoting;
    using System.Runtime.Remoting.Channels;
    using System.Runtime.Remoting.Channels.Http;
    
    using CookComputing.XmlRpc;
    using System.Net;
    using System.Security.Cryptography.X509Certificates;
    
    class _
    {
        public class TrustAllCertificatePolicy : System.Net.ICertificatePolicy
        {
            public TrustAllCertificatePolicy() { }
            public bool CheckValidationResult(ServicePoint sp,
               X509Certificate cert,
               WebRequest req,
               int problem)
            {
                return true;
            }
        }
        static void Main(string[] args)
        {
            System.Net.ServicePointManager.CertificatePolicy = new TrustAllCertificatePolicy();
            IStateName proxy = XmlRpcProxyGen.Create<IStateName>();
            XmlRpcClientProtocol cp = (XmlRpcClientProtocol)proxy;
            cp.Url = "https://127.0.0.1:5678/";
            cp.ClientCertificates.Add(new System.Security.Cryptography.X509Certificates.X509Certificate(@"C:\path\to\your\certificate\file\my.cer"));
            cp.KeepAlive = false;
            //cp.Expect100Continue = false;
            //cp.NonStandard = XmlRpcNonStandard.All;
    
            string stateName = ((IStateName)cp).GetStateName(13);
        }
    }
    

    Of course, I don’t give here the interface implementation for the ServerStateName but you’ll find it in the sample files using the download link at the top.

    Remark :

    System.Net.ServicePointManager.CertificatePolicy = new TrustAllCertificatePolicy(); will allow the server implementation to accept the self-signed certificate you generated by yourself. I think this is not necessary with certificates issued by certification authorities.

    If you find anything that could be improved and is incorrect it will be much appreciated.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

That's pretty much it. I'm using Nokogiri to scrape a web page what has
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I used javascript for loading a picture on my website depending on which small
I have a jquery bug and I've been looking for hours now, I can't
I'm new to using the Perl treebuilder module for HTML parsing and can't figure
Seemingly simple, but I cannot find anything relevant on the web. What is the
I want use html5's new tag to play a wav file (currently only supported
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
Does anyone know how can I replace this 2 symbol below from the string
I have just tried to save a simple *.rtf file with some websites and

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.