johnperry/CTP

HttpURLConnection .connect() in TciaXnatDatabaseAdapter.send() returns 200 even if authentication is wrong

Closed this issue · 8 comments

Hi,

I don't know whether this is the appropriate place to post the issue, because probably it is related to me not being able to use the library (and not being routinized in java), rather than a bug.
Anyhow, here is my case:

  • we're running XNAT 1.6.3, tomcat7, java 7
  • CTP is running on MAC, java 7 with following config file
<?xml version="1.0" encoding="UTF-8"?>
<Configuration>
    <Server maxThreads="20" port="8080"></Server>
    <Pipeline name="Import Pipeline">
        <DicomImportService class="org.rsna.ctp.stdstages.DicomImportService" 
                            logConnections="no" name="DicomImportService"
                            port="9104" 
                            quarantine="test/quarantines/DicomImportService" 
                            root="test/roots/DicomImportService">
        </DicomImportService>
        <BasicFileStorageService 
            class="org.rsna.ctp.stdstages.BasicFileStorageService" 
            id="bfss" index="test/roots/BasicFileStorageService" 
            maxSize="200" nLevels="3" name="BasicFileStorageService" 
            quarantine="test/quarantines/BasicFileStorageService" 
            returnStoredFile="yes" 
            root="test/roots/BasicFileStorageService/store">
        </BasicFileStorageService>
        <DatabaseExportService
            adapterClass="org.rsna.ctp.stdstages.database.TciaXnatDatabaseAdapter" 
            class="org.rsna.ctp.stdstages.DatabaseExportService" 
            fileStorageServiceID="bfss" 
            interval="10000" 
            name="DatabaseExportService" 
            password="fake" poolSize="1" 
            projectName="dummy" projectTag="(0008,1030)" 
            quarantine="test/quarantines/DatabaseExportService" 
            root="test/roots/DatabaseExportService" 
            sessionName="dicomimporttest" sessionTag="(0010,0020)" 
            url="https://test-msmetrix.icometrix.com:443/xnat" username="admin">
        </DatabaseExportService>
    </Pipeline>
</Configuration>

The whole pipeline seems to be doing fine, passing the images through the several modules (very nice architecture btw), but when hitting XNAT, it seems that they don't come through. No error, no debug message seems to tell me what's going on.

By playing around, e.g. providing wrong credentials, I don't even get errors. If you open the project in eclipse and look at TciaXnatDatabaseAdapter.send(..), it seems that conn.connect() returns 200, even with credentials being wrong. (and the if (authenticate){...} evaluated before to true).

When providing wrong url, an exception is thrown as expected.

Note: I deleted the xml <jpeg wmax="10000" wmin="96" q="-1" />
from the config XML (as described here), since I assumed it was not needed.
Any tips would be wonderful.
thanks

Note: I wrote a custom DatabaseAdaptor, because I needed another flow, and used org.apache.http.* as httpclient, and now it works ok.
So the issue can be closed for me

Most people post to either the Google group (https://groups.google.com/forum/#!forum/rsnas-ctpmirc-user-group) or the Yahoo group (rsnamirc@yahoo.edu). I don't get notified when somebody posts a comment on one of my GitHub repositories (I didn't even know it was possible).

Most people who connect CTP to XNAT do it with the HttpExportService. There are several special features in the HttpExportService that make transfers much more efficient. They are implemented in two child elements of the HttpExportService's config.xml element.

The first is the xnat child element, which handles the authentication. What makes it more efficient is that after authenticating, it obtains the session cookie provided by the XNAT server and passes it back on subsequent transfers, allowing the server to authenticate the transfer quickly.

The second is the compressor child element, which provides a mechanism for caching multiple files into a single zip file that is automatically de-compressed by the XNAT server on receipt. The compressor child element also includes attributes for dynamically constructing the folder hierarchy in the exported zip file.

I'll put an article about this on the RSNA MIRC Wiki (http://mircwiki.rsna.org/index.php?title=CTP_Articles).

JP

I tried to reply to this comment, but I might have made a mistake and lost it. If you didn't see the reply, please send an email to me directly. It's pretty important.

JP
johnperry@dls.net

From: cecemel
Sent: Friday, August 14, 2015 11:28 AM
To: johnperry/CTP
Subject: Re: [CTP] HttpURLConnection .connect() in TciaXnatDatabaseAdapter.send() returns 200 even if authentication is wrong (#9)

Note: I wrote a custom DatabaseAdaptor, because I needed another flow, and used org.apache.http.* as httpclient, and now it works ok.
So the issue can be closed for me


Reply to this email directly or view it on GitHub.

Thanks for the extensive reply! The cooking setting and zip file creation were indeed the things I needed.
I'll post my further questions on the discussion group.
Perhaps it would also be nice to include these urls in a readme file in the source of this project.

Here is the article I promised on configuring the HttpExportService to connect to XNAT Servers.
JP

Thank you soo much for the article.
If I may suggest: I think it would be very handy I you could also provide a working config.xml as an example in the article. It eases the pain to make try things for the first time.

Other question (sorry, this is perhaps more a topic for the user group, but I'll post the Q/A to the user group if you answer here :-)), but is there anyway to also 'trigger the pipelines' once a complete study has been uploaded?

Hi again,
yeah sorry this user was me. I considered this as two separate things, but somewhat it wasn't. I'll move everything to the discussion group than. Sorry again for the confusion.