Hi
Dmytro
I encountered some problems while studying the code in ipf-tutorials-xds in the IPF framework. My JDK version is 11, and the IPF framework version is 4.8-m5. First, I started the tomcat server inside Server.groovy without any errors. Next, I ran the test cases inside TestRepositoryAndRegistry.groovy, and all the test cases passed. Then I changed my testing strategy, and I wanted to perform the testing using pure Java as the client.
Therefore, I used the IHEWebServiceClient code from the ipf-tutorials-iheclient module and wrote the Provide code for the ITI-41 transaction. I found that I was able to successfully send the data of ProvideAndRegisterDocumentSet to the xds-iti41 route, and I could see the printout in the Server's console,
but then I encountered an error. The error occurred after storing document: 4.3.2.1 in DataStore, when it needed to transform to RegisterDocumentSetRequest and send to the ITI-42 endpoint: xds-iti42://localhost:0/xds-iti42.
The specific error message was org.apache.cxf.interceptor.Fault: Could not send Message. Caused by: java.net.ConnectException: Can't assign requested address. I suspect that the problem lies in sending RegisterDocumentSetRequest to the ITI-42 endpoint: xds-iti42://localhost:0/xds-iti42 with incorrect port information. How should I modify it? I have already tried changing the xds-iti41:xds-iti41 terminal ${header.port} in Iti4142RouteBuilder to a specific port like 9091, but I still encountered an error. What should I do to modify the code? Thank you very much for your help.
Best regards
Bo
====== The server console error log are as follows ========
1
6:05:28.580 [http-nio-9091-exec-7] INFO org.openehealth.ipf.tutorials.xds.Iti4142RouteBuilder - received iti41: ProvideAndRegisterDocumentSet(submissionSet=SubmissionSet(super=XDSMetaClass(availabilityStatus=APPROVED, comments=LocalizedString(lang=en-US, charset=UTF-8, value=comments1), entryUuid=submissionSet01, patientId=Identifiable(id=50f09e9e-095c-4a97-baea-754c8099c410, assigningAuthority=AssigningAuthority(universalId=1.3, universalIdType=ISO)), title=LocalizedString(lang=en-US, charset=UTF-8, value=Submission Set 01), uniqueId=1.123, homeCommunityId=urn:oid:1.2.3.4.5.6.2333.23, logicalUuid=null, version=null, limitedMetadata=false, extraMetadata=null, extraClassifications=null), authors=[Author(authorPerson=Person(id=Identifiable(id=id1, assigningAuthority=AssigningAuthority(universalId=1.1, universalIdType=ISO)), name=XcnName(super=Name(familyName=Otto, givenName=null, secondAndFurtherGivenNames=null, suffix=null, prefix=null, degree=null))), authorInstitution=[], authorRole=[], authorSpecialty=[], authorTelecom=[])], contentTypeCode=Code(code=code1, displayName=LocalizedString(lang=en-US, charset=UTF-8, value=code1), schemeName=scheme1), intendedRecipients=[Recipient(person=null, organization=Organization(assigningAuthority=null, organizationName=org, idNumber=null), telecom=null)], sourceId=1.2.3, submissionTime=Timestamp(dateTime=1980-01-01T00:00Z[UTC], precision=YEAR)), folders=[Folder(super=XDSMetaClass(availabilityStatus=APPROVED, comments=LocalizedString(lang=en-US, charset=UTF-8, value=comments3), entryUuid=folder01, patientId=Identifiable(id=50f09e9e-095c-4a97-baea-754c8099c410, assigningAuthority=AssigningAuthority(universalId=1.3, universalIdType=ISO)), title=LocalizedString(lang=en-US, charset=UTF-8, value=Folder 01), uniqueId=1.48574589, homeCommunityId=null, logicalUuid=null, version=null, limitedMetadata=false, extraMetadata=null, extraClassifications=null), codeList=[Code(code=code7, displayName=LocalizedString(lang=en-US, charset=UTF-8, value=code7), schemeName=scheme7)], lastUpdateTime=Timestamp(dateTime=1982-09-10T12:13:15Z[UTC], precision=SECOND))], documents=[Document(documentEntry=DocumentEntry(super=XDSMetaClass(availabilityStatus=APPROVED, comments=LocalizedString(lang=en-US, charset=UTF-8, value=comment2), entryUuid=document01, patientId=Identifiable(id=50f09e9e-095c-4a97-baea-754c8099c410, assigningAuthority=AssigningAuthority(universalId=1.3, universalIdType=ISO)), title=LocalizedString(lang=en-US, charset=UTF-8, value=Document 01), uniqueId=4.3.2.1, homeCommunityId=null, logicalUuid=null, version=null, limitedMetadata=false, extraMetadata={urn:abc=[ddd]}, extraClassifications=null), authors=[Author(authorPerson=Person(id=Identifiable(id=id2, assigningAuthority=AssigningAuthority(universalId=1.2, universalIdType=ISO)), name=XcnName(super=Name(familyName=Norbi, givenName=null, secondAndFurtherGivenNames=null, suffix=null, prefix=null, degree=null))), authorInstitution=[Organization(assigningAuthority=null, organizationName=authorOrg, idNumber=null)], authorRole=[Identifiable(id=role1, assigningAuthority=AssigningAuthority(universalId=1.2.3.1, universalIdType=ISO)), Identifiable(id=role2, assigningAuthority=null)], authorSpecialty=[Identifiable(id=spec1, assigningAuthority=AssigningAuthority(universalId=1.2.3.3, universalIdType=ISO)), Identifiable(id=spec2, assigningAuthority=null)], authorTelecom=[Telecom(use=NET, type=Internet, email=
aut...@acme.org, countryCode=null, areaCityCode=null, localNumber=null, extension=null, unformattedPhoneNumber=null), Telecom(use=NET, type=Internet, email=
aut...@acme.org, countryCode=null, areaCityCode=null, localNumber=null, extension=null, unformattedPhoneNumber=null)])], classCode=Code(code=code2, displayName=LocalizedString(lang=en-US, charset=UTF-8, value=code2), schemeName=scheme2), confidentialityCodes=[Code(code=code8, displayName=LocalizedString(lang=en-US, charset=UTF-8, value=code8), schemeName=scheme8)], creationTime=Timestamp(dateTime=1981-01-01T00:00Z[UTC], precision=YEAR), eventCodeList=[Code(code=code9, displayName=LocalizedString(lang=en-US, charset=UTF-8, value=code9), schemeName=scheme9)], formatCode=Code(code=code3, displayName=LocalizedString(lang=en-US, charset=UTF-8, value=code3), schemeName=scheme3), hash=d05bbfd1a09a6637607553041af284817ace6560, healthcareFacilityTypeCode=Code(code=code4, displayName=LocalizedString(lang=en-US, charset=UTF-8, value=code4), schemeName=scheme4), languageCode=en-US, legalAuthenticator=Person(id=Identifiable(id=legal, assigningAuthority=AssigningAuthority(universalId=1.7, universalIdType=ISO)), name=XcnName(super=Name(familyName=Gustav, givenName=null, secondAndFurtherGivenNames=null, suffix=null, prefix=null, degree=null))), mimeType=application/octet-stream, practiceSettingCode=Code(code=code5, displayName=LocalizedString(lang=en-US, charset=UTF-8, value=code5), schemeName=scheme5), serviceStartTime=Timestamp(dateTime=1980-12-01T00:00Z[UTC], precision=MONTH), serviceStopTime=Timestamp(dateTime=1981-01-01T00:00Z[UTC], precision=MONTH), size=70000, sourcePatientId=Identifiable(id=source, assigningAuthority=AssigningAuthority(universalId=4.1, universalIdType=ISO)), sourcePatientInfo=PatientInfo(ids=[], names=[XpnName(super=Name(familyName=Susi, givenName=null, secondAndFurtherGivenNames=null, suffix=null, prefix=null, degree=null))], birthDate=Timestamp(dateTime=1980-01-01T00:00Z[UTC], precision=YEAR), gender=M, addresses=[Address(streetAddress=hier, otherDesignation=null, city=null, stateOrProvince=null, zipOrPostalCode=null, country=null, countyParishCode=null)]), typeCode=Code(code=code6, displayName=LocalizedString(lang=en-US, charset=UTF-8, value=code6), schemeName=scheme6), uri=
http://hierunten.com, repositoryUniqueId=1.2.3.4, type=STABLE, referenceIdList=[ReferenceId(id=ref-id-1, assigningAuthority=CXiAssigningAuthority(super=AssigningAuthority(universalId=1.1.2.3, universalIdType=ISO)namespaceId=ABCD), idTypeCode=urn:ihe:iti:xds:2013:order), ReferenceId(id=ref-id-2, assigningAuthority=CXiAssigningAuthority(super=AssigningAuthority(universalId=2.1.2.3, universalIdType=ISO)namespaceId=DEFG), idTypeCode=vendor-defined)], documentAvailability=null))], associations=[Association(targetUuid=document01, sourceUuid=submissionSet01, associationType=HAS_MEMBER, label=ORIGINAL, entryUuid=docAss, docCode=null, previousVersion=111, originalStatus=null, newStatus=null, associationPropagation=null, availabilityStatus=null, extraMetadata=null), Association(targetUuid=folder01, sourceUuid=submissionSet01, associationType=HAS_MEMBER, label=null, entryUuid=folderAss, docCode=null, previousVersion=110, originalStatus=null, newStatus=null, associationPropagation=null, availabilityStatus=null, extraMetadata=null), Association(targetUuid=document01, sourceUuid=folder01, associationType=HAS_MEMBER, label=null, entryUuid=docFolderAss, docCode=null, previousVersion=null, originalStatus=null, newStatus=null, associationPropagation=null, availabilityStatus=null, extraMetadata=null)], targetHomeCommunityId=urn:oid:1.2.3.4.5.6.2333.23)
16:05:28.584 [http-nio-9091-exec-7] DEBUG org.apache.camel.processor.SendProcessor - >>>> direct://makeDocsReReadable Exchange[]
16:05:28.584 [http-nio-9091-exec-7] DEBUG org.openehealth.ipf.commons.core.ContentMap - Return existing content of type class javax.activation.DataHandler
16:05:28.585 [http-nio-9091-exec-7] DEBUG org.apache.camel.processor.SendProcessor - >>>> direct://checkForAssociationToDeprecatedObject Exchange[928BE8CD423B9C7-0000000000000002]
16:05:28.586 [http-nio-9091-exec-7] DEBUG org.apache.camel.processor.SendProcessor - >>>> direct://checkPatientIds Exchange[928BE8CD423B9C7-0000000000000002]
16:05:28.586 [http-nio-9091-exec-7] DEBUG org.apache.camel.processor.FilterProcessor - Filter matches: false for exchange: Exchange[928BE8CD423B9C7-0000000000000002]
16:05:28.587 [http-nio-9091-exec-7] DEBUG org.apache.camel.processor.SendProcessor - >>>> direct://checkHashAndSize Exchange[928BE8CD423B9C7-0000000000000002]
16:05:28.588 [http-nio-9091-exec-7] DEBUG org.openehealth.ipf.commons.core.ContentMap - Return existing content of type class javax.activation.DataHandler
16:05:28.588 [http-nio-9091-exec-7] DEBUG org.apache.camel.processor.FilterProcessor - Filter matches: false for exchange: Exchange[]
16:05:28.588 [http-nio-9091-exec-7] DEBUG org.openehealth.ipf.commons.core.ContentMap - Return existing content of type class javax.activation.DataHandler
16:05:28.589 [http-nio-9091-exec-7] DEBUG org.apache.camel.processor.FilterProcessor - Filter matches: false for exchange: Exchange[]
16:05:28.589 [http-nio-9091-exec-7] DEBUG org.apache.camel.processor.SendProcessor - >>>> direct://storeDocs Exchange[928BE8CD423B9C7-0000000000000002]
16:05:28.589 [http-nio-9091-exec-7] DEBUG org.openehealth.ipf.commons.core.ContentMap - Return existing content of type class javax.activation.DataHandler
16:05:28.589 [http-nio-9091-exec-7] INFO org.openehealth.ipf.tutorials.xds.DataStore - Stored document: 4.3.2.116:05:28.589 [http-nio-9091-exec-7] DEBUG org.apache.camel.processor.SendProcessor - >>>> direct://updateDocEntriesFromProvide Exchange[928BE8CD423B9C7-0000000000000002]
16:05:28.590 [http-nio-9091-exec-7] DEBUG org.openehealth.ipf.commons.core.ContentMap - Return existing content of type class javax.activation.DataHandler
16:05:28.591 [http-nio-9091-exec-7] INFO route1 - Transform to RegisterDocumentSetRequest
16:05:28.591 [http-nio-9091-exec-7] INFO route1 - Send to ITI-42 endpoint: xds-iti42://localhost:0/xds-iti4216:05:28.592 [http-nio-9091-exec-7] DEBUG org.apache.camel.processor.SendDynamicProcessor - >>>>
xds-iti42://localhost:0/xds-iti42 Exchange[928BE8CD423B9C7-0000000000000002]
org.apache.cxf.interceptor.Fault: Could not send Message.
Caused by: java.net.ConnectException: Can't assign requested address
========== My test codes are as follows ===============
// initialization of the application -- should be executed only once
ClassPathXmlApplicationContext appContext = new ClassPathXmlApplicationContext("context-xds.xml");
CamelContext camelContext = appContext.getBean(CamelContext.class);
// set up CamelContext
IHEWebServiceClient iheWebServiceClient = new IHEWebServiceClient();
iheWebServiceClient.setCamelContext(camelContext);
// generate documentEntry
ProvideAndRegisterDocumentSet provide = SampleData.createProvideAndRegisterDocumentSet();
DocumentEntry documentEntry = provide.getDocuments().get(0).getDocumentEntry();
Identifiable patientId = documentEntry.getPatientId();
HashMap<String, List<String>> extra = new HashMap<>();
extra.put("urn:abc", CollUtil.newArrayList("ddd"));
documentEntry.setExtraMetadata(extra);
patientId.setId(UUID.randomUUID().toString());
documentEntry.setUniqueId("4.3.2.1");
log.info(provide.getDocuments().get(0).getContent(DataHandler.class).toString());
log.info("xxxl");
documentEntry.setHash(String.valueOf(ContentUtils.sha1(provide.getDocuments().get(0).getContent(DataHandler.class))));
documentEntry.setSize(Long.valueOf(String.valueOf(ContentUtils.size(provide.getDocuments().get(0).getContent(DataHandler.class)))));
log.warn(documentEntry.getSize().toString());
provide.getDocuments().get(0).setDocumentEntry(documentEntry);
// Response response = iheWebServiceClient.iti41ProvideAndRegister(provide,"localhost",8367, "api/services/xds-iti18");
Response response = iheWebServiceClient.iti41ProvideAndRegister(provide,"localhost",9091, "xds-iti41");
log.warn(response.toString());

I modify getPort() in Iti4142RouteBuilder to spectify port 9091,then It works, But appears another problem. I found that simply changing the port does not solve my problem. Even when I modified the getPort() method inside Iti4142RouteBuilder to 9091, it still didn't work. After providing and registering the documents, I couldn't find any document information, and a major reason for this is the incorrect port information. I checked the log printouts in the console, and the port for the terminal services is all 0. How should I modify the code for IHEWebServiceClient? (The code is in my initial question.) When I ran the tests inside TestRepositoryAndRegistry.groovy, I observed the printouts in the console, and I found that the port information is constantly changing, not a fixed value. Please help me, as I really don't know what to do. Thank you very much.🙏🙏