Good afternoon, I am currently working with Apache Camel and Quarkus, I have the following error when calling a Web Service in SOAP, it responds with an http code 307
org.apache.camel.http.base.HttpOperationFailedException: HTTP operation failed invoking http://10.164.232.12:8001/ with statusCode: 307, redirectLocation: http://10.164.232.12:8001/002245245
This error happened to me in postman and what I did was enable Automatically follow redirects so that it returned the code 200:
Before:
After:
How can I do in Apache Camel to be able to receive the response in code http 200?
My last code before calling the WS is the following:
RestRoute
public class RestRoute extends RouteBuilder {
@ConfigProperty(name = "client.ubd.loginConnector")
String udbLgiCommand;
@ConfigProperty(name = "path.openapi")
String pathOpenapi;
@ConfigProperty(name = "descripcion.servicio")
String descriptionService;
private IGetCurrentDateTime getCurrentDateTime;
public RestRoute() {
getCurrentDateTime = new GetCurrentDateTime();
TimeZone.setDefault(TimeZone.getTimeZone("GMT-4"));
}
@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("/udbLoginConnector")
.type(UdbLoginConnectorJsonReq.class)
.param().name("UdbLoginConnectorJsonReq").type(RestParamType.body).description("Parametros de Entradas")
.required(true)
.endParam()
.outType(UdbLoginConnectorJsonResp.class)
.param().name("UdbLoginConnectorJsonResp").type(RestParamType.body).description("Parametros de Salidas")
.required(true)
.endParam().to("direct:pipeline");
from("direct:pipeline")
.doTry()
/*.to("bean-validator:validateUdbLoginConnectorJsonReq") */
.process(new UdbLoginConnectorProcessorReq())
.log("["+"${bean:BeanDate.getCurrentDateTime()}"+"] "+ "Datos de Entrada del MS: ${exchangeProperty[bodyRq]}")
.process(new UdbLgiCommandProcessorReq())
.log("["+"${bean:BeanDate.getCurrentDateTime()}"+"] "+ "Datos de Entrada del WS de K2: ${exchangeProperty[wsRq]}")
.to(udbLgiCommand)
.log("["+"${bean:BeanDate.getCurrentDateTime()}"+"] "+ "Datos de Salida del WS de K2: ${body}")
.endDoTry();
}
}
UdbLgiCommandProcessorReq
@Slf4j
public class UdbLgiCommandProcessorReq implements Processor{
private IUdbLgiCommandRequestMapping requestMapping;
public UdbLgiCommandProcessorReq() {
requestMapping = new UdbLgiCommandRequestMappingImpl();
}
@SuppressWarnings({ "deprecation", "unchecked", "rawtypes" })
@Override
public void process(Exchange exchange) throws Exception {
UdbLoginConnectorJsonReq udbLoginConnectorJsonReq = (UdbLoginConnectorJsonReq) exchange.getProperty("udbLoginConnectorJsonReq");
/*log.info("Request Json Entrada: "+udbLoginConnectorJsonReq.toString()); */
EnvelopeRq envelopeRq = requestMapping.toRequest(udbLoginConnectorJsonReq);
String xmlWsRq = new GenericXml().toXmlString(envelopeRq);
/*log.info("Transformacion a XML "+xmlWsRq); */
exchange.setProperty("wsRq", xmlWsRq.replaceAll("[\n\t\r]", ""));
exchange.getOut().setHeader(Exchange.CONTENT_TYPE, "text/xml");
exchange.getOut().setHeader(Exchange.HTTP_METHOD, "POST");
exchange.getOut().setBody(xmlWsRq);
}
}

