Results 1 to 11 of 11

Thread: [RESOLVED] xml-rpc

  1. #1

    Thread Starter
    PowerPoster MMock's Avatar
    Join Date
    Apr 2007
    Location
    Driving a 2018 Mustang GT down Route 8
    Posts
    4,513

    Resolved [RESOLVED] xml-rpc

    I have to use xml-rpc, but I'm not really sure what it is, other than that it's something I can (and am supposed to) use to send XML out and get XML back.

    Has anyone used this that can give me very general getting started instructions?

    I have sample XML that I am supposed to send (methodCall) and sample XML of what I will get back (methodResponse), and a URL to use for testing - I am hoping that is enough to get going.

    Thanks.
    There are 10 kinds of people in this world. Those who understand binary, and those who don't.

  2. #2

    Thread Starter
    PowerPoster MMock's Avatar
    Join Date
    Apr 2007
    Location
    Driving a 2018 Mustang GT down Route 8
    Posts
    4,513

    Re: xml-rpc

    It looks like I need this, which is the client library (source is http://www.wordtracker.com/docs/api/ch03s04.html:
    >>
    In order to connect to the XML-RPC API, you will need an XML-RPC client. For the examples below we use the one at http://www.xml-rpc.net/. The version used here is v0.8.1. Add a reference to the CookComputing.XmlRpc.dll in your C# project (Windows project or ASP.net project).
    <<

    When I downloaded from xml-rpc.net, I was expecting a DLL but I got a whole bunch of folders and files. There's is a VS2008 solution file. I am assuming I have to build this DLL myself? There's no doc on what to do with the downloaded files.
    There are 10 kinds of people in this world. Those who understand binary, and those who don't.

  3. #3

    Thread Starter
    PowerPoster MMock's Avatar
    Join Date
    Apr 2007
    Location
    Driving a 2018 Mustang GT down Route 8
    Posts
    4,513

    Re: xml-rpc

    Can anyone offer some assistance? I need this DLL - CookComputing.XmlRpc.dll - but I can't seem to find where to get it. One wouldn't think it would be that difficult! Thanks.
    There are 10 kinds of people in this world. Those who understand binary, and those who don't.

  4. #4

    Thread Starter
    PowerPoster MMock's Avatar
    Join Date
    Apr 2007
    Location
    Driving a 2018 Mustang GT down Route 8
    Posts
    4,513

    Re: xml-rpc

    Okay, I've at least got the DLL now.
    There are 10 kinds of people in this world. Those who understand binary, and those who don't.

  5. #5

    Thread Starter
    PowerPoster MMock's Avatar
    Join Date
    Apr 2007
    Location
    Driving a 2018 Mustang GT down Route 8
    Posts
    4,513

    Re: xml-rpc

    So the solution to not being able to find the DLL was kind of strange. The zip extract created a bin folder on my Windows XP machine but not my Windows 7 machine. Good thing I downloaded to both otherwise I never would've found the DLL! (Is that some strange security feature in Windows 7 that it won't extract a bin folder from a zip file?)

    Anyway, now I can code my client. These are the instructions:
    2.1 How do I implement an XML-RPC client?To make calls to an XML-RPC server it is necessary to use an instance of a proxy class.

    First devise an interface which represents the methods of XML-RPC server endpoint and derive it from IXmlRpcProxy. Mark each of the methods representing an XML-RPC method call with the XmlRpcMethod attribute. For example:

    using CookComputing.XmlRpc;

    public struct SumAndDiffValue
    {
    public int sum;
    public int difference;
    }

    [XmlRpcUrl("http://www.cookcomputing.com/sumAndDiff.rem")]
    public interface ISumAndDiff : IXmlRpcProxy
    {
    [XmlRpcMethod]
    SumAndDiffValue SumAndDifference(int x, int y);
    }
    Note: IXmlRpcProxy was introduced in version 1.0 of XML-RPC.NET. Before then it was necessary to cast the proxy to XmlRpcClientProtocol and then set the required properties. Interfaces which don't derive from IXmlRpcProxy can still be used although casting will still be required.

    Second, create an instance of a dynamically created proxy class:

    ISumAndDiff proxy = XmlRpcProxyGen.Create<ISumAndDiff>();
    Third, call a method on the interface:

    SumAndDiffValue ret = proxy.SumAndDifference(2, 3);

    (end of instructions...)

    I'm not really that familiar with interfaces and proxies, but I thought it meant something like this:

    Code:
    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Web;
    using System.Web.UI;
    using System.Web.UI.WebControls;
    using CookComputing.XmlRpc;
    
    
    namespace SSOProject
    {
        public partial class TestXmlRpc : System.Web.UI.Page
        {
            protected void Page_Load(object sender, EventArgs e)
            {
                try
                {
                    ISumAndDiff proxy = XmlRpcProxyGen.Create<ISumAndDiff>();
                    SumAndDiffValue ret = proxy.SumAndDifference(2, 3);
                }
                catch (Exception ex)
                {
                    string s = ex.Message;
                }
            }
        }
    
    
            public struct SumAndDiffValue
            {
                public int sum;
                public int difference;
            }
    
            [XmlRpcUrl("http://www.cookcomputing.com/sumAndDiff.rem")]
            public interface ISumAndDiff : IXmlRpcProxy
            {
                [XmlRpcMethod]
                SumAndDiffValue SumAndDifference(int x, int y);
            } 
    
    }
    But I get an exception on the line: SumAndDiffValue ret = proxy.SumAndDifference(2, 3);
    which just says "Server encountered an internal error. To get more info turn on customErrors in the server's config file."

    Thanks (if anyone's paying any attention... I could really use some help!)
    There are 10 kinds of people in this world. Those who understand binary, and those who don't.

  6. #6

    Thread Starter
    PowerPoster MMock's Avatar
    Join Date
    Apr 2007
    Location
    Driving a 2018 Mustang GT down Route 8
    Posts
    4,513

    Re: xml-rpc

    Well that one didn't work but this one did:
    Code:
                try
                {
                    IStateName proxy = XmlRpcProxyGen.Create<IStateName>();
                    string stateName = proxy.GetStateName(41);
                }
                catch (Exception ex)
                {
                    string s = ex.Message;
                }
                // But this one works
                try
                {
                    IStateName proxy = XmlRpcProxyGen.Create<IStateName>();
                    string stateName = proxy.GetStateName(41);
                }
                catch (Exception ex)
                {
                    string s = ex.Message;
                }
    Code:
            [XmlRpcUrl("http://www.cookcomputing.com/xmlrpcsamples/RPC2.ashx")]
            public interface IStateName : IXmlRpcProxy
            {
                [XmlRpcMethod("examples.getStateName")]
                string GetStateName(int stateNumber);
            }
    So now that I have at least one working example I will try it with the service I am supposed to call for real.
    There are 10 kinds of people in this world. Those who understand binary, and those who don't.

  7. #7

    Thread Starter
    PowerPoster MMock's Avatar
    Join Date
    Apr 2007
    Location
    Driving a 2018 Mustang GT down Route 8
    Posts
    4,513

    Re: xml-rpc

    It is working. I hope this helps somebody else since I had to trudge through some stuff to get to a solution.
    There are 10 kinds of people in this world. Those who understand binary, and those who don't.

  8. #8
    PowerPoster gep13's Avatar
    Join Date
    Nov 2004
    Location
    The Granite City
    Posts
    21,963

    Re: [RESOLVED] xml-rpc

    Wow, busy day at the office

    I don't envy you have to use xml-rpc.

    Gary

  9. #9

    Thread Starter
    PowerPoster MMock's Avatar
    Join Date
    Apr 2007
    Location
    Driving a 2018 Mustang GT down Route 8
    Posts
    4,513

    Re: [RESOLVED] xml-rpc

    Quote Originally Posted by gep13 View Post
    I don't envy you have to use xml-rpc.
    Oh, why is that? Some doc I found said it is lightweight and simpler than SOAP. So far it seems okay.

    Is it true that Windows 7 would block a bin folder from being extracted from a zip file? That is bothering me, because I just luckily happened to download xml-rpc again on my XP machine (I was trying the download again in general and that is where I happened to be), and I got the bin folder there. It's hard to make calls to a dll that you don't even have...
    There are 10 kinds of people in this world. Those who understand binary, and those who don't.

  10. #10
    PowerPoster gep13's Avatar
    Join Date
    Nov 2004
    Location
    The Granite City
    Posts
    21,963

    Re: [RESOLVED] xml-rpc

    Hmm, perhaps I am mis-remembering, but I seem to remember a colleague of mine having lots of hassle with it.

    Not that I am aware of, no. You might want to try running the Windows Explorer using "Run As Administrator" to see if that makes any difference.

    Gary

  11. #11
    New Member
    Join Date
    Aug 2024
    Posts
    1

    Re: [RESOLVED] xml-rpc

    http://www.xml-rpc.net/ seems to be gone.
    Anyone can help me out to find the ready-to-use DLL?
    I could download the XML-RPC.NET-trunk-org from GitHub but i don't manage to create a working COM interop. anyone can help?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width