I have a camel route which is trying to login via an informatica web service using apache-cxf. This is how the route looks :
String WS_URL = "cxf://http://infIntegration?serviceClass=com.inf.dsh.InfIntegrationService&wsdlURL=/wsdl/InfService.wsdl&dataFormat=RAW";
JaxbDataFormat soapDF = new JaxbDataFormat();
JAXBContext context = JAXBContext.newInstance(InfLoginRequest.class);
soapDF.setContext(context);
from("timer://simpleTimer?period=2000") .setBody()
.simple("This is a test message") .to("direct:customerServiceClient");
from("direct:customerServiceClient") .log(">>> Getting Logged...........")
.process(exchange -> {
exchange.getIn().setHeader(Exchange.CONTENT_TYPE, "application/xml");
exchange.getIn().setBody(new ObjectFactory().createInfLogin(getInfLoginDetail()),
InfLoginRequest.class);
})
.marshal(soapDF)
.to(WS_URL)
.unmarshal(soapDF)
.process(exchange -> {
exchange.getMessage().getBody();
log.info("Response : " + exchange.getIn().getBody());
});
When I run this I keep getting this error (Could not find portType named {http://www.inf.com/dsh}InfIntegrationServicePortType
) down below :
Caused by: org.apache.cxf.service.factory.ServiceConstructionException: Could not find portType named {http://www.inf.com/dsh}InfIntegrationServicePortType
at org.apache.cxf.wsdl.service.factory.ReflectionServiceFactoryBean.getInterfaceInfo(ReflectionServiceFactoryBean.java:633) ~[cxf-rt-wsdl-3.4.4.jar:3.4.4]
at org.apache.cxf.wsdl.service.factory.ReflectionServiceFactoryBean.initializeWSDLOperations(ReflectionServiceFactoryBean.java:641) ~[cxf-rt-wsdl-3.4.4.jar:3.4.4]
at org.apache.cxf.wsdl.service.factory.ReflectionServiceFactoryBean.buildServiceFromWSDL(ReflectionServiceFactoryBean.java:417) ~[cxf-rt-wsdl-3.4.4.jar:3.4.4]
at org.apache.cxf.wsdl.service.factory.ReflectionServiceFactoryBean.initializeServiceModel(ReflectionServiceFactoryBean.java:527) ~[cxf-rt-wsdl-3.4.4.jar:3.4.4]
at org.apache.cxf.wsdl.service.factory.ReflectionServiceFactoryBean.create(ReflectionServiceFactoryBean.java:262) ~[cxf-rt-wsdl-3.4.4.jar:3.4.4]
at org.apache.cxf.frontend.AbstractWSDLBasedEndpointFactory.createEndpoint(AbstractWSDLBasedEndpointFactory.java:103) ~[cxf-rt-frontend-simple-3.4.4.jar:3.4.4]
at org.apache.cxf.frontend.ClientFactoryBean.create(ClientFactoryBean.java:91) ~[cxf-rt-frontend-simple-3.4.4.jar:3.4.4]
at org.apache.camel.component.cxf.CxfEndpoint.createClient(CxfEndpoint.java:635) ~[camel-cxf-3.11.2.jar:3.11.2]
at org.apache.camel.component.cxf.CxfProducer.doStart(CxfProducer.java:79) ~[camel-cxf-3.11.2.jar:3.11.2]
at org.apache.camel.support.service.BaseService.start(BaseService.java:119) ~[camel-api-3.11.2.jar:3.11.2]
at org.apache.camel.support.service.ServiceHelper.startService(ServiceHelper.java:113) ~[camel-api-3.11.2.jar:3.11.2]
at org.apache.camel.impl.engine.AbstractCamelContext.internalAddService(AbstractCamelContext.java:1462) ~[camel-base-engine-3.11.2.jar:3.11.2]
at org.apache.camel.impl.engine.AbstractCamelContext.addService(AbstractCamelContext.java:1383) ~[camel-base-engine-3.11.2.jar:3.11.2]
at org.apache.camel.processor.SendProcessor.doStart(SendProcessor.java:247) ~[camel-core-processor-3.11.2.jar:3.11.2]
at org.apache.camel.support.service.BaseService.start(BaseService.java:119) ~[camel-api-3.11.2.jar:3.11.2]
I have tried out almost everything , but I am not able to figure out what am I missing here . Any help is greatly appreciated here .
Check that you are using the interface class. From .Wsdl file you will find the service {name} that is to be used for serviceClass.