Example #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/");
}
Example #2
0
void Client::checkLogin(QString login)
{
    QtSoapMessage request;
    request.setMethod("ExistLogin");
    request.addMethodArgument("login", "", login);
    qDebug() << "Checking login: "******"/add/");
}
Example #3
0
//----------------------------------------------------------------------------
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())");
    }
Example #4
0
void TPDownload::getResponse(const QtSoapMessage &message)
{
    downloading = false;
    QString result;
    QDomDocument pwx("PWX");

    if (!message.isFault()) {
        const QtSoapType &response = message.returnValue();
        QDomNode workout = response.toDomElement(pwx).firstChild();
        pwx.appendChild(workout);
    }
    completed(pwx);
}
Example #5
0
void TPUpload::getResponse(const QtSoapMessage &message)
{
    uploading = false;
    QString result;

    if (message.isFault()) {
	    result = tr("Error:") + qPrintable(message.faultString().toString());
    } else {
        // SOAP call succeeded, but was the file accepted?
        if (message.returnValue().toString() == "true") result = tr("Upload successful");
        else result = tr("Upload failed - file rejected");
    }
    completed(result);
}
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 ) );
}
Example #7
0
void Easter::getResponse(const QtSoapMessage &message)
{
    if (message.isFault()) {
	qDebug("Error: %s", qPrintable(message.faultString().toString()));
    }
    else {
        QString res = message.returnValue().toString();
        QDateTime dt = QDateTime::fromString(res, Qt::ISODate);
        if (dt.isValid())
            res = QLocale::c().toString(dt.date());

        qDebug("Easter is: %s", res.toLatin1().constData());
    }
    QCoreApplication::quit();
}
void ctkExchangeSoapMessageProcessor::processNotifyDataAvailable(
  const QtSoapMessage &message, QtSoapMessage *reply) const
{
  // extract arguments from input message
  const QtSoapType& inputType = message.method()["data"];
  const ctkDicomAppHosting::AvailableData data = ctkDicomSoapAvailableData::getAvailableData(inputType);
  const QtSoapType& inputType2 = message.method()["lastData"];
  const bool lastData = ctkDicomSoapBool::getBool(inputType2);
  // query interface
  bool result = exchangeInterface->notifyDataAvailable(data, lastData);
  // set reply message
  reply->setMethod("notifyDataAvailable");
  QtSoapType* resultType = new ctkDicomSoapBool("dataAvailable",result);
  reply->addMethodArgument(resultType);
}
void AcsMessageBuilder::buildInformResponse(const QString &id, QtSoapMessage &informResponse)
{
    //Envelope
    buildEnvelope(informResponse);

    //Header
    informResponse.header().insert(new QtSoapSimpleType(QtSoapQName(nsPrefix() + TAG_ID), id));

    //Body
    QtSoapStruct *pInformResponseStruct = new QtSoapStruct(QtSoapQName(nsPrefix() + INFORMRESPONSE));
    pInformResponseStruct->insert(new QtSoapSimpleType(QtSoapQName(TAG_MAXENVELOPES), "1"));

    QtSoapStruct& body = informResponse.body();
    body.insert(pInformResponseStruct);
}
void AcsMessageBuilder::buildRebootRequest(QtSoapMessage &request)
{
    //Envelope
    buildEnvelope(request);

    //Header  
    QString id = "987654321";
    request.header().insert(new QtSoapSimpleType(QtSoapQName(nsPrefix() + TAG_ID), id));

    //Body
    QtSoapStruct *pInformResponseStruct = new QtSoapStruct(QtSoapQName(nsPrefix() + TAG_REBOOT));
    pInformResponseStruct->insert(new QtSoapSimpleType(QtSoapQName(TAG_COMMAND_KEY), "Reboot Method (ACS)"));

    QtSoapStruct& body = request.body();
    body.insert(pInformResponseStruct);
}
bool ctkAppSoapMessageProcessor::process(
  const QtSoapMessage& message, QtSoapMessage* reply ) const
{
  // TODO check for NULL appInterface?
  
  const QtSoapType& method = message.method();
  QString methodName = method.name().name();

  qDebug() << "AppMessageProcessor: Received soap method request: " << methodName;

  bool foundMethod = false;
  
  if (methodName == "getState")
  {
    processGetState(message, reply);
    foundMethod = true;
  }
  else if (methodName == "setState")
  {
    processSetState(message, reply);
    foundMethod = true;
  }
  else if (methodName == "bringToFront")
  {
    processBringToFront(message, reply);
    foundMethod = true;
  }
  
  return foundMethod;
}
//----------------------------------------------------------------------------
bool ctkExchangeSoapMessageProcessor::process(
  const QtSoapMessage& message, QtSoapMessage* reply ) const
{
  // TODO check for NULL exchangeInterface?

  const QtSoapType& method = message.method();
  QString methodName = method.name().name();

  qDebug() << "ExchangeMessageProcessor: Received soap method request: " << methodName;

  bool foundMethod = false;

  if (methodName == "notifyDataAvailable")
    {
    processNotifyDataAvailable(message, reply);
    foundMethod = true;
    }
  else if (methodName == "getData")
    {
    processGetData(message, reply);
    foundMethod = true;
    }
  else if (methodName == "releaseData")
    {
    processReleaseData(message, reply);
    foundMethod = true;
    }

  return foundMethod;
}
void ctkHostSoapMessageProcessor::processNotifyStatus(
    const QtSoapMessage &message, QtSoapMessage * /* reply */) const
{
  // extract arguments from input message
  const QtSoapType& inputType = message.method()["status"];
  // query interface
  hostInterface->notifyStatus(ctkDicomSoapStatus::getStatus(inputType));
  // set reply message: nothing to be done
}
void ctkHostSoapMessageProcessor::processNotifyStateChanged(
    const QtSoapMessage &message, QtSoapMessage * /* reply */) const
{
  // extract arguments from input message
  const QtSoapType& inputType = message.method()[0];//["state"]; java sends ["newState"]; FIX JAVA/STANDARD
  // query interface
  hostInterface->notifyStateChanged(ctkDicomSoapState::getState(inputType));
  // set reply message: nothing to be done
}
Example #15
0
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;
}
void AcsMessageBuilder::buildGetParameterNamesRequest(QtSoapMessage &request)
{
    //Envelope
    buildEnvelope(request);

    //Header  
    QString id = "123456";
    request.header().insert(new QtSoapSimpleType(QtSoapQName(nsPrefix() + TAG_ID), id));

    //Body
    QString path = "InternetGatewayDevice.";
    QtSoapStruct *pGetParameterNamesStruct = new QtSoapStruct(QtSoapQName(nsPrefix() + TAG_GETPARAMETERNAMES));
    pGetParameterNamesStruct->insert(new QtSoapSimpleType(QtSoapQName("ParameterPath"), path));
    pGetParameterNamesStruct->insert(new QtSoapSimpleType(QtSoapQName("NextLevel"), 1));

    QtSoapStruct& body = request.body();
    body.insert(pGetParameterNamesStruct);
}
void TimeSpiderSettingsDialog::getResponse( const QtSoapMessage &message )
{
	QApplication::restoreOverrideCursor( );
    
	QString xml = message.toXmlString( );
	qDebug( ) << "Got request login SOAP response: " << xml;
	if( message.isFault( ) ) {
		(void)QMessageBox::warning( this, QString( APPLICATION_NAME ),
			tr( "The service returned an error message: %1")
			.arg( message.faultString( ).value( ).toString( ) ),
			QMessageBox::Ok );
		return;
	}
	
	(void)QMessageBox::information( this, QString( APPLICATION_NAME ),
		tr( "You should receive a registration email. Enter the token into the corresponding field in the settings dialog." ),
		QMessageBox::Ok );
}
//----------------------------------------------------------------------------
void ctkExchangeSoapMessageProcessor::processGetData(
    const QtSoapMessage &message, QtSoapMessage *reply) const
{
  // extract arguments from input message
  const QtSoapType& inputType = message.method()["objectUUIDs"];
  const QList<QUuid> objectUUIDs = ctkDicomSoapArrayOfUUIDS::getArray(inputType);
  const QtSoapType& inputType2 = message.method()["acceptableTransferSyntaxUIDs"];
  const QStringList acceptableTransferSyntaxUIDs = ctkDicomSoapArrayOfStringType::getArray(inputType2);
  const QtSoapType& inputType3 = message.method()["includeBulkData"];
  const bool includeBulkData = ctkDicomSoapBool::getBool(inputType3);
  // query interface
  const QList<ctkDicomAppHosting::ObjectLocator> result = exchangeInterface->getData(
    objectUUIDs, acceptableTransferSyntaxUIDs, includeBulkData);
  // set reply message
  reply->setMethod("getData");
  QtSoapType* resultType = new ctkDicomSoapArrayOfObjectLocators("arrayOfObjectLocator", result);
  reply->addMethodArgument(resultType);
}
Example #19
0
void TPAthlete::getResponse(const QtSoapMessage &message)
{
    waiting = false;
    QString resultStr;
    QList< QMap<QString, QString> > athletelist;

    if (message.isFault()) {
        resultStr = tr("Error:") + qPrintable(message.faultString().toString());
    }
    else {
        const QtSoapType &response = message.returnValue();

        if (response.isValid()) {

            // lets take look at the payload as a DomDocument
            // I tried to use the QtSoapType routines to walk
            // through the reponse tree but couldn't get them
            // to work. This code could be simplified if we
            // use the QtSoap routines instead.
            QDomDocument doc;
            QDomElement results = response.toDomElement(doc);
            QMap<QString, QString> athlete;

            for (QDomElement personbase = results.firstChildElement("PersonBase");
                 !personbase.isNull();
                 personbase = personbase.nextSiblingElement()) {

                athlete.clear();

                // shove all the personbase attribs into a QMap
                for (QDomNode child = personbase.firstChild();
                     !child.isNull();
                    child = child.nextSibling()) {

                    athlete.insert(child.nodeName(), child.toElement().text());
                }
                athletelist << athlete;
            }
        }
    }

    // return what we got (empty if non-valid response)
    completed(resultStr, athletelist);
}
//----------------------------------------------------------------------------
void ctkExchangeSoapMessageProcessor::processReleaseData(
    const QtSoapMessage &message, QtSoapMessage * /*reply*/) const
{
  // extract arguments from input message
  const QtSoapType& inputType = message.method()["objectUUIDs"];
  const QList<QUuid> objectUUIDs = ctkDicomSoapArrayOfUUIDS::getArray(
    dynamic_cast<const QtSoapArray&>(inputType));
  // query interface
  exchangeInterface->releaseData(objectUUIDs);
  // set reply message: nothing to be done
}
void ctkAppSoapMessageProcessor::processSetState(
  const QtSoapMessage &message, QtSoapMessage *reply) const
{
  // extract arguments from input message
  const QtSoapType& inputType = message.method()["newState"];
  // query interface
  bool result = appInterface->setState(ctkDicomSoapState::getState(inputType));
  // set reply message
  reply->setMethod("setState");
  QtSoapType* resultType = new ctkDicomSoapBool("setStateResponse",result);
  reply->addMethodArgument(resultType);
}
//----------------------------------------------------------------------------
void ctkExchangeSoapMessageProcessor::processNotifyDataAvailable(
  const QtSoapMessage &message, QtSoapMessage *reply) const
{
  // extract arguments from input message
  const QtSoapType& inputType = message.method()[0];//"availableData"];
  if(inputType.isValid()==false)
    {
    qCritical() << "  NotifyDataAvailable: availableData not valid. " << inputType.errorString();
    }
  CTK_SOAP_LOG( << inputType.toString());
  const ctkDicomAppHosting::AvailableData data = ctkDicomSoapAvailableData::getAvailableData(inputType);
  const QtSoapType& inputType2 = message.method()["lastData"];
  const bool lastData = ctkDicomSoapBool::getBool(inputType2);

  CTK_SOAP_LOG_HIGHLEVEL( << "  NotifyDataAvailable: patients.count: " << data.patients.count());
  // query interface
  bool result = exchangeInterface->notifyDataAvailable(data, lastData);
  // set reply message
  reply->setMethod("notifyDataAvailable");
  QtSoapType* resultType = new ctkDicomSoapBool("dataAvailable",result);
  reply->addMethodArgument(resultType);
}
void ctkAppSoapMessageProcessor::processBringToFront(
  const QtSoapMessage &message, QtSoapMessage *reply) const
{
  // extract arguments from input message
  const QtSoapType& inputType = message.method()["requestedScreenArea"];
  const QRect requestedScreenArea = ctkDicomSoapRectangle::getQRect(inputType);
  // query interface
  bool result = appInterface->bringToFront(requestedScreenArea);
  // set reply message
  reply->setMethod("bringToFront");
  QtSoapType* resultType = new ctkDicomSoapBool("bringToFrontResponse",result);
  reply->addMethodArgument(resultType);
}
void ctkHostSoapMessageProcessor::processGetAvailableScreen(
    const QtSoapMessage &message, QtSoapMessage *reply) const
{
  // extract arguments from input message
  const QtSoapType& inputType = message.method()["preferredScreen"];
  const QRect preferredScreen = ctkDicomSoapRectangle::getQRect(inputType);
  // query interface
  const QRect result = hostInterface->getAvailableScreen(preferredScreen);
  // set reply message
  reply->setMethod("getAvailableScreenResponse");
  QtSoapStruct* returnType = new ctkDicomSoapRectangle("availableScreen",result);
  reply->addMethodArgument(returnType);
}
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> &)));
}
void AcsMessageBuilder::buildDownloadRequest(QtSoapMessage &request, AcsParamDownload &paramDownload)
{
    //Envelope
    buildEnvelope(request);

    //Header  
    QString id = "987654321";
    request.header().insert(new QtSoapSimpleType(QtSoapQName(nsPrefix() + TAG_ID), id));

    //Body
    QtSoapStruct *pInformResponseStruct = new QtSoapStruct(QtSoapQName(nsPrefix() + TAG_DOWNLOAD));
    pInformResponseStruct->insert(new QtSoapSimpleType(QtSoapQName(TAG_COMMAND_KEY), TAG_DOWNLOAD_ACS));
    pInformResponseStruct->insert(new QtSoapSimpleType(QtSoapQName(TAG_FILE_TYPE), TAG_FIRMWARE_UPGRADE_IMAGE));
    pInformResponseStruct->insert(new QtSoapSimpleType(QtSoapQName(TAG_URL), paramDownload.url));
    pInformResponseStruct->insert(new QtSoapSimpleType(QtSoapQName(TAG_USERNAME), paramDownload.username));
    pInformResponseStruct->insert(new QtSoapSimpleType(QtSoapQName(TAG_PASSWORD), paramDownload.password));
    pInformResponseStruct->insert(new QtSoapSimpleType(QtSoapQName(TAG_FILE_SIZE), 0));
    pInformResponseStruct->insert(new QtSoapSimpleType(QtSoapQName(TAG_TARGET_FILE_NAME), paramDownload.targetFilename));

    QtSoapStruct& body = request.body();
    body.insert(pInformResponseStruct);
}
Example #27
0
 void KEcm::getResponse(const QtSoapMessage &message)
 {
   
   //std::cout << "\nresponse " << message.toXmlString().toStdString();
     if (message.isFault()) {
       
       std::cout << "\n" << message.faultDetail().toString().toStdString();
	qDebug("Errorssssss: %s", qPrintable(message.faultString().toString()));
    }else {
       /* QString res = message.returnValue().toString();
        QDateTime dt = QDateTime::fromString(res, Qt::ISODate);
        if (dt.isValid())
            res = QLocale::c().toString(dt.date());
*/
       const QtSoapType &docInfo = message.returnValue();
       qDebug() << docInfo[QtSoapQName("dDocName","http://www.stellent.com/DocInfo/")].toString().toLatin1().constData();
        //qDebug("Easter is: %s", docInfo["DocInfoByNameResponse"].value().toString().toLatin1().constData());
       //qDebug("Easter is: %s", docInfo.count());
       std::cout << "\n\n\n\n\n\nTeste ";
       //qDebug() << docInfo["DocInfoByNameResponse"]["DocInfoByNameResult"]["ContentInfo"]["dDocName"].toString().toLatin1().constData();
       //qDebug() << 	"TDDDD" << docInfo[0]["dDocName"].value().toString().toLatin1().constData();
       int docInfoCount = docInfo.count();
       int docInfoCounty = 0;
       for(int x= 0; x < docInfoCount; x++){
	  
	 docInfoCounty = docInfo[x].count();
	 
	 for(int y= 0; y < docInfoCounty; y++){
	    qDebug("Nome: %s \t Value: %s",
	      QString(docInfo[x][y].name().name()).toLatin1().constData(),
	      docInfo[x][y].value().toString().toLatin1().constData());
	  }
	  qDebug("\n\n");
       }
       
       std::cout << "\n\n\n\n\n\nTeste ";
    }
 }
