I am trying to make requests to dedicated WSDL server with the help of Apache Camel CXF.
I have the WSDL URL:
http://www.learnwebservices.com/services/tempconverter?wsdl
I've made the Java classes of WSDL using the cxf-codegen-plugin:
org.apache.cxf
cxf-codegen-plugin
3.4.2
generate-sources
generate-sources
wsdl2java
${basedir}/src/main/resources/wsdl/tempconverter.wsdl
office.planet.integrations.merlion
I have the following Camel route:
@Component
public class MerlionRoute
extends RouteBuilder {
@Override
public void configure() throws Exception {
from("direct:celsius-to-fahrenheit")
.process(exchange -> {
System.out.println("HELLO!!!!!");
CelsiusToFahrenheitRequest c = new CelsiusToFahrenheitRequest();
c.setTemperatureInCelsius(Double.valueOf(exchange.getIn().getHeader("num").toString()));
exchange.getIn().setBody(c);
})
.setHeader(CxfConstants.OPERATION_NAME, constant("CelsiusToFahrenheit"))
.setHeader(CxfConstants.OPERATION_NAMESPACE, constant("{{endpoint.namespace}}"))
.to("cxf:bean:cxfConvertTemp")
.process(exchange -> {
System.out.println("WE ARE HERE");
MessageContentsList response = (MessageContentsList) exchange.getIn().getBody();
CelsiusToFahrenheitResponse r = (CelsiusToFahrenheitResponse) response.get(0);
exchange.getIn().setBody("Temp in Farenheit: "+r.getTemperatureInFahrenheit());
System.out.println(r.getTemperatureInFahrenheit());
})
.end();
}
}
The Bean class of the EndPoint:
@Configuration
public class CxfBeans {
@Value("${endpoint.wsdl}")
private String SOAP_URL;
@Bean(name = "cxfConvertTemp")
public CxfEndpoint buildCxfEndpoint() {
CxfEndpoint cxf = new CxfEndpoint();
cxf.setAddress(SOAP_URL);
cxf.setServiceClass(TempConverterEndpoint.class);
cxf.setWsdlURL(SOAP_URL);
return cxf;
}
}
And the WSDL endpoint:
endpoint.wsdl=
http://www.learnwebservices.com/services/tempconverter?wsdl
endpoint.namespace=
http://learnwebservices.com/services/tempconverter
When I am launching the project, my route starts, but nothing happens. Only this I can see:
2022-03-31 18:41:44.933 INFO 44313 --- [ restartedMain] o.a.c.w.s.f.ReflectionServiceFactoryBean : Creating Service {
http://learnwebservices.com/services/tempconverter}TempConverterEndpointService from WSDL:
http://www.learnwebservices.com/services/tempconverter?wsdl
How shall I request the data from WSDL server within the Camel CXF? What am I doing wrong?
JavaScript questions and answers, JavaScript questions pdf, JavaScript question bank, JavaScript questions and answers pdf, mcq on JavaScript pdf, JavaScript questions and solutions, JavaScript mcq Test , Interview JavaScript questions, JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)