dcm4che (in my JAVA app) refuses dcm4chee's association request

371 views
Skip to first unread message

Tamás Sipos

unread,
May 14, 2018, 11:20:17 AM5/14/18
to dcm...@googlegroups.com
I can successfully c-find and c-store already, right now I'm trying to figure out how to c-move. The title says pretty much everything I know and I post the corresponding pieces of code and log data so you can see what exactly is going on...

The relevant part of my JAVA application:

// Creating the entities taking part in the association...
ApplicationEntity locAE = new ApplicationEntity();
locAE
.setAETitle("TEST_JAVA_APP");
ApplicationEntity remAE = new ApplicationEntity();
remAE
.setAETitle("DCM4CHEE");

// Defining the local part of the connection...
Connection localConn = new Connection();
localConn
.setHostname("localhost");
localConn
.setProtocol(Connection.Protocol.DICOM);
locAE
.addConnection(localConn);

// Defining the remote part of the connection...
Connection remoteConn = new Connection();
remoteConn
.setHostname("localhost");
remoteConn
.setPort(11112);
remoteConn
.setProtocol(Connection.Protocol.DICOM);
remAE
.addConnection(remoteConn);

// Creating a device with an executor for the session...
Device device = new Device("device");
device
.addConnection(localConn);
device
.addApplicationEntity(locAE);
ExecutorService exec = Executors.newSingleThreadExecutor();
device
.setExecutor(exec);

// Setting the association request parameters for an SRR SOP...
AAssociateRQ assocReq = new AAssociateRQ();
assocReq
.setCalledAET(remAE.getAETitle());
assocReq
.setCallingAET(locAE.getAETitle());
assocReq
.setApplicationContext("1.2.840.10008.3.1.1.1");
assocReq
.setImplClassUID("1.2.40.0.13.1.3");
assocReq
.setImplVersionName("dcm4che-5.12.0");
assocReq
.addPresentationContext(new PresentationContext(
 
1, "1.2.840.10008.5.1.4.1.2.2.2", "1.2.840.10008.1.2"));

// Initiating the association...
Association assoc = locAE.connect(localConn, remoteConn, assocReq);

// Specifying the DICOM attributes for the SRR SOP's IOD...
Attributes atts = new Attributes();
atts
.setString(0x00080052, VR.LO, "STUDY"); // on this Level
atts
.setString(0x0020000D, VR.UI, // Study Instance UID
 
"1.2.826.0.1.[...]");

