Qtsoap请求不传递参数

Qtsoap请求不传递参数,qt,soap,arguments,Qt,Soap,Arguments,我正在试着让肥皂在qt中起作用 我发现:qtsoap-2.7_1-opensource 我的请求代码: void DataConnector::checkLogin(QString username, QString password){ QtSoapMessage request; request.setMethod(QtSoapQName("checkLogin","http://service/")); request.addMethodArgument("user

我正在试着让肥皂在qt中起作用 我发现:qtsoap-2.7_1-opensource

我的请求代码:

void DataConnector::checkLogin(QString username, QString password){
    QtSoapMessage request;
    request.setMethod(QtSoapQName("checkLogin","http://service/"));
    request.addMethodArgument("username","",username);
    request.addMethodArgument("password","",password);
    http->setAction("");
    http->submitRequest(request, QString("/datacheckService"));
}
请求soap消息如下所示:

<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsd="http://www.w3.org/1999/XMLSchema">
    <SOAP-ENV:Body xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
        <checkLogin xmlns="http://service/">
            <username xsi:type="xsd:string" xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance">4444</username>
            <password xsi:type="xsd:string" xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance">4444</password>
        </checkLogin>
    </SOAP-ENV:Body>
</SOAP-ENV:Envelope>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsd="http://www.w3.org/1999/XMLSchema">
    <SOAP-ENV:Body xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
        <checkLogin xmlns="http://service/">
            <username xmlns="" xsi:type="xsd:string" xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance">4444</username>
            <password xmlns="" xsi:type="xsd:string" xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance">4444</password>
        </checkLogin>
    </SOAP-ENV:Body>
</SOAP-ENV:Envelope>

4444
4444
服务器没有检测到用户名和密码标记,因为它们具有错误的命名空间

问题是用户名和密码应该获得一个属性:xmlns:=“”,而不是没有名称空间。因为没有名称空间意味着它们接管其父级的名称空间

我的请求应该是这样的:

<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsd="http://www.w3.org/1999/XMLSchema">
    <SOAP-ENV:Body xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
        <checkLogin xmlns="http://service/">
            <username xsi:type="xsd:string" xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance">4444</username>
            <password xsi:type="xsd:string" xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance">4444</password>
        </checkLogin>
    </SOAP-ENV:Body>
</SOAP-ENV:Envelope>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsd="http://www.w3.org/1999/XMLSchema">
    <SOAP-ENV:Body xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
        <checkLogin xmlns="http://service/">
            <username xmlns="" xsi:type="xsd:string" xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance">4444</username>
            <password xmlns="" xsi:type="xsd:string" xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance">4444</password>
        </checkLogin>
    </SOAP-ENV:Body>
</SOAP-ENV:Envelope>

4444
4444

关于如何使用qtsoap代码实现这一点,有什么想法吗?

问题出在qtsoap代码中

只需搜索qtsoap源代码中应将xmlns=”“添加到soap消息的位置 并编辑if构造,以便在字符串为“”时也添加它

为我解决了这个问题


如果你想知道消息来源:给我发个短信,我会发出去的

嗨,伯蒂,我也有同样的问题!你有解决这个问题的代码吗?您好,我已经解决了部分问题,但我对结果从来都不是很满意。所以我转而使用phonegap来构建我的应用程序。试试看:我没有代码来解决这个问题了(很久以前就删除了)