コード例 #1
0
void Client::createUser(QString login, QString pass){
    QtSoapMessage request;
    request.setMethod("CreateUser");
    request.addMethodArgument("login", "", login);
    request.addMethodArgument("pass", "", pass);
    qDebug() << "Checking login: "******"/add/");
}
コード例 #2
0
ファイル: dao.cpp プロジェクト: Awesomez/SdustFlux
void dao::setMethod(QString method, QString authCodee) {
    QtSoapMessage request;
    request.setMethod(method, "http://public.qdkt.net.cn/public");
    request.addMethodArgument("Account", "", iaccount);
    if(method=="GetPassport")
        request.addMethodArgument("Password", "",authCodee);
    else
        request.addMethodArgument("AuthCode", "", authCodee);
    request.addMethodArgument("Flag", "true", true);
    request.addMethodArgument("Errmessage", "", "1");
    soap->setHost("10.200.255.0", 8080);
    soap->setAction("http://public.qdkt.net.cn/public/" + method);
    soap->submitRequest(request, "/public/pub.asmx");
}
コード例 #3
0
void Client::checkLogin(QString login)
{
    QtSoapMessage request;
    request.setMethod("ExistLogin");
    request.addMethodArgument("login", "", login);
    qDebug() << "Checking login: "******"/add/");
}
コード例 #4
0
ファイル: ctkSimpleSoapClient.cpp プロジェクト: 151706061/CTK
//----------------------------------------------------------------------------
const QtSoapType & ctkSimpleSoapClient::submitSoapRequest(const QString& methodName,
                                                   const QList<QtSoapType*>& soapTypes )
{
  Q_D(ctkSimpleSoapClient);

  /*QString action="\"";
  //action.append(methodName);
  action.append("\"");
  d->Http.setAction(action);*/
  QString action = "http://dicom.nema.org/PS3.19/IHostService/" + methodName;

  d->Http.setAction(action);

  CTK_SOAP_LOG( << "Submitting action " << action
                << " method " << methodName
                << " to path " << d->Path );

  QtSoapMessage request;
  //request.setMethod(QtSoapQName(methodName,"http://wg23.dicom.nema.org/"));
  request.setMethod(QtSoapQName(methodName,"http://dicom.nema.org/PS3.19" + d->Path ));
  if(!soapTypes.isEmpty())
    {
    for (QList<QtSoapType*>::ConstIterator it = soapTypes.begin();
         it < soapTypes.constEnd(); it++)
      {
      request.addMethodArgument(*it);
      CTK_SOAP_LOG( << "  Argument type added " << (*it)->typeName() << ". "
                    << " Argument name is " << (*it)->name().name() );
      }
    }
  CTK_SOAP_LOG_LOWLEVEL( << "Submitting request " << methodName);
  CTK_SOAP_LOG_LOWLEVEL( << request.toXmlString());

  d->Http.submitRequest(request, d->Path);;

  CTK_SOAP_LOG_LOWLEVEL( << "Submitted request " << methodName);

  QApplication::setOverrideCursor(QCursor(Qt::WaitCursor));

  d->BlockingLoop.exec(QEventLoop::ExcludeUserInputEvents | QEventLoop::WaitForMoreEvents);

  QApplication::restoreOverrideCursor();

  //qDebug() << "Reply error: " << reply->errorString();
  //qDebug() << reply->readAll();
  const QtSoapMessage& response = d->Http.getResponse();

  CTK_SOAP_LOG( << "Got Response." );

  if (response.isFault())
    {
    qCritical() << "ctkSimpleSoapClient: server error (response.IsFault())";
    CTK_SOAP_LOG_LOWLEVEL( << response.faultString().toString().toLatin1().constData() << endl );
    CTK_SOAP_LOG_LOWLEVEL( << response.toXmlString() );
    return response.returnValue();
    //    throw ctkRuntimeException("ctkSimpleSoapClient: server error (response.IsFault())");
    }
コード例 #5
0
void TimeSpiderSettingsDialog::requestLogin( )
{
	QtSoapMessage request;
	request.setMethod( "request-login", SERVICE_NAMESPACE );
	request.addMethodArgument( "email", "", email->text( ) );
	request.addMethodArgument( "uid", "", getMacAddress( ) );
    
	QString xml = request.toXmlString( );
	qDebug( ) << "Sending SOAP request: " << xml;

	m_soap.setHost( serviceHost->text( ), serviceUseSSL->isChecked( ), servicePort->value( ) );
	m_soap.submitRequest( request, servicePath->text( ) );

	QApplication::setOverrideCursor( QCursor( Qt::WaitCursor ) );
}
コード例 #6
0
ファイル: easter.cpp プロジェクト: BackupTheBerlios/horux-svn
Easter::Easter(short year, QObject *parent)
    : QObject(parent), http(this)
{
    connect(&http, SIGNAL(responseReady(const QtSoapMessage &)),
            this, SLOT(getResponse(const QtSoapMessage &)));

    QtSoapMessage request;
    request.setMethod("GetEaster",
		      "http://www.27seconds.com/Holidays/US/Dates/");
    request.addMethodArgument("year", "", year);

    http.setHost("www.27seconds.com");
    http.setAction("http://www.27seconds.com/Holidays/US/Dates/GetEaster");
    http.submitRequest(request, "/Holidays/US/Dates/USHolidayDates.asmx");

    qDebug("Looking up the date of easter in %i...", year);
    this->year = year;
}
コード例 #7
0
void
QtShanoirWebService::run()
{
    d->requestSuccess = true;
    QtSoapMessage request;
    request.setMethod(d->WsMethod, d->WsImpl);

    for (int i = 0; i < d->argname.count(); ++i)
        request.addMethodArgument(d->argname.at(i), "", d->argval.at(i));

    // Submit the request the the web service.
    QString host = QtShanoirSettings::Instance()->host();
    QString port = QtShanoirSettings::Instance()->port();

    d->http.setHost(host, true, port.toInt()); // set secure connection and port

    d->http.setAction(QString("https://%1//Shanoir-Shanoir/%2").arg(host).arg(d->WebService));
    d->http.submitRequest(d->req, request, "//Shanoir-Shanoir/" + d->WebService);

    QNetworkReply *nrep = d->http.networkReply();
    connect(nrep, SIGNAL(sslErrors ( const QList<QSslError> & )), this, SLOT(sslErrors ( const QList<QSslError> &)));
}
コード例 #8
0
void HDeviceHostHttpServer::incomingControlRequest(
    HMessagingInfo* mi, const HInvokeActionRequest& invokeActionRequest)
{
    HLOG2(H_AT, H_FUN, m_loggingIdentifier);

    HLOG_DBG(QString("Control message to [%1] received.").arg(
        invokeActionRequest.soapAction()));

    QUuid udn = extractUdn(invokeActionRequest.serviceUrl());

    HServerDevice* device =
        !udn.isNull() ? m_deviceStorage.searchDeviceByUdn(HUdn(udn), AllDevices) : 0;

    HServerService* service = 0;

    if (!device)
    {
        // the request did not have the UDN prefix, which means that either
        // 1) the request was for a ControlURL that was defined as an absolute URL
        //    in the device description or
        // 2) the request is invalid

        service = m_deviceStorage.searchServiceByControlUrl(
            invokeActionRequest.serviceUrl());

        if (!service)
        {
            HLOG_WARN(QString(
                "Ignoring invalid action invocation to: [%1].").arg(
                    invokeActionRequest.serviceUrl().toString()));

            mi->setKeepAlive(false);

            m_httpHandler->send(mi, HHttpMessageCreator::createResponse(
                BadRequest, *mi));

            return;
        }
    }
    else if (!service)
    {
        service = m_deviceStorage.searchServiceByControlUrl(
            device, extractRequestExludingUdn(invokeActionRequest.serviceUrl()));
    }

    if (!service)
    {
        HLOG_WARN(QString("Ignoring invalid action invocation to: [%1].").arg(
            invokeActionRequest.serviceUrl().toString()));

        mi->setKeepAlive(false);

        m_httpHandler->send(mi, HHttpMessageCreator::createResponse(
            BadRequest, *mi));

        return;
    }

    const QtSoapMessage* soapMsg = invokeActionRequest.soapMsg();
    const QtSoapType& method = soapMsg->method();
    if (!method.isValid())
    {
        HLOG_WARN("Invalid control method.");

        mi->setKeepAlive(false);

        m_httpHandler->send(mi, HHttpMessageCreator::createResponse(
            BadRequest, *mi));

        return;
    }

    HServerAction* action = service->actions().value(method.name().name());

    if (!action)
    {
        HLOG_WARN(QString("The service has no action named [%1].").arg(
            method.name().name()));

        mi->setKeepAlive(false);
        m_httpHandler->send(mi, HHttpMessageCreator::createResponse(
            *mi, UpnpInvalidArgs, soapMsg->toXmlString()));

        return;
    }

    HActionArguments iargs = action->info().inputArguments();
    HActionArguments::iterator it = iargs.begin();
    for(; it != iargs.end(); ++it)
    {
        HActionArgument iarg = *it;

        const QtSoapType& arg = method[iarg.name()];
        if (!arg.isValid())
        {
            mi->setKeepAlive(false);
            m_httpHandler->send(mi, HHttpMessageCreator::createResponse(
                *mi, UpnpInvalidArgs, soapMsg->toXmlString()));

            return;
        }

        if (!iarg.setValue(
                HUpnpDataTypes::convertToRightVariantType(
                    arg.value().toString(), iarg.dataType())))
        {
            mi->setKeepAlive(false);
            m_httpHandler->send(mi, HHttpMessageCreator::createResponse(
                *mi, UpnpInvalidArgs, soapMsg->toXmlString()));

            return;
        }
    }

    HActionArguments outArgs = action->info().outputArguments();
    qint32 retVal = action->invoke(iargs, &outArgs);
    if (retVal != UpnpSuccess)
    {
        mi->setKeepAlive(false);
        m_httpHandler->send(mi, HHttpMessageCreator::createResponse(
            *mi, retVal, soapMsg->toXmlString()));

        return;
    }

    QtSoapNamespaces::instance().registerNamespace(
        "u", service->info().serviceType().toString());

    QtSoapMessage soapResponse;
    soapResponse.setMethod(QtSoapQName(
        QString("%1%2").arg(action->info().name(), "Response"),
        service->info().serviceType().toString()));

    foreach(const HActionArgument& oarg, outArgs)
    {
        QtSoapType* soapArg =
            new SoapType(oarg.name(), oarg.dataType(), oarg.value());

        soapResponse.addMethodArgument(soapArg);
    }
コード例 #9
0
void CGantnerTime::checkDb()
{

    timerCheckDb->stop();

    QStringList ids;

    QMapIterator<int, bool> i(devices);
    while (i.hasNext())
    {
        i.next();

        if(i.value())
        {
            QSqlQuery query("SELECT * FROM hr_gantner_standalone_action WHERE deviceId=" + QString::number(i.key()) + " ORDER BY id" );
            while(query.next())
            {
                QString id = query.value(0).toString();
                QString type = query.value(1).toString();
                QString func = query.value(2).toString();
                QString deviceId = QString::number(i.key());
                QString userId = query.value(3).toString();
                QString keyId = query.value(4).toString();
                QString param = query.value(6).toString();
                QString param2 = query.value(7).toString();
                QString param3 = query.value(8).toString();
                QString reasonId = query.value(9).toString();

                if(type == "user")
                {
                    QMap<QString, QString> p;
                    QString f = func == "add" ? "addUser" : "removeUser" ;
                    p["userId"] = userId;
                    p["userNo"] = userId;
                    p["displayName"] = param;
                    p["lang"] = param2;
                    p["fiuUse"] = "0";

                    if(param3 == "")
                        p["attendanceStatus"] = "2";
                    else
                        p["attendanceStatus"] = param3;

                    QString xmlFunc = CXmlFactory::deviceAction( deviceId ,f, p);
                    emit accessAction(xmlFunc);
                }

                if(type == "key")
                {
                    QMap<QString, QString> p;
                    QString f = func == "add" ? "addKey" : "removeKey" ;
                    p["userId"] = userId;
                    p["key"] = param;
                    p["keyType"] = "01";
                    QString xmlFunc = CXmlFactory::deviceAction( deviceId, f, p);
                    emit accessAction(xmlFunc);
                }

                if(type == "key_user")
                {
                    QMap<QString, QString> p2;
                    QString f2 = func == "add" ? "addUser" : "removeUser" ;
                    p2["userId"] = userId;
                    p2["userNo"] = userId;
                    p2["displayName"] = param;
                    p2["lang"] = param2;
                    p2["fiuUse"] = "0";
                    p2["attendanceStatus"] = "2";

                    QString xmlFunc2 = CXmlFactory::deviceAction( deviceId ,f2, p2);
                    emit accessAction(xmlFunc2);

                    QMap<QString, QString> p;
                    QString f = func == "add" ? "addKey" : "removeKey" ;
                    p["userId"] = userId;
                    p["key"] = param3;
                    p["keyType"] = "01";

                    QString xmlFunc = CXmlFactory::deviceAction( deviceId ,f, p);
                    emit accessAction(xmlFunc);

                }

                if(type == "reason")
                {
                    QMap<QString, QString> p;
                    QString f = func == "add" ? "addAbsentReason" : "removeAbsentReason" ;
                    p["reasonId"] = reasonId;
                    p["text"] = param;
                    p["status"] = param2;
                    p["group"] = param2 == "1" ? "IN" : "OUT";
                    QString xmlFunc = CXmlFactory::deviceAction( deviceId, f, p);
                    emit accessAction(xmlFunc);

                }

                if(type == "balances")
                {
                    QMap<QString, QString> p;
                    QString f = "addUserBalances";
                    p["userId"] = userId;
                    p["balances"] = param;
                    QString xmlFunc = CXmlFactory::deviceAction( deviceId, f, p);
                    emit accessAction(xmlFunc);

                }

                if(type == "balancesText")
                {
                    QMap<QString, QString> p;
                    QString f = "setBalanceText";
                    p["fieldNo"] = param;
                    p["text"] = param2;
                    QString xmlFunc = CXmlFactory::deviceAction( deviceId, f, p);
                    emit accessAction(xmlFunc);

                }

                if(type == "reinit")
                {
                    QMap<QString, QString> p;
                    QString f = "reinit";
                    QString xmlFunc = CXmlFactory::deviceAction( deviceId, f, p);
                    emit accessAction(xmlFunc);
                }

                if(type == "load") {
                    QMap<QString, QString> p;
                    QString f = func == "add" ? "addBDEData" : "removeBDEData";

                    if(func == "add") {
                        p["BDEfieldNo"] = param;
                        p["value"] = param2;
                        p["valueText"] = param3;
                    } else {
                        p["BDEfieldNo"] = param;
                        p["value"] = param2;
                    }
                    QString xmlFunc = CXmlFactory::deviceAction( deviceId, f, p);
                    emit accessAction(xmlFunc);
                }

                ids << id;
            }

            if(saas && ids.count()>0)
            {
                QtSoapMessage message;
                message.setMethod("callServiceComponent");

                QtSoapArray *array = new QtSoapArray(QtSoapQName("params"));

                array->insert(0, new QtSoapSimpleType(QtSoapQName("component"),"timuxadmin"));
                array->insert(1, new QtSoapSimpleType(QtSoapQName("class"),"timuxAdminDevice"));
                array->insert(2, new QtSoapSimpleType(QtSoapQName("function"),"syncStandalone"));
                array->insert(3, new QtSoapSimpleType(QtSoapQName("params"),ids.join(",")));

                message.addMethodArgument(array);

                soapClient.submitRequest(message, saas_path+"/index.php?soap=soapComponent&password="******"&username="******"DELETE FROM hr_gantner_standalone_action WHERE deviceId=" + QString::number(i.key()) );
                timerCheckDb->start(TIME_DB_CHECKING);
            }

        }
    }

    if(!saas)
        QSqlQuery queryOptimize("OPTIMIZE TABLE hr_gantner_standalone_action");
}
コード例 #10
0
bool CGantnerTime::isAccess(QMap<QString, QVariant> params, bool, bool )
{
    QString userId = params["userId"].toString();
    QString deviceId = params["deviceId"].toString();
    QString date = params["date"].toString();
    QString time = params["time"].toString();
    QString key = params["key"].toString();
    QString code = params["code"].toString();
    QString reason = params["reason"].toString() == "" ? "0" : params["reason"].toString();

    QString keyId = "";

    QString trackingIdToCheck = "";


    if(userId == "0") {
        QSqlQuery querykey = "SELECT ka.id_user FROM hr_user AS u LEFT JOIN hr_keys_attribution AS ka ON ka.id_user=u.id LEFT JOIN hr_keys AS k ON k.id=ka.id_key  WHERE k.serialNumber='" + key + "'";
        if(querykey.next()) {
            userId = querykey.value(0).toString();
        }
        else {
            return false;
        }
    }

    // get the id of the key
    QSqlQuery querykey("SELECT id FROM hr_keys WHERE serialNumber='" + key + "'");

    if(querykey.next()) {
        keyId = querykey.value(0).toString();
    }

    if(code == "150") {

            QString BDE1 =  params["BDEValue1"].toString();
            QString BDE2 =  params["BDEValue2"].toString();
            QString BDE3 =  params["BDEValue3"].toString();
            QString BDE4 =  params["BDEValue4"].toString();
            QString BDE5 =  params["BDEValue5"].toString();
            QString BDE6 =  params["BDEValue6"].toString();
            QString BDE7 =  params["BDEValue7"].toString();
            QString BDE8 =  params["BDEValue8"].toString();
            QString BDE9 =  params["BDEValue9"].toString();
            QString BDE10 =  params["BDEValue10"].toString();
            QString BDE11 =  params["BDEValue11"].toString();
            QString BDE12 =  params["BDEValue12"].toString();
            QString BDE13 =  params["BDEValue13"].toString();
            QString BDE14 =  params["BDEValue14"].toString();
            QString BDE15 =  params["BDEValue15"].toString();
            QString BDE16 =  params["BDEValue16"].toString();
            QString BDE17 =  params["BDEValue17"].toString();
            QString BDE18 =  params["BDEValue18"].toString();
            QString BDE19 =  params["BDEValue19"].toString();
            QString BDE20 =  params["BDEValue20"].toString();

            QSqlQuery bookquery("INSERT INTO `hr_timux_booking_bde` ( `user_id` , `device_id`, `date`, `time`, `code`, `BDE1`, `BDE2`, `BDE3`, `BDE4`, `BDE5`, `BDE6`, `BDE7`, `BDE8`, `BDE9`, `BDE10`, `BDE11`, `BDE12`, `BDE13`, `BDE14`, `BDE15`, `BDE16`, `BDE17`, `BDE18`, `BDE19`, `BDE20` ) VALUES (" +
                        userId +
                        "," +
                        deviceId +
                        ",'" +
                        date +
                        "','" +
                        time +
                        "','" +
                        code +
                        "','" +
                        BDE1 +
                        "','" +
                        BDE2 +
                        "','" +
                        BDE3 +
                        "','" +
                        BDE4 +
                        "','" +
                        BDE5 +
                        "','" +
                        BDE6 +
                        "','" +
                        BDE7 +
                        "','" +
                        BDE8 +
                        "','" +
                        BDE9 +
                        "','" +
                        BDE10 +
                        "','" +
                        BDE11 +
                        "','" +
                        BDE12 +
                        "','" +
                        BDE13 +
                        "','" +
                        BDE14 +
                        "','" +
                        BDE15 +
                        "','" +
                        BDE16 +
                        "','" +
                        BDE17 +
                        "','" +
                        BDE18 +
                        "','" +
                        BDE19 +
                        "','" +
                        BDE20 +
                        "')"
                        );

            setUserPresence(userId, true);

        } else {



        // compute the round of the time
        QStringList timeSplit = time.split(":");

        QTime roundBooking ;
        QTime noRoundBooking(timeSplit.at(0).toInt(),timeSplit.at(1).toInt(),timeSplit.at(2).toInt()) ;

        QSqlQuery queryTimuxConfig("SELECT bookingRounding  FROM hr_timux_config");
        if(queryTimuxConfig.next())
        {
            int round = queryTimuxConfig.value(0).toInt();

            if(round == 0)
            {
                roundBooking = noRoundBooking;
                if(code == "255" || reason.right(3) == "_IN" || code == "155") // arrive
                {
                    setUserPresence(userId, true);
                }
                else
                {
                     if(code == "254" || reason.right(4) == "_OUT") // leave
                     {
                        setUserPresence(userId, false);
                     }
                }
            }
            else
            {
                if(round == 1)
                {
                   if(code == "255" || reason.right(3) == "_IN" || code == "155") // arrive
                   {
                        roundBooking.setHMS(noRoundBooking.hour(),noRoundBooking.minute()+1,0);
                        setUserPresence(userId, true);
                   }
                   else
                   {
                        if(code == "254" || reason.right(4) == "_OUT") // leave
                        {
                            roundBooking.setHMS(noRoundBooking.hour(),noRoundBooking.minute(),0);
                            setUserPresence(userId, false);
                        }
                   }

                }
                else
                {
                    int m = noRoundBooking.minute();
                    while(m % round != 0)
                    {
                        if(code == "255" || reason.right(3) == "_IN" || code == "155") // arrive
                        {
                            m++;                            
                        }
                        else
                        {
                            if(code == "254" || reason.right(4) == "_OUT") // leave
                            {
                                m--;
                            }
                        }
                    }

                    if(code == "255" || reason.right(3) == "_IN" || code == "155") // arrive
                    {
                        roundBooking.setHMS(noRoundBooking.hour(),m,0);
                        setUserPresence(userId, true);
                    }
                    else
                    {
                        if(code == "254" || reason.right(4) == "_OUT") // leave
                        {
                            roundBooking.setHMS(noRoundBooking.hour(),m,0);
                            setUserPresence(userId, false);
                        }
                    }
                }
            }
        }

        QString lastTrackingId;

        // this is an entry BDE
        if(code == "155") {

            // be sure the last booking was an exit. Wo have to check this. If not the case, we have to insert an exit booking with the same time than
            // this booking
            QSqlQuery lastBooking("SELECT tb.action FROM  hr_timux_booking AS tb LEFT JOIN hr_tracking AS t ON tb.tracking_id=t.id WHERE t.id_user="******" ORDER BY t.date DESC, t.time DESC, tb.tracking_id DESC LIMIT 0,1");
            if(lastBooking.next()) {
                if(lastBooking.value(0) == "255") { // last booking was an already an entry, we have to insert an exit

                    QSqlQuery query = "INSERT INTO `hr_tracking` ( `id` , `id_user` , `id_key` , `time` , `date` , `id_entry` , `is_access` , `id_comment`, `key`, `extData` ) VALUES ('', '" +
                                userId +
                                "','" +
                                keyId +
                                "', '" + time +"', '" + date +"', '" +
                                deviceId +
                                "', '" +
                                "1" +
                                "', '" +
                                "0" +
                                "', '" +
                                key +
                                "', '" +
                                "hr_timux_booking"
                                "')";

                    QSqlQuery lastTracking = "SELECT id FROM `hr_tracking` WHERE id_entry=" + deviceId + " AND id_user="******" ORDER BY id DESC LIMIT 0,1";
                    lastTracking.next();
                    QString last = lastTracking.value(0).toString();

                    QSqlQuery bookquery("INSERT INTO `hr_timux_booking` ( `tracking_id` , `action` , `actionReason`, `roundBooking` ) VALUES (" +
                                last +
                                "," +
                                "254" +
                                ",'" +
                                reason +
                                "','" +
                                roundBooking.toString("hh:mm:ss") +
                                "')"
                                );

                }

            }

            QSqlQuery query("INSERT INTO `hr_tracking` ( `id` , `id_user` , `id_key` , `time` , `date` , `id_entry` , `is_access` , `id_comment`, `key`, `extData` ) VALUES ('', '" +
                        userId +
                        "','" +
                        keyId +
                        "', '" + time +"', '" + date +"', '" +
                        deviceId +
                        "', '" +
                        "1" +
                        "', '" +
                        "0" +
                        "', '" +
                        key +
                        "', '" +
                        "hr_timux_booking"
                        "')"
                        );

            QSqlQuery lastTracking = "SELECT id FROM `hr_tracking` WHERE id_entry=" + deviceId + " AND id_user="******" ORDER BY id DESC LIMIT 0,1";
            lastTracking.next();
            lastTrackingId = lastTracking.value(0).toString();


            QString BDE1 =  params["BDEValue1"].toString();
            QString BDE2 =  params["BDEValue2"].toString();
            QString BDE3 =  params["BDEValue3"].toString();
            QString BDE4 =  params["BDEValue4"].toString();
            QString BDE5 =  params["BDEValue5"].toString();
            QString BDE6 =  params["BDEValue6"].toString();
            QString BDE7 =  params["BDEValue7"].toString();
            QString BDE8 =  params["BDEValue8"].toString();
            QString BDE9 =  params["BDEValue9"].toString();
            QString BDE10 =  params["BDEValue10"].toString();
            QString BDE11 =  params["BDEValue11"].toString();
            QString BDE12 =  params["BDEValue12"].toString();
            QString BDE13 =  params["BDEValue13"].toString();
            QString BDE14 =  params["BDEValue14"].toString();
            QString BDE15 =  params["BDEValue15"].toString();
            QString BDE16 =  params["BDEValue16"].toString();
            QString BDE17 =  params["BDEValue17"].toString();
            QString BDE18 =  params["BDEValue18"].toString();
            QString BDE19 =  params["BDEValue19"].toString();
            QString BDE20 =  params["BDEValue20"].toString();

            QSqlQuery bookquery("INSERT INTO `hr_timux_booking_bde` (  `tracking_id` , `user_id` , `device_id`, `date`, `time`, `code`, `BDE1`, `BDE2`, `BDE3`, `BDE4`, `BDE5`, `BDE6`, `BDE7`, `BDE8`, `BDE9`, `BDE10`, `BDE11`, `BDE12`, `BDE13`, `BDE14`, `BDE15`, `BDE16`, `BDE17`, `BDE18`, `BDE19`, `BDE20` ) VALUES (" +
                        lastTrackingId +
                        "," +
                        userId +
                        "," +
                        deviceId +
                        ",'" +
                        date +
                        "','" +
                        roundBooking.toString("hh:mm:ss") +
                        "','" +
                        code +
                        "','" +
                        BDE1 +
                        "','" +
                        BDE2 +
                        "','" +
                        BDE3 +
                        "','" +
                        BDE4 +
                        "','" +
                        BDE5 +
                        "','" +
                        BDE6 +
                        "','" +
                        BDE7 +
                        "','" +
                        BDE8 +
                        "','" +
                        BDE9 +
                        "','" +
                        BDE10 +
                        "','" +
                        BDE11 +
                        "','" +
                        BDE12 +
                        "','" +
                        BDE13 +
                        "','" +
                        BDE14 +
                        "','" +
                        BDE15 +
                        "','" +
                        BDE16 +
                        "','" +
                        BDE17 +
                        "','" +
                        BDE18 +
                        "','" +
                        BDE19 +
                        "','" +
                        BDE20 +
                        "')"
                        );

            code = "255";


            //check the booking if it is a valid input
            trackingIdToCheck = lastTrackingId;

        } else {

            QSqlQuery query("INSERT INTO `hr_tracking` ( `id` , `id_user` , `id_key` , `time` , `date` , `id_entry` , `is_access` , `id_comment`, `key`, `extData` ) VALUES ('', '" +
                        userId +
                        "','" +
                        keyId +
                        "', '" + time +"', '" + date +"', '" +
                        deviceId +
                        "', '" +
                        "1" +
                        "', '" +
                        "0" +
                        "', '" +
                        key +
                        "', '" +
                        "hr_timux_booking"
                        "')"
                        );

            QSqlQuery lastTracking = "SELECT id FROM `hr_tracking` WHERE id_entry=" + deviceId + " AND id_user="******" ORDER BY id DESC LIMIT 0,1";
            lastTracking.next();
            lastTrackingId = lastTracking.value(0).toString();
        }

        QSqlQuery bookquery("INSERT INTO `hr_timux_booking` ( `tracking_id` , `action` , `actionReason`, `roundBooking` ) VALUES (" +
                    lastTrackingId +
                    "," +
                    code +
                    ",'" +
                    reason +
                    "','" +
                    roundBooking.toString("hh:mm:ss") +
                    "')"
                    );

        if(trackingIdToCheck != "") {
            QtSoapMessage message;
            message.setMethod("callServiceComponent");

            QtSoapArray *array = new QtSoapArray(QtSoapQName("params"));

            array->insert(0, new QtSoapSimpleType(QtSoapQName("component"),"timuxadmin"));
            array->insert(1, new QtSoapSimpleType(QtSoapQName("class"),"timuxAdminDevice"));
            array->insert(2, new QtSoapSimpleType(QtSoapQName("function"),"checkInputBDE"));
            array->insert(3, new QtSoapSimpleType(QtSoapQName("trackingId"),lastTrackingId));

            message.addMethodArgument(array);

            soapClientInputBDE.submitRequest(message, saas_path+"/index.php?soap=soapComponent&password="******"&username="******"Check the input BDE";
        }

        checkBalances(userId.toInt());
    }

    return true;
}
コード例 #11
0
QRect ctkDicomHostInterfaceImpl::getAvailableScreen(const QRect& preferredScreen)
{
  http.setAction("GetAvailableScreen");

  QtSoapMessage request;
  request.setMethod("GetAvailableScreen");

  QtSoapStruct* preferredScreenType = new QtSoapStruct(QtSoapQName("preferredScreen"));
  preferredScreenType->insert(new QtSoapSimpleType(QtSoapQName("Height"), preferredScreen.height()));
  preferredScreenType->insert(new QtSoapSimpleType(QtSoapQName("Width"), preferredScreen.width()));
  preferredScreenType->insert(new QtSoapSimpleType(QtSoapQName("RefPointX"), preferredScreen.x()));
  preferredScreenType->insert(new QtSoapSimpleType(QtSoapQName("RefPointY"), preferredScreen.y()));

  request.addMethodArgument(preferredScreenType);

  http.submitRequest(request, "/IHostService");

  qDebug() << "Submitted request GetAvailableScreen";

  QApplication::setOverrideCursor(QCursor(Qt::WaitCursor));

  blockingLoop.exec(QEventLoop::ExcludeUserInputEvents | QEventLoop::WaitForMoreEvents);

  QApplication::restoreOverrideCursor();

  //qDebug() << "Reply error: " << reply->errorString();
  //qDebug() << reply->readAll();
  const QtSoapMessage& response = http.getResponse();

  if (response.isFault())
  {
    throw std::runtime_error("server error");
  }

  qDebug() << "Response: " << response.toXmlString();

  const QtSoapType &meth = response.method();

  if (!meth.isValid() || meth.type() != QtSoapType::Struct)
    qDebug() << "SOAP returning NIL: invalid or type != Struct";

  const QtSoapStruct &m = dynamic_cast<const QtSoapStruct &>(meth);
  if (m.count() == 0)
    qDebug() << "SOAP returning NIL: count == 0";


  const QtSoapType& screenResult = response.returnValue();
  if (!screenResult.isValid())
  {
    //throw std::runtime_error("invalid return value");
    qDebug() << response.errorString() << response.faultString().toString();
    qDebug() << response.toXmlString();
    return QRect();
  }

  qDebug() << screenResult.count() << screenResult["Height"].typeName();
  QRect resultRect;
  resultRect.setHeight(screenResult["Height"].toInt());
  resultRect.setWidth(screenResult["Width"].toInt());
  resultRect.setX(screenResult["RefPointX"].toInt());
  resultRect.setY(screenResult["RefPointY"].toInt());

  qDebug() << "x:" << resultRect.x() << " y:" << resultRect.y();

  return resultRect;
}
コード例 #12
0
ファイル: KEcm.cpp プロジェクト: cassioarmy/KEcm
KEcm::KEcm()
{  
    QLabel* l = new QLabel( this );
    l->setText( "Hello World!" );
    setCentralWidget( l );
    KAction* a = new KAction(this);
    a->setText( "Quit" );
    connect(a, SIGNAL(triggered()), SLOT(close()) );
    
      menubar = new KMenuBar;
    menubar->addMenu("File" )->addAction( a );
    
    setMenuBar(menubar);
    KAction* autenticacao = new KAction(this);
    autenticacao->setText( ki18n("&WebServices").toString() );
    connect(autenticacao, SIGNAL(triggered()), SLOT(ecmConfigure()) );
        
    menubar->addMenu( ki18n("&Configurações").toString() )->addAction( autenticacao );    
    
    connect(&http, SIGNAL(responseReady(const QtSoapMessage &)),
            this, SLOT(getResponse(const QtSoapMessage &)));
    
    connect(http.networkAccessManager(), SIGNAL(authenticationRequired(QNetworkReply*,QAuthenticator*)),
             this, SLOT(authenticationRequired(QNetworkReply*,QAuthenticator*)));
    
    QtSoapMessage request;
    
    request.setMethod("DocInfoByName", "http://www.stellent.com/DocInfo");
        
   
    request.addMethodArgument("dDocName", "http://www.stellent.com/DocInfo", "CSNOTE16200000201");
     
    // Submit the request the the web service.    
    http.setHost("csnote",false,16200);
    http.setAction("http://csnote:16200/_dav/cs/idcplg/DocInfo");
    
    http.submitRequest(request, "_dav/cs/idcplg/DocInfo?WSDL");
    //std::cout << request.toXmlString().toStdString() << "\n\n\n";
   // delete type;
    /*
    request.setMethod("GetEaster",
		      "http://www.27seconds.com/Holidays/US/Dates/");
    request.addMethodArgument("year", "", 10);

    http.setHost("www.27seconds.com");
    http.setAction("http://www.27seconds.com/Holidays/US/Dates/GetEaster");
    http.submitRequest(request, "/Holidays/US/Dates/USHolidayDates.asmx");*/
    /*
    std::cout << "tt " << request.errorString().toStdString() << endl;
    std::cout << "tt " << request.returnValue().toString().toStdString() << "\n\n" << endl;
    std::cout << request.toXmlString().toStdString() << "\n\n\n";
    
    
    
    qDebug("passou");
    
    // create and show your widgets here
    const QtSoapMessage &message = http.getResponse();
    std::cout << message.returnValue().toString().toStdString();
    // Check if the response is a SOAP Fault message
    if (message.isFault()) {
        qDebug("Error: %s", message.faultString().value().toString().toLatin1().constData());
    }
    else {
      std::cout <<  message.toXmlString().toStdString() ;
        // Get the return value, and print the result.
        const QtSoapType &response = message.returnValue();
        qDebug("%s Teste",
               response["DocInfoByNameResult"].value().toString().toLatin1().constData());
    }
    
    QUrl url("http://csnote:16200/_dav/cs/idcplg/DocInfo?WSDL");
    QNetworkRequest request(url);
    QNetworkAccessManager *qnam  = new QNetworkAccessManager(this);;
    
    
    connect(qnam, SIGNAL(finished(QNetworkReply*)),
             this, SLOT(httpFinished(QNetworkReply*)));
   connect(qnam, SIGNAL(authenticationRequired(QNetworkReply*, QAuthenticator*)),
             this, SLOT(authenticationRequired(QNetworkReply*, QAuthenticator*)));
   
   
   QByteArray arr;
   arr.append("<soapenv:Envelope xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:doc=\"http://www.stellent.com/DocInfo/\">");
   arr.append("<soapenv:Header>");
   arr.append("</soapenv:Header>");
   arr.append("<soapenv:Body>");
    arr.append("<doc:DocInfoByName>");
      arr.append("<doc:dDocName>CSNOTE16200000201</doc:dDocName>");
    arr.append("</doc:DocInfoByName>");
   arr.append("</soapenv:Body>");
   arr.append("</soapenv:Envelope>");
   
   request.setHeader(QNetworkRequest::ContentTypeHeader,"text/xml");
   
   
   qnam->post(request,arr);*/
   
}