// Performing a DIMSE C-MOVE query with the SRR SOP...
assoc
.cmove("1.2.840.10008.5.1.4.1.2.2.2", 0x0000,
 atts
, "1.2.840.10008.1.2", locAE.getAETitle(),
 
new DimseRSPHandler(assoc.nextMessageID()) { ...

and the relevant part in dcm4chee's log:

2018-05-14 17:04:16,873 INFO  -> (TCPServer-1-5) [org.dcm4cheri.server.ServerImpl] handle - Socket[addr=/127.0.0.1,port=55413,localport=11112]
2018-05-14 17:04:16,873 INFO  -> (TCPServer-1-5) [org.dcm4cheri.net.FsmImpl] Socket[addr=/127.0.0.1,port=55413,localport=11112]
2018-05-14 17:04:16,889 INFO  TEST_JAVA_APP->DCM4CHEE (TCPServer-1-5) [org.dcm4cheri.net.FsmImpl] received AAssociateRQ
 appCtxName: 1.2.840.10008.3.1.1.1/
DICOM Application Context Name
 implClass
: 1.2.40.0.13.1.3
 implVersion
: dcm4che-5.12.0
 calledAET
: DCM4CHEE
 callingAET
: TEST_JAVA_APP
 maxPDULen
: 16378
 asyncOpsWindow
:
 pc
-1: as=1.2.840.10008.5.1.4.1.2.2.2/Study Root Query/Retrieve Information Model - MOVE
 ts
=1.2.840.10008.1.2/Implicit VR Little Endian
2018-05-14 17:04:16,889 INFO  TEST_JAVA_APP->DCM4CHEE (TCPServer-1-5) [org.dcm4cheri.net.FsmImpl] sending AAssociateAC
 appCtxName
: 1.2.840.10008.3.1.1.1/DICOM Application Context Name
 implClass
: 1.2.40.0.13.1.1.1
 implVersion
: dcm4che-1.4.34
 calledAET
: DCM4CHEE
 callingAET
: TEST_JAVA_APP
 maxPDULen
: 16352
 asyncOpsWindow
:
 pc
-1: 0 - acceptance
 ts
=1.2.840.10008.1.2/Implicit VR Little Endian
2018-05-14 17:04:16,920 INFO  TEST_JAVA_APP->DCM4CHEE (TCPServer-1-5) [org.dcm4cheri.net.FsmImpl] received [pc-1] 1:C_MOVE_RQ with Dataset
 
class: 1.2.840.10008.5.1.4.1.2.2.2/Study Root Query/Retrieve Information Model - MOVE
 move dest
: TEST_JAVA_APP
2018-05-14 17:04:16,920 INFO  TEST_JAVA_APP->DCM4CHEE (Timer-2) [org.dcm4cheri.net.FsmImpl] sending [pc-1] 1:C_MOVE_RSP
 
class: 1.2.840.10008.5.1.4.1.2.2.2/Study Root Query/Retrieve Information Model - MOVE
 status
: ff00
2018-05-14 17:04:16,920 INFO  TEST_JAVA_APP->DCM4CHEE (Thread-1149) [org.dcm4cheri.net.FsmImpl] Socket[addr=localhost/127.0.0.1,port=11112,localport=55414]
2018-05-14 17:04:16,920 INFO  -> (TCPServer-1-4) [org.dcm4cheri.server.ServerImpl] handle - Socket[addr=/127.0.0.1,port=55414,localport=11112]
2018-05-14 17:04:16,920 INFO  -> (TCPServer-1-4) [org.dcm4cheri.net.FsmImpl] Socket[addr=/127.0.0.1,port=55414,localport=11112]
2018-05-14 17:04:16,920 INFO  DCM4CHEE->TEST_JAVA_APP (Thread-1149) [org.dcm4cheri.net.FsmImpl] sending AAssociateRQ
 appCtxName: 1.2.840.10008.3.1.1.1/
DICOM Application Context Name
 implClass
: 1.2.40.0.13.1.1.1
 implVersion
: dcm4che-1.4.34
 calledAET
: TEST_JAVA_APP
 callingAET
: DCM4CHEE
 maxPDULen
: 16352
 asyncOpsWindow
: maxOpsInvoked=0, maxOpsPerformed=1
 pc
-1: as=1.2.840.10008.5.1.4.1.1.4/MR Image Storage
 ts
=1.2.840.10008.1.2/Implicit VR Little Endian
 pc
-3: as=1.2.840.10008.5.1.4.1.1.4/MR Image Storage
 ts
=1.2.840.10008.1.2.1/Explicit VR Little Endian
2018-05-14 17:04:16,936 INFO  DCM4CHEE->TEST_JAVA_APP (TCPServer-1-4) [org.dcm4cheri.net.FsmImpl] received AAssociateRQ
 appCtxName
: 1.2.840.10008.3.1.1.1/DICOM Application Context Name
 implClass
: 1.2.40.0.13.1.1.1
 implVersion
: dcm4che-1.4.34
 calledAET
: TEST_JAVA_APP
 callingAET
: DCM4CHEE
 maxPDULen
: 16352
 asyncOpsWindow
: maxOpsInvoked=0, maxOpsPerformed=1
 pc
-1: as=1.2.840.10008.5.1.4.1.1.4/MR Image Storage
 ts
=1.2.840.10008.1.2/Implicit VR Little Endian
 pc
-3: as=1.2.840.10008.5.1.4.1.1.4/MR Image Storage
 ts
=1.2.840.10008.1.2.1/Explicit VR Little Endian
2018-05-14 17:04:16,951 INFO  DCM4CHEE->TEST_JAVA_APP (TCPServer-1-4) [org.dcm4cheri.net.FsmImpl] sending A-ASSOCIATE-RJ
 result
=1 - rejected-permanent
 source
=1 - service-user
 reason
=7 - called-AE-title-not-recognized
2018-05-14 17:04:16,951 INFO  DCM4CHEE->TEST_JAVA_APP (Thread-1149) [org.dcm4cheri.net.FsmImpl] received A-ASSOCIATE-RJ
 result
=1 - rejected-permanent
 source
=1 - service-user
 reason
=7 - called-AE-title-not-recognized
2018-05-14 17:04:17,014 INFO  DCM4CHEE->TEST_JAVA_APP (Thread-1149) [org.dcm4cheri.net.FsmImpl] closing connection - Socket[addr=localhost/127.0.0.1,port=11112,localport=55414]
2018-05-14 17:04:17,014 INFO  DCM4CHEE->TEST_JAVA_APP (TCPServer-1-4) [org.dcm4cheri.net.FsmImpl] closing connection - Socket[addr=/127.0.0.1,port=55414,localport=11112]
2018-05-14 17:04:17,014 ERROR -> (Thread-1149) [org.dcm4chex.archive.dcm.qrscp.QueryRetrieveScpService] Association not accepted by TEST_JAVA_APP:
A-ASSOCIATE-RJ
 result=1 - rejected-permanent
 source=1 - service-user
 reason=7 - called-AE-title-not-recognized
java.io.IOException: Association not accepted by TEST_JAVA_APP:
A-ASSOCIATE-RJ
 result=1 - rejected-permanent
 source=1 - service-user
 reason=7 - called-AE-title-not-recognized
 at org.dcm4chex.archive.dcm.qrscp.MoveTask.openAssociation(MoveTask.java:235)
 at org.dcm4chex.archive.dcm.qrscp.MoveTask.run(MoveTask.java:362)
 at java.lang.Thread.run(Thread.java:748)
2018-05-14 17:04:17,014 INFO  -> (TCPServer-1-4) [org.dcm4cheri.server.ServerImpl] finished - Socket[addr=/127.0.0.1,port=55414,localport=11112]
2018-05-14 17:04:17,014 INFO  TEST_JAVA_APP->DCM4CHEE (Thread-1149) [org.dcm4cheri.net.FsmImpl] sending [pc-1] 1:C_MOVE_RSP with Dataset
 class: 1.2.840.10008.5.1.4.1.2.2.2/
Study Root Query/Retrieve Information Model - MOVE
 status
: a702
2018-05-14 17:04:17,029 INFO  TEST_JAVA_APP->DCM4CHEE (ActiveAssoc-398-1) [org.dcm4cheri.net.FsmImpl] received A-RELEASE-RQ
2018-05-14 17:04:17,029 INFO  TEST_JAVA_APP->DCM4CHEE (ActiveAssoc-398-1) [org.dcm4cheri.net.FsmImpl] sending A-RELEASE-RP
2018-05-14 17:04:17,029 INFO  -> (TCPServer-1-5) [org.dcm4cheri.server.ServerImpl] finished - Socket[addr=/127.0.0.1,port=55413,localport=11112]
2018-05-14 17:04:17,092 INFO  TEST_JAVA_APP->DCM4CHEE (ActiveAssoc-398-1) [org.dcm4cheri.net.FsmImpl] closing connection - Socket[addr=/127.0.0.1,port=55413,localport=11112]

Nicolas Roduit

unread,
May 14, 2018, 5:38:09 PM5/14/18
to dcm4che
First I would recommend using this library which gives a Java API of dcm4che3.

For you issue, log gives you the answer:
 result=1 - rejected-permanent
 source=1 - service-user
 reason=7 - called-AE-title-not-recognized

You inverted the calling and the called AETitle. 

Tamás Sipos

unread,
May 15, 2018, 4:17:17 AM5/15/18
to dcm...@googlegroups.com
Thank you, I'll check out that library!

I'm confused because what I see from the log, first I'm calling dcm4chee from my application, which is successful, see the part

implVersion: dcm4che-5.12.0
 calledAET
: DCM4CHEE
 callingAET
: TEST_JAVA_APP

and then, dcm4chee sends a request to my application:

implVersion: dcm4che-1.4.34
 calledAET
: TEST_JAVA_APP
 callingAET
: DCM4CHEE

which my application rejects.
I don't see how the AE Titles are inverted. But maybe I'm wrong, I have no experience with c-move yet.

UPDATE:

I guess it's the c-store sub-operation that fails when dcm4chee wants to send me the data. I did a little research for c-move and what I've found is that the SCP (dcm4chee) needs to know to where to send the data requested by my application. That's why I send my AET as the destination parameter for c-move.

Then, dcm4chee also has to look up the IP and port belonging to this entity, so I added

TEST_JAVA_APP        localhost        22224

to the list of AEs on dcm4chee's admin panel, and

localConn.setPort(22224);

in my JAVA code. It was still not working, but this time because of some other error:

2018-05-15 11:04:55,803 INFO  -> (TCPServer-1) [org.dcm4cheri.server.ServerImpl] handle - Socket[addr=/127.0.0.1,port=56887,localport=11112]
2018-05-15 11:04:55,818 INFO  -> (TCPServer-1) [org.dcm4cheri.net.FsmImpl] Socket[addr=/127.0.0.1,port=56887,localport=11112]
2018-05-15 11:04:55,834 INFO  TEST_JAVA_APP->
DCM4CHEE (TCPServer-1) [org.dcm4cheri.net.FsmImpl] received AAssociateRQ
 appCtxName: 1.2.840.10008.3.1.1.1/
DICOM Application Context Name

 implClass
: 1.2.40.0.13.1.3
 implVersion
: dcm4che-5.12.0
 calledAET
: DCM4CHEE
 callingAET
: TEST_JAVA_APP
 maxPDULen
: 16378
 asyncOpsWindow
:
 pc
-1: as=1.2.840.10008.5.1.4.1.2.2.2/Study Root Query/Retrieve Information Model - MOVE
 ts
=1.2.840.10008.1.2/Implicit VR Little Endian
2018-05-15 11:04:55,834 INFO  TEST_JAVA_APP->DCM4CHEE (TCPServer-1) [org.dcm4cheri.net.FsmImpl] sending AAssociateAC

 appCtxName
: 1.2.840.10008.3.1.1.1/DICOM Application Context Name
 implClass
: 1.2.40.0.13.1.1.1
 implVersion
: dcm4che-1.4.34
 calledAET
: DCM4CHEE
 callingAET
: TEST_JAVA_APP
 maxPDULen
: 16352
 asyncOpsWindow
:
 pc
-1: 0 - acceptance
 ts
=1.2.840.10008.1.2/Implicit VR Little Endian
2018-05-15 11:04:55,865 INFO  TEST_JAVA_APP->DCM4CHEE (TCPServer-1) [org.dcm4cheri.net.FsmImpl] received [pc-1] 1:C_MOVE_RQ with Dataset

 
class: 1.2.840.10008.5.1.4.1.2.2.2/Study Root Query/Retrieve Information Model - MOVE
 move dest
: TEST_JAVA_APP
2018-05-15 11:04:55,913 INFO  TEST_JAVA_APP->DCM4CHEE (Timer-2) [org.dcm4cheri.net.FsmImpl] sending [pc-1] 1:C_MOVE_RSP
 
class: 1.2.840.10008.5.1.4.1.2.2.2/Study Root Query/Retrieve Information Model - MOVE
 status
: ff00
2018-05-15 11:04:56,945 ERROR TEST_JAVA_APP->DCM4CHEE (Thread-3173) [org.dcm4chex.archive.dcm.qrscp.QueryRetrieveScpService] Connection refused: connect
java
.net.ConnectException: Connection refused: connect
 at java
.net.DualStackPlainSocketImpl.connect0(Native Method)
 at java
.net.DualStackPlainSocketImpl.socketConnect(DualStackPlainSocketImpl.java:79)
 at java
.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:350)
 at java
.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:206)
 at java
