//----------------------------------------------------------------------------
ctkDicomSoapArrayOfStringType::ctkDicomSoapArrayOfStringType(const QString& typeName,
                                                             const QString& name, const QStringList& array)
//  : QtSoapArray(QtSoapQName(name), QtSoapType::String, array.size())
  : QtSoapStruct(QtSoapQName(name))
{
	 QtSoapStruct *simpleStruct = new QtSoapStruct(QtSoapQName(typeName));
  for (QStringList::ConstIterator it = array.constBegin();
       it < array.constEnd(); it++)
    {

    simpleStruct->insert(new QtSoapSimpleType(QtSoapQName("Uid"),*it));
//    this->append(new QtSoapSimpleType(QtSoapQName(typeName),*it));
    }
  this->insert(simpleStruct);
}
Exemplo n.º 2
0
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);
}
Exemplo n.º 3
0
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);
}
//----------------------------------------------------------------------------
ctkDicomSoapObjectDescriptor::ctkDicomSoapObjectDescriptor(const QString& name,
                                                           const ctkDicomAppHosting::ObjectDescriptor& od)
  : QtSoapStruct(QtSoapQName(name))
{
  this->insert(new ctkDicomSoapUUID("DescriptorUuid",
                                    od.descriptorUUID) );

  /*this->insert(new QtSoapSimpleType(
                 QtSoapQName("MimeType"),
                 od.mimeType) );*/

  /*QStringList mimeType;
  mimeType.append(od.mimeType); 
  this->insert(new ctkDicomSoapArrayOfStringType("MimeType",
				"MimeType", 
				mimeType) );*/

	QtSoapStruct *stMimeType = new QtSoapStruct(QtSoapQName("MimeType"));
	stMimeType->insert(new QtSoapSimpleType(QtSoapQName("Type"),od.mimeType));
	this->insert(stMimeType);

  /*this->insert(new QtSoapSimpleType(
                 QtSoapQName("ClassUID"),
                 od.classUID) );*/

  this->insert(new ctkDicomSoapUID("ClassUID", od.classUID) );

  /*this->insert(new QtSoapSimpleType(
                 QtSoapQName("TransferSyntaxUID"),
                 od.transferSyntaxUID) );*/
  this->insert(new ctkDicomSoapUID("TransferSyntaxUID", od.transferSyntaxUID) );

  /*this->insert(new QtSoapSimpleType(
                 QtSoapQName("Modality"),
                 od.modality) );*/
	/*QStringList modality;
	  modality.append(od.modality); 
	  this->insert(new ctkDicomSoapArrayOfStringType("Modality",
					"Modality", 
					modality) );*/

	QtSoapStruct *structModality = new QtSoapStruct(QtSoapQName("Modality"));
	structModality->insert(new QtSoapSimpleType(QtSoapQName("Modality"),od.modality));
	this->insert(structModality);
}
Exemplo n.º 5
0
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);
}
Exemplo n.º 6
0
void
TPDownload::download(QString cyclist, int personId, int workoutId)
{
    // if currently downloading fail!
    if (downloading == true) return;

    current = QtSoapMessage();

    // setup the soap message
    QString url = appsettings->value(this, GC_TPURL, "www.trainingpeaks.com").toString();
    http.setHost("www.trainingpeaks.com");
    http.setAction("http://www.trainingpeaks.com/TPWebServices/GetExtendedWorkoutsForAccessibleAthlete");
    current.setMethod("GetExtendedWorkoutsForAccessibleAthlete", "http://www.trainingpeaks.com/TPWebServices/");
    current.addMethodArgument("username", "", appsettings->cvalue(cyclist, GC_TPUSER).toString());
    current.addMethodArgument("password", "", appsettings->cvalue(cyclist, GC_TPPASS).toString());
    current.addMethodArgument("personId", "", personId);

    QtSoapStruct *ints = new QtSoapStruct; // gets taken over by message and free'd there
    // if you pass a pointer it all goes boom!

    // create a little snippit: <workoutIds><int>xx</int></workoutIds>
    QDomDocument meh;
    QDomNode workoutIds = meh.createElement("workoutIds");
    QDomElement elint = meh.createElement("int");
    QDomText text = meh.createTextNode(QString("%1").arg(workoutId));
    elint.appendChild(text);
    workoutIds.appendChild(elint);

    // turn it into the QtSoapStruct needed by the QtSoapMessage
    ints->parse(workoutIds);

    // add as method arguments
    current.addMethodArgument(ints);

    // do it!
    downloading = true;

    http.submitRequest(current, "/tpwebservices/service.asmx");
    return;
}
Exemplo n.º 7
0
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);
}
Exemplo n.º 8
0
void AcsMessageBuilder::buildSetValueRequest(QtSoapMessage &request, AcsParamList &paramList)
{
    //Envelope
    buildEnvelope(request);

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

    //Body
    QtSoapStruct *pSetParameterValuesStruct = new QtSoapStruct(QtSoapQName(nsPrefix() + TAG_SETPARAMETERVALUES));

    QtSoapStruct *pParameterListStruct = new QtSoapStruct(QtSoapQName(TAG_PARAMETERLIST));
    pSetParameterValuesStruct->insert(pParameterListStruct);

    foreach(AcsParam param, paramList){
        QtSoapStruct *pParameterValueStruct = new QtSoapStruct(QtSoapQName(TAG_PARAMETERVALUESTRUCT));

        pParameterValueStruct->insert(new QtSoapSimpleType(QtSoapQName(TAG_NAME), param.name));
        pParameterValueStruct->insert(new QtSoapSimpleType(QtSoapQName(TAG_VALUE), param.value));

        pParameterListStruct->insert(pParameterValueStruct);
    }
Exemplo n.º 9
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;
}