Search code examples
pythoncurlxml-rpc

curl command for an xmlrpc command


so i have an XMLRPC server that has a command called start_apps

normally from python I would run it like this

import xmlrpclib
app=xmlrpclib.ServerProxy("http://localhost:6610/app_rpc")

app.start_apps()

is there any way to call this method from a curl command?

i'm interested from bash or powershell


Solution

  • The following command will invoke the start_apps command by posting the XML data to the XMLRPC server:

    curl -d "<?xml version='1.0'?><methodCall><methodName>start_apps</methodName></methodCall>" http://localhost:6610/app_rpc
    

    When invoked on Linux use single quotes for the XML fragment.