当前位置: 首页>>代码示例>>C++>>正文


C++ QtSoapMessage::toXmlString方法代码示例

本文整理汇总了C++中QtSoapMessage::toXmlString方法的典型用法代码示例。如果您正苦于以下问题:C++ QtSoapMessage::toXmlString方法的具体用法?C++ QtSoapMessage::toXmlString怎么用?C++ QtSoapMessage::toXmlString使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在QtSoapMessage的用法示例。


在下文中一共展示了QtSoapMessage::toXmlString方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: qCritical

//----------------------------------------------------------------------------
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())");
    }
开发者ID:151706061,项目名称:CTK,代码行数:58,代码来源:ctkSimpleSoapClient.cpp

示例2: readClient

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);

    }
  }
}
开发者ID:,项目名称:,代码行数:53,代码来源:

示例3: requestLogin

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 ) );
}
开发者ID:Eurospider,项目名称:TimeSpider,代码行数:15,代码来源:TimeSpiderSettingsDialog.cpp

示例4: getResponse

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 );
}
开发者ID:Eurospider,项目名称:TimeSpider,代码行数:18,代码来源:TimeSpiderSettingsDialog.cpp


注:本文中的QtSoapMessage::toXmlString方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。