# HG changeset patch # User Sebastien Jodogne # Date 1559832492 -7200 # Node ID 003315d900ad7785dca6e8c892a3f562e10d9265 # Parent 3766775411b5d4203904a3b6c9ed54c023c67833 cont diff -r 3766775411b5 -r 003315d900ad Plugin/Plugin.cpp --- a/Plugin/Plugin.cpp Wed Jun 05 18:14:10 2019 +0200 +++ b/Plugin/Plugin.cpp Thu Jun 06 16:48:12 2019 +0200 @@ -174,7 +174,7 @@ #include #include -class StowSender : public OrthancPlugins::HttpClient::IChunkedBody +class StowClientBody : public OrthancPlugins::HttpClient::IRequestBody { private: std::vector files_; @@ -182,11 +182,12 @@ std::string boundary_; public: - StowSender(unsigned int size) : + StowClientBody() : position_(0), boundary_(Orthanc::Toolbox::GenerateUuid()) { - boost::filesystem::path p("/home/jodogne/DICOM/Demo/KNIX/Knee (R)/AX. FSE PD - 5"); + //boost::filesystem::path p("/home/jodogne/DICOM/Demo/KNIX/Knee (R)/AX. FSE PD - 5"); + boost::filesystem::path p("/tmp/dicom"); boost::filesystem::directory_iterator end; @@ -242,22 +243,31 @@ { try { - StowSender stow(1024*128); + StowClientBody stow; OrthancPlugins::HttpClient client; client.SetUrl("http://localhost:8080/dicom-web/studies"); client.SetMethod(OrthancPluginHttpMethod_Post); client.AddHeader("Accept", "application/dicom+json"); - client.AddHeader("Transfer-Encoding", "chunked"); client.AddHeader("Expect", ""); client.AddHeader("Content-Type", "multipart/related; type=application/dicom; boundary=" + stow.GetBoundary()); client.SetTimeout(120); client.SetBody(stow); - client.Execute(); + + OrthancPlugins::HttpClient::HttpHeaders headers; + std::string answer; + client.Execute(headers, answer); Json::Value v; - client.GetAnswerBody().ToJson(v); - std::cout << v.toStyledString() << std::endl; + Json::Reader reader; + if (reader.parse(answer, v)) + { + std::cout << v["00081190"].toStyledString() << std::endl; + } + else + { + throw Orthanc::OrthancException(Orthanc::ErrorCode_BadFileFormat); + } } catch (Orthanc::OrthancException& e) { diff -r 3766775411b5 -r 003315d900ad Resources/Orthanc/DownloadOrthancFramework.cmake --- a/Resources/Orthanc/DownloadOrthancFramework.cmake Wed Jun 05 18:14:10 2019 +0200 +++ b/Resources/Orthanc/DownloadOrthancFramework.cmake Thu Jun 06 16:48:12 2019 +0200 @@ -103,6 +103,8 @@ set(ORTHANC_FRAMEWORK_MD5 "404baef5d4c43e7c5d9410edda8ef5a5") elseif (ORTHANC_FRAMEWORK_VERSION STREQUAL "1.5.5") set(ORTHANC_FRAMEWORK_MD5 "cfc437e0687ae4bd725fd93dc1f08bc4") + elseif (ORTHANC_FRAMEWORK_VERSION STREQUAL "1.5.6") + set(ORTHANC_FRAMEWORK_MD5 "3c29de1e289b5472342947168f0105c0") endif() endif() endif()