+
Skip to content

Bad Request error from apache server #80

Open
@msauer75

Description

@msauer75

Hi,
I want to use the library in my own Qt/QML project. I want to send a json command to an apache webserver which runs a php script. The script analyzes the method and send an answer.

So I did the following:

sp = new Sp(parent, "http://localhost:84/~martin/gc/rpcJSON.php");

consturctor of Sp:

Sp::Sp(QObject *parent, QString urlArg)
    : QObject {parent}
    , url(QUrl(urlArg))
{
rpcClient = new jcon::JsonRpcTcpClient(parent);
if (!rpcClient->connectToServer(url))
{
qDebug() << ">> SP > (Constructor) \t connecToServer fehlerhaft";
}
auto rpcResult = rpcClient->callAsync("getMaxSp");

QObject::connect(rpcResult.get(), &jcon::JsonRpcRequest::result, this, &Sp::msgRecieved);
QObject::connect(rpcResult.get(), &jcon::JsonRpcRequest::error, this, &Sp::msgError);
}

The library will send the following to the server:

{
    "id": "0fce2d19-6b90-4ff6-ae0d-d45c045a055b",
    "jsonrpc": "2.0",
    "method": "getRandomInt",
    "params": [
        10
    ]
}

But the server will send a 400 bad request error.

What can I do to solve the problem?
Thank you for your help.
BR
martin

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      点击 这是indexloc提供的php浏览器服务,不要输入任何密码和下载