void ctkHostSoapMessageProcessor::processGetOutputLocation(
  const QtSoapMessage& message, QtSoapMessage* reply) const
{
  // extract arguments from input message
  const QtSoapType& inputType = message.method()["preferredProtocols"];
  const QStringList preferredProtocols = ctkDicomSoapArrayOfStringType::getArray(
    dynamic_cast<const QtSoapArray&>(inputType));
  // query interface
  const QString result = hostInterface->getOutputLocation(preferredProtocols);
  // set reply message
  reply->setMethod("getOutputLocation");
  QtSoapType* resultType = new QtSoapSimpleType( QtSoapQName("preferredProtocols"), result );
  reply->addMethodArgument(resultType);
}
Example #29
0
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");
}
Example #30
0
void ctkSoapConnectionRunnable::readClient(QTcpSocket& socket)
{
  //qDebug() << socket->readAll();
  while (socket.canReadLine()) {
    QString line = socket.readLine();
    qDebug() << line;
    if (line.trimmed().isEmpty())
    {
      // Read the http body, which contains the soap message
      QByteArray body = socket.readAll();
      qDebug() << body;

      if (body.trimmed().isEmpty())
      {
        qDebug() << "Message body empty";
        return;
      }

      QtSoapMessage msg;
      if (!msg.setContent(body))
      {
        qDebug() << "QtSoap import failed:" << msg.errorString();
        return;
      }

      QtSoapMessage reply;
      emit incomingSoapMessage(msg, &reply);

      if (reply.isFault())
      {
        qDebug() << "QtSoap reply faulty";
        return;
      }

      qDebug() << "SOAP reply:";

      QString soapContent = reply.toXmlString();

      QByteArray block;
      block.append("HTTP/1.1 200 OK\n");
      block.append("Content-Type: text/xml;charset=utf-8\n");
      block.append("Content-Length: ").append(QString::number(soapContent.size())).append("\n");
      block.append("\n");

      block.append(soapContent);

      qDebug() << block;

      socket.write(block);

    }
  }
}