XML-RPC Interview Questions & Answers

5 avg. rating (100% score) - 1 votes

XML-RPC Interview Questions & Answers

XML-RPC Interview Questions

XML-RPC Interview Questions
    1. Question 1. What Is Xmlrpc++?

      Answer :

      XmlRpc++ is a C++ implementation of the XML-RPC protocol.

    2. Question 2. What Is Xml-rpc?

      Answer :

      The XML-RPC protocol was designed to make remote procedure calls (RPCs) easy: it encodes data in a simple XML format and uses HTTP for communication. XML-RPC is intended to be used to implement web services and distributed applications. Check out XML-RPC for Newbies.

    3. Question 3. What Other Xml-rpc Implementations Exist?

      Answer :

      XML-RPC implementations 

    4. Question 4. Why Do We Need Another Xml-rpc Implementation (specifically Xmlrpc++)?

      Answer :

      XmlRpc++ is designed to make it easy to incorporate XML-RPC client and server support into C++ applications. It is written in portable, extendable C++. No other libraries are required, other than your system's socket libraries. Simple XML parsing and HTTP support are built in. It is easy to build and has a small API. There is no easier way to add remote procedure call support to a C++ application that I know of. 

    5. Question 5. Why Not Use Soap (or Dce Rpc, Onc Rpc, Corba, Dcom, ...)?

      Answer :

      XML-RPC is easy, free, and fast enough for my purposes. Use the tool that best solves your problem. 

    6. Question 6. What Is An Xml-rpc Server (client)?

      Answer :

      An XML-RPC server has one or more procedures (or methods) registered, and makes those procedures available to XML-RPC clients over a network (LAN or Internet). An XML-RPC client calls one or more remote procedures provided by an XML-RPC server, and gets a result, much like calling a local procedure (function, method, etc). Arguments and results are converted to an XML format for transfer across the network. 

    7. Question 7. How Do You Use Xmlrpc++ As An Xml-rpc Server?

      Answer :

      Here is an example of a server (taken from the file test/HelloServer.cpp in the XmlRpc++ distribution) that registers a single remote procedure named Hello and listens on a port for calls to that procedure:

      #include "XmlRpc.h"

      using namespace XmlRpc;

      // The server

      XmlRpcServer s;

      // The Hello method. No arguments, result is "Hello".

      class Hello : public XmlRpcServerMethod

      {

      public:

        Hello(XmlRpcServer* s) : XmlRpcServerMethod("Hello", s) {}

        void execute(XmlRpcValue& params, XmlRpcValue& result)

        {

          result = "Hello";

        }

      } hello(&s);    // This constructor registers the method with the server

      // The port to use

      const int PORT = 8080;

      int main(int argc, char* argv[]) {

        // Create the server socket on the specified port

        s.bindAndListen(PORT);

        // Wait for requests and process indefinitely (Ctrl-C to exit)

        s.work(-1.0);

        return 0;

      }

    8. Question 8. How Does Xml-rpc.net Represent Xml-rpc Requests And Responses?

      Answer :

      XML-RPC.NET represents an XML-RPC endpoint as a .NET interface whose methods map onto the corresponding XML-RPC methods.

      For example:

      using CookComputing.XmlRpc;

      public struct SumAndDiffValue 

      {

        public int sum; 

        public int difference; 

      }

      [XmlRpcUrl("http://www.wisdomjobs.com/sumAndDiff.rem")] 

      public interface ISumAndDiff

        [XmlRpcMethod] 

        SumAndDiffValue SumAndDifference(int x, int y);

      A server implementation implements these methods. A client implementation automatically generates a proxy class which derives from the interface.

    9. Question 9. What If The Xml-rpc Struct Member Name Is Not Valid In .net?

      Answer :

      In some cases the name of a member in an XML-RPC struct might be invalid in the .NET programming language being used. To handle this the XmlRpcMember attribute is available. This allows an XML-RPC member name to be mapped to and from a different .NET name.

      For example:

      public struct SumAndDiffValue

        [XmlRpcMember("sample.sum")] 

        public int sum; 

        [XmlRpcMember("sample.difference")] 

        public int difference; 

      }

    10. Question 10. How Are Xml-rpc Arrays Represented As .net Types?

      Answer :

      Where possible XML-RPC.NET maps XML-RPC arrays onto arrays of .NET types. Where this is not possible, for example where the members of the XML-RPC array are not of the same type, the mapping is to an instance of System.Object[].

      XML-RPC.NET does not support "jagged" arrays - arrays of arrays - because these are not CLS compliant.

    11. Question 11. What If The Xml-rpc Method Name Is Not Valid In My Programming Language?

      Answer :

      Sometimes the XML-RPC method name cannot be used as a method name in the proxy class. For example, it is common practice for XML-RPC method names to have the form namespace.methodname, such as sample.SumAndDifference In these cases a different constructor is used for the XmlRpcMethod attribute, taking a string which specifies the XML-RPC method name.

      For example:

      [XmlRpcUrl("http://www.wisdomjobs.com/sumAndDiff.rem")] 

      public interface ISumAndDiff : IXmlRpcProxy

        [XmlRpcMethod("sample.sumAndDifference")]  

        SumAndDiffValue SumAndDifference(int x, int y);

      }

    12. Question 12. How Do I Supply Authentication Credentials?

      Answer :

      Proxy classes are derived from IXmlRpcProxy and so inherit a Credentials property. This is used where the XML-RPC server authenticates the caller. The property is used in exactly the same way as the same property of the System.Net.WebRequest class.

      For example:

      ISumAndDiff proxy = (ISumAndDiff)XmlRpcProxyGen.Create(typeof(ISumAndDiff));

      proxy.Credentials = new NetworkCredential("jsmith","password");

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

    13. Question 13. How Do I Send Cookies With A Request?

      Answer :

      Proxy classes are derived from IXmlRpcProxy and so inherit a CookieContainer property of type System.Net.CookieContainer, like the corresponding property of System.Net.HttpWebRequest. Instances of System.Net.Cookie added to the container will sent with the HTTP request.

      For example:

      ISumAndDiff proxy = (ISumAndDiff)XmlRpcProxyGen.Create(typeof(ISumAndDiff));

      Cookie cookie = new Cookie("foo", "bar", "/", "www.wisdomjobs.com")

      proxy.CookieContainer.Add(cookie);

      SumAndDiffValue ret = proxy->SumAndDifference(2, 3);


Face Book Twitter Google Plus Instagram Youtube Linkedin Myspace Pinterest Soundcloud Wikipedia

All rights reserved © 2018 Wisdom IT Services India Pvt. Ltd DMCA.com Protection Status

XML-RPC Tutorial