XML-RPC

Xtended Markup Language Remote Procedure Call

[... XML ...]

The TclSOAP package has been expanded to cover XML-RPC as an RPC protocol as well as SOAP. As the two protocols are pretty much identical this should come as no surprise. There is support for providing SOAP and XML-RPC services from tclhttpd and constructing clients by binding tcl procedures to the RPC provided method. See http://tclsoap.sourceforge.net/ for the details.

The XML-RPC subsection of the TclSOAP page is headed by a big banner saying "This code has been superceeded [sic] as of version 1.6" The question is, superseded how, and by what?

PT 29-May-2003: That section covers XML-RPC as a service. Writing client code is simple - but undocumented now that I check. However, it's pretty much the same as SOAP but with less variable types. The validator1.tcl script in the tclsoap samples directory implements a client for the Userland XML-RPC interperability tests. This should provide some help concerning the use of this package.

DcK 2013-01-19. Here a sample to write a XML-RPC client with TCLSoap. It interacts to Bugzilla.

package require XMLRPC
package require SOAP
package require rpcvar
package require http

#Allows http:// -> https:// redirections.
#Direct connections to https:// require a XMLRPC code modification
package require tls
http::register https 443 ::tls::socket

#
# Bugzilla structures
#

namespace import -force rpcvar::typedef

typedef {
   login        string
   password     string
   remember     boolean
} userLoginRequest


#
# Bugzilla libraries
#

namespace eval ::Bugzilla:: {
        proc endpoint {} {
                return http://landfill.bugzilla.org/bugzilla-tip/xmlrpc.cgi
        }

        proc login {} {
                if [catch {UserLogin [list \
                        login           randomguy \
                        password        secret123 \
                        remember        1 \
                ] } reply] {
                        #Your error processing code.
                        error "Can't login"
                }
                return $reply
        }

        proc version {
                BugzillaVersion
        }
}

#
# XML-RPC procedures
#

XMLRPC::create ::Bugzilla::UserLogin -name "User.login" -proxy [::Bugzilla::endpoint] -params {login userLoginRequest}
XMLRPC::create ::Bugzilla::BugzillaVersion -name "Bugzilla.version" -proxy [::Bugzilla::endpoint]

There's also http://sourceforge.net/projects/xmlrpctcl/ .


SC Just noticed the Wiki RPC interface definition [L1 ] implemented in a few wiki tools.


Jacob Levy Mar 7, 2004: If anyone figures out how to use XML-RPC services with tclhttpd then please add an example here. I need this to work, dammit :) -- I might end up figuring it out for myself, if so I'll update here.

Scott Gamon - If someone passing by here still wants to know how to provide XML-RPC services with tclhttpd, I wrote a page of docs on the subject[L2 ]. dead link -> [L3 ]

Jacob Levy Mar 8, 2004: Scott thanks for that page, very helpful. In the meantime Pat Thoyts and myself have spent a bunch of time unifying XML-RPC and SOAP support for tclhttpd so that in an upcoming release XML-RPC will work again under tclhttpd with the base tclsoap distribution. We took many ideas embodied in the cgi-bin support and in Scott's excellent work, and incorporated them into the tclsoap package. Pat is the one responsible for a new release, when it's ready I'm sure he'll release it.