You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by "cesarjv (via GitHub)" <gi...@apache.org> on 2024/03/21 12:06:14 UTC

[I] My Apache Camel application in Quarkus exits through 2 different ports when calling 2 SOAP WebServices in the same logic [camel-quarkus]

cesarjv opened a new issue, #5907:
URL: https://github.com/apache/camel-quarkus/issues/5907

   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);
   	}
   }
   ```
   
   Does this have any logical explanation as to why it could be happening in Apache Camel and Quarkus?
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] My Apache Camel application in Quarkus exits through 2 different ports when calling 2 SOAP WebServices in the same logic [camel-quarkus]

Posted by "jamesnetherton (via GitHub)" <gi...@apache.org>.
jamesnetherton commented on issue #5907:
URL: https://github.com/apache/camel-quarkus/issues/5907#issuecomment-2012219916

   Maybe due to HTTP connection pooling, keep-alive etc?
   
   What are you using as the HTTP client to interact with the SOAP services?


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] My Apache Camel application in Quarkus exits through 2 different ports when calling 2 SOAP WebServices in the same logic [camel-quarkus]

Posted by "ppalaga (via GitHub)" <gi...@apache.org>.
ppalaga commented on issue #5907:
URL: https://github.com/apache/camel-quarkus/issues/5907#issuecomment-2013944015

   @cesarjv I understand that you are writing a SOAP client application calling two external SOAP endpoints. From what you have shown, it is not clear, how you send the request to those endpoints. 
   .to(configureSsl.setupSSLContext(getCamelContext(), urlUDB))` seems to be the part sending the request to the remote SOAP endpoint. Please have a look how is the remote address and port set. Is perhaps some loadbalancer (that sends round robin to several ports) between the client and service?
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] My Apache Camel application in Quarkus exits through 2 different ports when calling 2 SOAP WebServices in the same logic [camel-quarkus]

Posted by "jamesnetherton (via GitHub)" <gi...@apache.org>.
jamesnetherton commented on issue #5907:
URL: https://github.com/apache/camel-quarkus/issues/5907#issuecomment-2012339196

   > @jamesnetherton As an http client I am using POSTMAN to test SOAP interfaces
   
   I mean in your Camel application. What's sending the SOAP request?


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] My Apache Camel application in Quarkus exits through 2 different ports when calling 2 SOAP WebServices in the same logic [camel-quarkus]

Posted by "cesarjv (via GitHub)" <gi...@apache.org>.
cesarjv commented on issue #5907:
URL: https://github.com/apache/camel-quarkus/issues/5907#issuecomment-2013979228

   With these classes I send the application
   
   The ConfigureSSL class is used to configure the call using SSL:
   
   
   
   
   
   ```
   @Slf4j
   @SuppressWarnings({})
   @ApplicationScoped
   public class ConfigureSsl {
   	
   	private final String password = ConfigProvider.getConfig().getValue("client.ssl.password", String.class);
   	private final String resource = ConfigProvider.getConfig().getValue("client.ssl.resource", String.class);
   	
   	 public Endpoint setupSSLContext(CamelContext camelContext, String url) throws Exception {
   
   	        KeyStoreParameters keyStoreParameters = new KeyStoreParameters();
   	        keyStoreParameters.setResource(resource);
   	        keyStoreParameters.setPassword(password);
   
   	        KeyManagersParameters keyManagersParameters = new KeyManagersParameters();
   	        keyManagersParameters.setKeyStore(keyStoreParameters);
   	        keyManagersParameters.setKeyPassword(password);
   
   	        TrustManagersParameters trustManagersParameters = new TrustManagersParameters();
   	        trustManagersParameters.setKeyStore(keyStoreParameters);
   
   	        SSLContextParameters sslContextParameters = new SSLContextParameters();
   	        sslContextParameters.setKeyManagers(keyManagersParameters);
   	        sslContextParameters.setTrustManagers(trustManagersParameters);
   
   	        HttpComponent httpComponent = camelContext.getComponent("https", HttpComponent.class);
   	        httpComponent.setSslContextParameters(sslContextParameters);
   	        httpComponent.setX509HostnameVerifier(new AllowAllHostnameVerifier());
   
   	        return httpComponent.createEndpoint(url);
   	    }
   }
   ```
   
   The udbUrl variable refers to the IP variable that is called and is found in the properties:
   
   ResRoute
   
   ```
       @ConfigProperty(name = "client.url.udb")
       String urlUDB;
   ```
   application.properties
   
   `client.url.udb=${UBICATION_URL_UDB:https://10.160.12.181:8001?bridgeEndpoint=false&?throwExceptionOnFailure=false}`
   
   No, the SOAP external IP is not governed by a LoadBalancer, it is a unique IP


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] My Apache Camel application in Quarkus exits through 2 different ports when calling 2 SOAP WebServices in the same logic [camel-quarkus]

Posted by "cesarjv (via GitHub)" <gi...@apache.org>.
cesarjv commented on issue #5907:
URL: https://github.com/apache/camel-quarkus/issues/5907#issuecomment-2012321079

   As an http client I am using POSTMAN to test SOAP interfaces


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] My Apache Camel application in Quarkus exits through 2 different ports when calling 2 SOAP WebServices in the same logic [camel-quarkus]

Posted by "cesarjv (via GitHub)" <gi...@apache.org>.
cesarjv commented on issue #5907:
URL: https://github.com/apache/camel-quarkus/issues/5907#issuecomment-2012471443

   This is what I sent in the 2 requests
   
   COMANDO LGI
   
   https://10.164.232.99:8001
   
   ```
   <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:lgi="http://www.huawei.com/HLR9820/LGI">
       <soapenv:Header/>
       <soapenv:Body>
           <lgi:LGI>
               <lgi:OPNAME>OPENG</lgi:OPNAME>
               <lgi:PWD>{{passwordUDB}}</lgi:PWD>
               <lgi:HLRSN>1</lgi:HLRSN>
           </lgi:LGI>
       </soapenv:Body>
   </soapenv:Envelope>
   ```
   
   COMANDO LST_DYNSUB
   
   https://10.164.232.99:8001/sessionId
   
   ```
   <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:lst="http://www.huawei.com/HLR9820/LST_DYNSUB">
       <soapenv:Header/>
       <soapenv:Body>
           <lst:LST_DYNSUB>
               <lst:ISDN>xxxxxxxxx</lst:ISDN>
               <lst:CONTENT>0</lst:CONTENT>
           </lst:LST_DYNSUB>
       </soapenv:Body>
   </soapenv:Envelope>
   ```
   
   Do you require more details?
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org