Web Services 为什么camel-cxf会抛出找不到端口类型ServiceConstructionException?

insrf1ej  于 2022-11-15  发布在  其他
关注(0)|答案(1)|浏览(167)

我有一个camel路由,它试图使用apache-cxf通过informatica Web服务登录。

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()); 
            });

当我运行这个程序时,我一直收到下面的错误(Could not find portType named {http://www.inf.com/dsh}InfIntegrationServicePortType):

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]

我已经尝试了几乎所有的东西,但我不能弄清楚我在这里错过了什么。任何帮助都非常感谢这里。

bfnvny8b

bfnvny8b1#

检查您是否正在使用接口类。从.Wsdl文件中,您将找到要用于serviceClass的服务{name}。

相关问题