Hello Dmytro
I understand what you mean now, and I have decided to refactor the project into a Spring Boot project. So, for the XDS tutorial project you provided, can I refactor it to start as a Spring Boot project? If possible, what should I pay attention to?
In order to integrate the XDS tutorial into Spring Boot, I made the following attempts:
First, I tried to start the XDS tutorial in a Spring Boot manner,
so I converted the Beans configured in the context.xml to Java configuration.My configuration class is as follows:
import org.apache.camel.spring.SpringCamelContext;
import org.openehealth.ipf.commons.audit.DefaultAuditContext;
import org.openehealth.ipf.commons.audit.queue.RecordingAuditMessageQueue;
import org.openehealth.ipf.commons.ihe.ws.cxf.payload.InPayloadLoggerInterceptor;
import org.openehealth.ipf.commons.ihe.ws.cxf.payload.OutPayloadLoggerInterceptor;
import org.openehealth.ipf.tutorials.xds.Iti18RouteBuilder;
import org.openehealth.ipf.tutorials.xds.Iti4142RouteBuilder;
import org.openehealth.ipf.tutorials.xds.Iti43RouteBuilder;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
@Configuration
public class XdsCamelContextConfig {
@Bean
public DefaultAuditContext auditContext(RecordingAuditMessageQueue mockedSender) {
DefaultAuditContext auditContext = new DefaultAuditContext();
auditContext.setAuditEnabled(true);
auditContext.setAuditSourceId("sourceId");
auditContext.setAuditMessageQueue(mockedSender);
return auditContext;
}
@Bean
public RecordingAuditMessageQueue mockedSender() {
return new RecordingAuditMessageQueue();
}
@Bean
public Iti4142RouteBuilder iti4142RouteBuilder() {
return new Iti4142RouteBuilder();
}
@Bean
public Iti43RouteBuilder iti43RouteBuilder() {
return new Iti43RouteBuilder();
}
@Bean
public Iti18RouteBuilder iti18RouteBuilder() {
return new Iti18RouteBuilder();
}
@Bean
public String logFileNamePrefix() {
return "/Users/bovane/Documents/hos-app/logs";
}
@Bean
public InPayloadLoggerInterceptor serverInLogger() {
return new InPayloadLoggerInterceptor("/Users/bovane/Documents/hos-app/logs/server-in.txt");
}
@Bean
public OutPayloadLoggerInterceptor serverOutLogger() {
return new OutPayloadLoggerInterceptor("/Users/bovane/Documents/hos-app/logs/server-out.txt");
}
@Bean
public SpringCamelContext camelContext() {
return new SpringCamelContext();
}
}
Next, I directly started the XDSApplication, a
nd its output shows that the routes written in the XDS tutorial have been started. However, when I tested using SOAP UI, I encountered a 404 error. For example,
when I sent a request to http://localhost:9091/xds-iti41, it returned a 404 error. I am not sure what the reason is. (
When I directly run Server.groovy, the same request can successfully register documents.) What should I do next to make modifications? I hope you can give me some advice. Thank you very much for your help.
=====================================================
Picked up _JAVA_OPTIONS: -Djavax.xml.accessExternalSchema=all
. ____ _ __ _ _
/\\ / ___'_ __ _ _(_)_ __ __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
\\/ ___)| |_)| | | | | || (_| | ) ) ) )
' |____| .__|_| |_|_| |_\__, | / / / /
=========|_|==============|___/=/_/_/_/
:: Spring Boot :: (v2.3.2.RELEASE)
2024-06-10 19:08:46.106 INFO 4124 --- [ main] work.mediway.ihe.XDSApplication : Starting XDSApplication on MacPro with PID 4124 (/Users/bovane/Documents/GitHub/ihe-base/ihe-xds/target/classes started by bovane in /Users/bovane/Documents/GitHub/ihe-base)
2024-06-10 19:08:46.109 INFO 4124 --- [ main] work.mediway.ihe.XDSApplication : No active profile set, falling back to default profiles: default
2024-06-10 19:08:46.357 INFO 4124 --- [ main] o.o.i.c.c.config.ExtensionModuleFactory : Registering new extension module RegRepModelExtension defined in class org.openehealth.ipf.tutorials.xds.RegRepModelExtension
2024-06-10 19:08:46.403 INFO 4124 --- [ main] o.o.i.c.c.config.ExtensionModuleFactory : Registering new extension module MappingExtension defined in class org.openehealth.ipf.commons.map.extend.MappingExtensionModule
2024-06-10 19:08:46.405 INFO 4124 --- [ main] o.o.i.c.c.config.ExtensionModuleFactory : Registering new extension module Hl7MarshalExtension defined in class org.openehealth.ipf.platform.camel.hl7.extend.Hl7ExtensionModule
2024-06-10 19:08:46.408 INFO 4124 --- [ main] o.o.i.c.c.config.ExtensionModuleFactory : Registering new extension module Hl7Extension defined in class org.openehealth.ipf.modules.hl7.extend.Hl7ExtensionModule,org.openehealth.ipf.modules.hl7.extend.Hl7Dsl2ExtensionModule
2024-06-10 19:08:46.431 INFO 4124 --- [ main] o.o.i.c.c.config.ExtensionModuleFactory : Registering new extension module CoreExtension defined in class org.openehealth.ipf.platform.camel.core.extend.CoreExtensionModule
2024-06-10 19:08:47.437 INFO 4124 --- [ main] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat initialized with port(s): 9091 (http)
2024-06-10 19:08:47.445 INFO 4124 --- [ main] o.apache.catalina.core.StandardService : Starting service [Tomcat]
2024-06-10 19:08:47.445 INFO 4124 --- [ main] org.apache.catalina.core.StandardEngine : Starting Servlet engine: [Apache Tomcat/9.0.83]
2024-06-10 19:08:47.554 INFO 4124 --- [ main] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring embedded WebApplicationContext
2024-06-10 19:08:47.554 INFO 4124 --- [ main] w.s.c.ServletWebServerApplicationContext : Root WebApplicationContext: initialization completed in 1019 ms
2024-06-10 19:08:48.618 INFO 4124 --- [ main] o.s.b.a.e.web.EndpointLinksResolver : Exposing 2 endpoint(s) beneath base path '/actuator'
2024-06-10 19:08:48.702 INFO 4124 --- [ main] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat started on port(s): 9091 (http) with context path ''
2024-06-10 19:08:49.323 INFO 4124 --- [ main] o.a.c.w.s.f.ReflectionServiceFactoryBean : Creating Service {urn:ihe:iti:xds-b:2007}DocumentRepository_Service from WSDL: wsdl/iti41.wsdl
2024-06-10 19:08:49.764 INFO 4124 --- [ main] org.apache.cxf.endpoint.ServerImpl : Setting the server's publish address to be /xds-iti41
2024-06-10 19:08:49.782 INFO 4124 --- [ main] o.a.c.w.s.f.ReflectionServiceFactoryBean : Creating Service {urn:ihe:iti:xds-b:2007}DocumentRegistry_Service from WSDL: wsdl/iti42.wsdl
2024-06-10 19:08:49.835 INFO 4124 --- [ main] org.apache.cxf.endpoint.ServerImpl : Setting the server's publish address to be /xds-iti42
2024-06-10 19:08:49.843 INFO 4124 --- [ main] o.a.c.w.s.f.ReflectionServiceFactoryBean : Creating Service {urn:ihe:iti:xds-b:2007}DocumentRegistry_Service from WSDL: wsdl/iti18.wsdl
2024-06-10 19:08:49.861 INFO 4124 --- [ main] org.apache.cxf.endpoint.ServerImpl : Setting the server's publish address to be /xds-iti18
2024-06-10 19:08:49.862 INFO 4124 --- [ main] o.a.c.w.s.f.ReflectionServiceFactoryBean : Creating Service {urn:ihe:iti:xds-b:2007}DocumentRepository_Service from WSDL: wsdl/iti43.wsdl
2024-06-10 19:08:49.908 INFO 4124 --- [ main] org.apache.cxf.endpoint.ServerImpl : Setting the server's publish address to be /xds-iti43
2024-06-10 19:08:49.909 INFO 4124 --- [ main] o.a.c.impl.engine.AbstractCamelContext : Apache Camel 3.21.3 (camel-1) is starting
2024-06-10 19:08:50.199 INFO 4124 --- [ main] o.a.c.impl.engine.AbstractCamelContext : Routes startup (started:34)
2024-06-10 19:08:50.199 INFO 4124 --- [ main] o.a.c.impl.engine.AbstractCamelContext : Started route1 (xds-iti41://xds-iti41)
2024-06-10 19:08:50.199 INFO 4124 --- [ main] o.a.c.impl.engine.AbstractCamelContext : Started route2 (xds-iti42://xds-iti42)
2024-06-10 19:08:50.199 INFO 4124 --- [ main] o.a.c.impl.engine.AbstractCamelContext : Started route3 (direct://checkForAssociationToDeprecatedObject)
2024-06-10 19:08:50.199 INFO 4124 --- [ main] o.a.c.impl.engine.AbstractCamelContext : Started route4 (direct://checkPatientIds)
2024-06-10 19:08:50.199 INFO 4124 --- [ main] o.a.c.impl.engine.AbstractCamelContext : Started route5 (direct://checkHashAndSize)
2024-06-10 19:08:50.199 INFO 4124 --- [ main] o.a.c.impl.engine.AbstractCamelContext : Started route6 (direct://checkHash)
2024-06-10 19:08:50.199 INFO 4124 --- [ main] o.a.c.impl.engine.AbstractCamelContext : Started route7 (direct://makeDocsReReadable)
2024-06-10 19:08:50.199 INFO 4124 --- [ main] o.a.c.impl.engine.AbstractCamelContext : Started route8 (direct://storeDocs)
2024-06-10 19:08:50.199 INFO 4124 --- [ main] o.a.c.impl.engine.AbstractCamelContext : Started route9 (direct://updateDocEntriesFromProvide)
2024-06-10 19:08:50.199 INFO 4124 --- [ main] o.a.c.impl.engine.AbstractCamelContext : Started route10 (direct://storeDocEntriesFromRegister)
2024-06-10 19:08:50.199 INFO 4124 --- [ main] o.a.c.impl.engine.AbstractCamelContext : Started route11 (direct://storeFolders)
2024-06-10 19:08:50.199 INFO 4124 --- [ main] o.a.c.impl.engine.AbstractCamelContext : Started route12 (direct://storeSubmissionSet)
2024-06-10 19:08:50.199 INFO 4124 --- [ main] o.a.c.impl.engine.AbstractCamelContext : Started route13 (direct://store)
2024-06-10 19:08:50.199 INFO 4124 --- [ main] o.a.c.impl.engine.AbstractCamelContext : Started route14 (direct://storeAssociations)
2024-06-10 19:08:50.199 INFO 4124 --- [ main] o.a.c.impl.engine.AbstractCamelContext : Started route15 (direct://checkReplace)
2024-06-10 19:08:50.199 INFO 4124 --- [ main] o.a.c.impl.engine.AbstractCamelContext : Started route16 (direct://copyFolderMembership)
2024-06-10 19:08:50.199 INFO 4124 --- [ main] o.a.c.impl.engine.AbstractCamelContext : Started route17 (direct://deprecateTargetDocs)
2024-06-10 19:08:50.199 INFO 4124 --- [ main] o.a.c.impl.engine.AbstractCamelContext : Started route18 (direct://deprecateDocEntry)
2024-06-10 19:08:50.199 INFO 4124 --- [ main] o.a.c.impl.engine.AbstractCamelContext : Started route19 (direct://updateTime)
2024-06-10 19:08:50.200 INFO 4124 --- [ main] o.a.c.impl.engine.AbstractCamelContext : Started route20 (xds-iti18://xds-iti18)
2024-06-10 19:08:50.200 INFO 4124 --- [ main] o.a.c.impl.engine.AbstractCamelContext : Started route21 (direct://convertToObjRefs)
2024-06-10 19:08:50.200 INFO 4124 --- [ main] o.a.c.impl.engine.AbstractCamelContext : Started route22 (direct://findDocs)
2024-06-10 19:08:50.200 INFO 4124 --- [ main] o.a.c.impl.engine.AbstractCamelContext : Started route23 (direct://findSets)
2024-06-10 19:08:50.200 INFO 4124 --- [ main] o.a.c.impl.engine.AbstractCamelContext : Started route24 (direct://findFolders)
2024-06-10 19:08:50.200 INFO 4124 --- [ main] o.a.c.impl.engine.AbstractCamelContext : Started route25 (direct://getDocs)
2024-06-10 19:08:50.200 INFO 4124 --- [ main] o.a.c.impl.engine.AbstractCamelContext : Started route26 (direct://getFolders)
2024-06-10 19:08:50.200 INFO 4124 --- [ main] o.a.c.impl.engine.AbstractCamelContext : Started route27 (direct://getDocsAndAssocs)
2024-06-10 19:08:50.200 INFO 4124 --- [ main] o.a.c.impl.engine.AbstractCamelContext : Started route28 (direct://getFoldersForDoc)
2024-06-10 19:08:50.200 INFO 4124 --- [ main] o.a.c.impl.engine.AbstractCamelContext : Started route29 (direct://getRelatedDocs)
2024-06-10 19:08:50.200 INFO 4124 --- [ main] o.a.c.impl.engine.AbstractCamelContext : Started route30 (direct://getSets)
2024-06-10 19:08:50.200 INFO 4124 --- [ main] o.a.c.impl.engine.AbstractCamelContext : Started route31 (direct://getAssocs)
2024-06-10 19:08:50.200 INFO 4124 --- [ main] o.a.c.impl.engine.AbstractCamelContext : Started route32 (direct://getFolderAndContents)
2024-06-10 19:08:50.200 INFO 4124 --- [ main] o.a.c.impl.engine.AbstractCamelContext : Started route33 (direct://getSetAndContents)
2024-06-10 19:08:50.200 INFO 4124 --- [ main] o.a.c.impl.engine.AbstractCamelContext : Started route34 (xds-iti43://xds-iti43)
2024-06-10 19:08:50.200 INFO 4124 --- [ main] o.a.c.impl.engine.AbstractCamelContext : Apache Camel 3.21.3 (camel-1) started in 1s181ms (build:17ms init:874ms start:290ms)
2024-06-10 19:08:50.202 INFO 4124 --- [ main] o.o.i.commons.core.config.ContextFacade : Re-initializing the registry
2024-06-10 19:08:50.202 INFO 4124 --- [ main] c.s.c.c.SpringConfigurationPostProcessor : Number of extension beans: 1
2024-06-10 19:08:50.214 INFO 4124 --- [ main] work.mediway.ihe.XDSApplication : Started XDSApplication in 4.471 seconds (JVM running for 5.255)
2024-06-10 19:08:50.382 INFO 4124 --- [)-192.168.1.198] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring DispatcherServlet 'dispatcherServlet'
2024-06-10 19:08:50.395 INFO 4124 --- [)-192.168.1.198] o.s.web.servlet.DispatcherServlet : Initializing Servlet 'dispatcherServlet'
2024-06-10 19:08:50.397 INFO 4124 --- [)-192.168.1.198] o.s.web.servlet.DispatcherServlet : Completed initialization in 1 ms
Best regards
Bo