123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116 |
- /*=============================================================================
- Library: CTK
- Copyright (c) German Cancer Research Center,
- Division of Medical and Biological Informatics
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
- http://www.apache.org/licenses/LICENSE-2.0
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
- =============================================================================*/
- #include "ctkExchangeSoapMessageProcessor.h"
- #include "ctkSoapLog.h"
- #include <ctkDicomAppHostingTypesHelper.h>
- ctkExchangeSoapMessageProcessor::ctkExchangeSoapMessageProcessor(ctkDicomExchangeInterface* inter)
- : exchangeInterface(inter)
- {}
- 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 ctkExchangeSoapMessageProcessor::processNotifyDataAvailable(
- const QtSoapMessage &message, QtSoapMessage *reply) const
- {
- // extract arguments from input message
- const QtSoapType& inputType = message.method()["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 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(
- dynamic_cast<const QtSoapArray&>(inputType));
- const QtSoapType& inputType2 = message.method()["acceptableTransferSyntaxUIDs"];
- const QStringList acceptableTransferSyntaxUIDs = ctkDicomSoapArrayOfStringType::getArray(
- dynamic_cast<const QtSoapArray&>(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);
- }
- 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
- }
|