apache / apache/camel-quarkus

My Apache Camel application in Quarkus exits through 2 different ports when calling 2 SOAP WebServices in the same logic

Open
#5,907 6 comments 0 reactions 0 assignees View on GitHub
area/soap
Dominant language
Java
Stars
302
Forks
232
Avg merge
1d 20h
Merged PRs (30d)
114

Description

I am currently working on a service using Apache Camel and Quarkus, in which I must call 2 SOAP Webservices, one that allows me to obtain a session id (called LGI Command) and the next allows me to consult the information from a mobile number. associated with it (Called LST_DYNSUB Command), passing the session id previously obtained with the LGI Command. The question is that these 2 calls must be made through the same port due to the policies of the application to be called where the aforementioned SOAP interfaces are located, called UDB, the UDB only admits a valid session id in the LST_DYNSUB command if the same port through which the LGI Command.

Testing in Postman does not give me problems and it can be seen that when testing both SOAP interfaces there are no problems, however, when I come to develop my waterfall logic in my Apache Camel and Quarkus development, it can be observed at the destination log level (UDB) that is being sent through different ports.

Called in postman and where it is observed that both interfaces arrive through the same ports:

![Sin título](https://github.com/apache/camel-quarkus/assets/31625237/448d9f2e-87f9-4bbd-abb6-7ba43a604053)

Called from my microservice with Apache Camel and Quarkus where it is evident that it is arriving through a different port, even though it is within the same logic:

![Sin título](https://github.com/apache/camel-quarkus/assets/31625237/284b4c26-4b37-480a-83b9-be2ad7703f38)

I attach the logic of my Red Route in Apache Camel:

**Class Rest Route**

```
@ApplicationScoped
public class RestRoute extends RouteBuilder {

private static final String SALIDA_MS = "Salida del MS ${exchangeProperty[bodyRs]}";
private static final String MSG_EXCEPTION = "Descripcion de la Exception: ${exception.message}";

private static final String DATE_LOG = "[${bean:BeanDate.getCurrentDateTime()}] ";
@ConfigProperty(name = "client.url.udb")
String urlUDB;

@ConfigProperty(name = "path.openapi")
String pathOpenapi;

@ConfigProperty(name = "descripcion.servicio")
String descriptionService;

private ConfigureSsl configureSsl;

private IGetCurrentDateTime getCurrentDateTime;

public RestRoute() {
getCurrentDateTime = new GetCurrentDateTime();
TimeZone.setDefault(TimeZone.getTimeZone("GMT-4"));
configureSsl = new ConfigureSsl();
}
@Override
public void configure() throws Exception {

BeanDate beanDate= new BeanDate();
getContext().getRegistry().bind("BeanDate", beanDate);

restConfiguration().bindingMode(RestBindingMode.json).dataFormatProperty("json.in.disableFeatures","FAIL_ON_UNKNOWN_PROPERTIES")
.apiContextPath(pathOpenapi)
.apiProperty("api.title","UdbLoginConnector")
.apiProperty("api.description",descriptionService)
.apiProperty("api-version","1.0.0")
.apiProperty("cors","true");
rest("/api/")
.produces("application/json")
.consumes("application/json")
.post("/deviceStatusConnector")
.type(Request.class)
.param().name("Request").type(RestParamType.body).description("Parametros de Entradas")
.required(true)
.endParam()
.outType(Response.class)
.param().name("Response").type(RestParamType.body).description("Parametros de Salidas")
.required(true)
.endParam().to("direct:pipeline");

from("direct:pipeline")
.doTry()
/*.to("bean-validator:validateRequest") */
.process(new DeviceStatusConnectorProcessorReq())
.log(DATE_LOG+"Datos de Entrada del MS: ${exchangeProperty[bodyRq]}")
.process(new UdbLgiCommandProcessorReq())
.log(DATE_LOG+"Datos de Entrada del WebService (SOAP) Comando-LGI UDB: ${exchangeProperty[wsRq]}")
.to(configureSsl.setupSSLContext(getCamelContext(), urlUDB))
.log(DATE_LOG+"Datos de Salida del el WebService (SOAP) Comando-LGI UDB: ${body}")
.process( new UdbLgiCommandProcessRes())
.log(DATE_LOG+"SessionId Obtenido Comando-LGI UDB: ${exchangeProperty[sessionId]}")
.log(DATE_LOG+"Codigo de Respuesta Comando-LGI UDB: ${exchangeProperty[resultCodeLgiCommand]}")
.log(DATE_LOG+"Descripcion de Respuesta Comando-LGI UDB: ${exchangeProperty[resultDescriptionLgiCommand]}")
.process(new UdbLstDynsubCommandProcessorReq())
.log(DATE_LOG+"Datos de Entrada del WebService (SOAP) Comando LST-DYNSUB: ${exchangeProperty[wsRq]}")
.log(DATE_LOG+"Header de Entrada del WebService (SOAP) Comando LST-DYNSUB: ${headers}")
.to(configureSsl.setupSSLContext(getCamelContext(), urlUDB))
.log(DATE_LOG+"Datos de Salida del WebService (SOAP) Comando LST-DYNSUB: ${body}")
.endDoTry();
}
}
```
**UdbLgiCommandProcessorReq**

```
@Slf4j
@ApplicationScoped
public class UdbLgiCommandProcessorReq implements Processor{

private final String usernameUdbLgiCommand = ConfigProvider.getConfig().getValue("username.udb.lgi.command", String.class);
private final String passwordUdbLgiCommand = ConfigProvider.getConfig().getValue("password.udb.lgi.command", String.class);

private final IUdbLgiCommandRequestMapping requestMapping;

public UdbLgiCommandProcessorReq() {
requestMapping = new UdbLgiCommandRequestMappingImpl();
}

@SuppressWarnings({ "deprecation", "unchecked", "rawtypes" })
@Override
public void process(Exchange exchange) throws Exception {

/*log.info("Request Json Entrada: "+udbLoginConnectorJsonReq.toString()); */
EnvelopeRqLgiCommand envelopeRqLgiCommand = requestMapping.toRequest(usernameUdbLgiCommand, passwordUdbLgiCommand);
String xmlWsRq = new GenericXml().toXmlString(envelopeRqLgiCommand);
/*log.info("Transformation to XML "+xmlWsRq); */
exchange.setProperty("wsRq", xmlWsRq.replaceAll("[\n\t\r]", ""));
exchange.getOut().setHeader(Exchange.CONTENT_TYPE, "application/xml");
exchange.getOut().setHeader(Exchange.HTTP_METHOD, "POST");
exchange.getOut().setBody(xmlWsRq);
}
}
```

**UdbLstDynsubCommandProcessorReq**

```
@Slf4j
@ApplicationScoped
public class UdbLstDynsubCommandProcessorReq implements Processor{

private final IUdbLstDynsubCommandRequestMapping requestMapping;

public UdbLstDynsubCommandProcessorReq() {
requestMapping = new UdbLstDynsubCommandRequestMappingImpl();
}

@SuppressWarnings({ "deprecation", "unchecked", "rawtypes" })
@Override
public void process(Exchange exchange) throws Exception {

/*log.info("Request Json Entrada: "+udbLoginConnectorJsonReq.toString()); */
String sessionId=exchange.getProperty("sessionId", String.class);
Request request = exchange.getProperty("deviceStatusConnectorRq", Request.class);
EnvelopeRqLstDynSubCommand envelopeRqLstDynSubCommand = requestMapping.toRequest(request.getUdbDeviceStatusConnectorRequest().getBodyRequest().getIsdn(), request.getUdbDeviceStatusConnectorRequest().getBodyRequest().getContent());
String xmlWsRq = new GenericXml().toXmlString(envelopeRqLstDynSubCommand);
/*log.info("Transformation to XML "+xmlWsRq); */
exchange.setProperty("wsRq", xmlWsRq.replaceAll("[\n\t\r]", ""));
exchange.getOut().setHeader(Exchange.CONTENT_TYPE, "application/xml");
exchange.getOut().setHeader(Exchange.HTTP_METHOD, "POST");
exchange.getOut().setHeader(Exchange.HTTP_PATH, sessionId);
exchange.getOut().setBody(xmlWsRq);
}
}
```

pom.xml

```

4.0.0
org.tmve.subscriber
device-status-connector
1.0.0-DEV

3.11.0
17
UTF-8
UTF-8
quarkus-bom
io.quarkus.platform
3.2.10.Final
true
3.0.0




${quarkus.platform.group-id}
${quarkus.platform.artifact-id}
${quarkus.platform.version}
pom
import


${quarkus.platform.group-id}
quarkus-camel-bom
${quarkus.platform.version}
pom
import





org.apache.camel.quarkus
camel-quarkus-rest-openapi


org.apache.camel.quarkus
camel-quarkus-bean-validator
3.7.0


org.apache.camel.quarkus
camel-quarkus-bean


org.apache.camel.quarkus
camel-quarkus-direct


org.apache.camel.quarkus
camel-quarkus-http


org.apache.camel.quarkus
camel-quarkus-jackson


org.apache.camel.quarkus
camel-quarkus-jaxb


org.apache.camel.quarkus
camel-quarkus-log


org.apache.camel.quarkus
camel-quarkus-rest


io.quarkus
quarkus-arc


org.projectlombok
lombok
1.18.22


org.apache.camel.quarkus
camel-quarkus-openapi-java


io.quarkus
quarkus-smallrye-openapi


org.webjars
swagger-ui
4.11.1


org.apache.camel.quarkus
camel-quarkus-opentelemetry


io.quarkus
quarkus-opentelemetry-exporter-otlp


io.quarkus
quarkus-junit5
test


io.quarkus
quarkus-jacoco
test


io.rest-assured
rest-assured


org.apache.cxf
cxf-codegen-plugin
4.0.3


org.apache.camel
camel-cxf-soap
3.19.0





${quarkus.platform.group-id}
quarkus-maven-plugin
${quarkus.platform.version}
true



build
generate-code
generate-code-tests





maven-compiler-plugin
${compiler-plugin.version}


-parameters




org.apache.cxf
cxf-codegen-plugin
4.0.3


generate-sources
generate-sources

${basedir}/src/main/java


${basedir}/src/main/resources/wsdl/HSS9860.wsdl




wsdl2java





maven-surefire-plugin
${surefire-plugin.version}


org.jboss.logmanager.LogManager
${maven.home}




maven-failsafe-plugin
${surefire-plugin.version}



integration-test
verify





${project.build.directory}/${project.build.finalName}-runner

org.jboss.logmanager.LogManager
${maven.home}







native


native



false
native


```

Does this have any logical explanation as to why it could be happening in Apache Camel and Quarkus?

Contributor guide

No contributing guide indexed for this repository

Research direction

Start with RestRoute and the two processor classes, then inspect the ConfigureSsl setup used by both HTTP calls and the Camel HTTP dependency in pom.xml. Reproduce the two-call flow and compare the outbound connections or ports; done means both SOAP requests satisfy the UDB session requirement, with evidence from logs or a focused test.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
api, backend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.