0

I'm trying to post a command to the pyBitmessage XML-RPC server in c++ with cpr Curl implementation. Like this:

auto r = cpr::Post(cpr::Url{ "http://xxx:yyy@localhost:8442/" },
    cpr::Body{ "{\"jsonrpc\":\"1.0\",\"id\":1,\"method\":\"add\",\"params\":{\"a\":2,\"b\":3}}" },
    cpr::Header{ { "Content-Type", "application/json" } });

In return I have r returning a status_code 200 but with empty text result and this error value:

{code=INTERNAL_ERROR (4) message="transfer closed with 349 bytes remaining to read" }

what am I doing wrong?

1 Answers1

0

I finally found the solution, pyBitmessage is a regular XML-RPC and not a JSONish version of RPC like implemented with Bitcoind. So the right calling method is in pure XML:

auto r = cpr::Post(cpr::Url{ "http://xxx:yyy@127.0.0.1:8442/" },
cpr::Body{ "<methodCall><methodName>add</methodName><params><param><value><int>123</int></value></param><param><value><int>456</int></value></param></params></methodCall>" });