.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:188)
 at java
.net.PlainSocketImpl.connect(PlainSocketImpl.java:172)
 at java
.net.SocksSocketImpl.connect(SocksSocketImpl.java:392)
 at java
.net.Socket.connect(Socket.java:589)
 at java
.net.Socket.connect(Socket.java:538)
 at org
.dcm4chex.archive.mbean.TLSConfigDelegate.createSocket(TLSConfigDelegate.java:187)
 at org
.dcm4chex.archive.dcm.qrscp.QueryRetrieveScpService.createSocket(QueryRetrieveScpService.java:1362)
 at org
.dcm4chex.archive.dcm.qrscp.MoveTask.openAssociation(MoveTask.java:212)

 at org
.dcm4chex.archive.dcm.qrscp.MoveTask.run(MoveTask.java:362)
 at java
.lang.Thread.run(Thread.java:748)
2018-05-15 11:04:56,945 INFO  TEST_JAVA_APP->DCM4CHEE (Thread-3173) [org.dcm4cheri.net.FsmImpl] sending [pc-1] 1:C_MOVE_RSP with Dataset

 
class: 1.2.840.10008.5.1.4.1.2.2.2/Study Root Query/Retrieve Information Model - MOVE
 status
: a702
2018-05-15 11:04:56,945 INFO  TEST_JAVA_APP->DCM4CHEE (ActiveAssoc-1-1) [org.dcm4cheri.net.FsmImpl] received A-RELEASE-RQ
2018-05-15 11:04:56,945 INFO  TEST_JAVA_APP->DCM4CHEE (ActiveAssoc-1-1) [org.dcm4cheri.net.FsmImpl] sending A-RELEASE-RP
2018-05-15 11:04:56,945 INFO  -> (TCPServer-1) [org.dcm4cheri.server.ServerImpl] finished - Socket[addr=/127.0.0.1,port=56887,localport=11112]
2018-05-15 11:04:57,007 INFO  TEST_JAVA_APP->DCM4CHEE (ActiveAssoc-1-1) [org.dcm4cheri.net.FsmImpl] closing connection - Socket[addr=/127.0.0.1,port=56887,localport=11112]

What I see from this is that the port number 22224 I set, wasn't applied for the connection at all, instead a port number 56887 was used.

So I set it for 56887 for the TEST_JAVA_APP AE on dcm4chee's admin panel and then tried again, but it has failed for the same reason, as now a port number 56980 was chosen for the connection.

So it seems that dcm4che always picks some random port number, even if I configure one for the connection.

I hope this is the only problem left to solve.
I do some research and if I can't solve it, I'll post a question about setting the port number...
Reply all
Reply to author
Forward
0 new messages