Camel CXF无法找到端点/端口

时间:2016-05-26 07:30:53

标签: spring web-services apache-camel cxf endpoint

概述 我在Spring启动项目中创建了一个camel路由,并且spring boot正常运行。

我的路线如下:

  • 从activemq
  • 获取JSON格式的对象
  • 将其转换为SOAP Web服务的预期格式
  • 将转换后的数据提交给webservice endpint

我的路由器类如下:

@Slf4j
@Component
public class SaleTransactionRoutes extends RouteBuilder {

    @Produce(uri=ServiceEndpoints.TMR_WS)
    private ProducerTemplate producer;

    @Override
    public void configure() throws Exception {
        this.getContext().setTracing(true);
        this.getContext().getProperties().put(Exchange.LOG_DEBUG_BODY_STREAMS, "true");

        log.info("SaleTransactionRoutes has just been started ...");


        JacksonDataFormat saleTransactionFormat = new JacksonDataFormat(SaleTransaction.class);

        //@formatter:off
        from(QueueNames.SALETRANSACTION_REQUESTS_QUEUE)
                .routeId("SaleTransactionRoute")
                .unmarshal(saleTransactionFormat)
                .beanRef("saleTransactionTransformer", "prepareSaleTransactionRequest")
                .end()
                .setHeader("operationName", constant("Create_Sales_Order_OB_SI"))
                .setHeader("SOAPAction", constant("http://sap.com/xi/WebService/soap1.1"))
                .doTry()
                .process(e->{
                    log.debug(e.getIn().getBody(String.class));
                    producer.sendBody(e.getIn().getBody());
                })
                .process(e->{
                    log.debug(e.getIn().getBody(String.class));
                    MessageContentsList contents = e.getIn().getBody(MessageContentsList.class);
                })
                    .log(LoggingLevel.DEBUG, "TMR Webservice has just been called successfully.")
                .doCatch(Exception.class)
                    .log(LoggingLevel.ERROR, "TMR Webservice threw exception");
         //@formatter:on

    }
}

cxf.xml文件如下:

<beans xmlns="http://www.springframework.org/schema/beans"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:cxf="http://camel.apache.org/schema/cxf"
       xsi:schemaLocation="
        http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
        http://camel.apache.org/schema/cxf http://camel.apache.org/schema/cxf/camel-cxf.xsd
        http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd">

    <cxf:cxfEndpoint id="tmrSaleTransactionService" address="{{tmr.saletransaction.uri}}"
                     wsdlURL="META-INF/wsdl/TmrSaleTransaction.wsdl"
                     serviceClass="au.gov.qld.qss.tmr_appl.albert.CreateSalesOrderOBSI">

        <cxf:inInterceptors>
            <ref bean="loggingInInterceptor" />
        </cxf:inInterceptors>
        <cxf:outInterceptors>
            <ref bean="loggingOutInterceptor" />
        </cxf:outInterceptors>
        <cxf:outFaultInterceptors>
            <ref bean="faultOutInterceptor" />
        </cxf:outFaultInterceptors>
    </cxf:cxfEndpoint>
</beans>

application.properties文件如下:

server.port=8084

# TMR Services URI
tmr.saletransaction.uri=https://sampleEndpointAddress

# Camel routes
camel.rouge.uri.jms.saletransaction.requests=activemq:queue:saletransaction:requests

# CXF URIs
camel.route.uri.tmrSaleTransactionWS=cxf:bean:tmrSaleTransactionService

##########################
# ActiveMQ Configuration #
##########################
spring.activemq.broker-url=tcp://ip-address:61616
spring.activemq.pooled=true
spring.activemq.user=admin
spring.activemq.password=password

# Logging Level
#logging.level.*=DEBUG
logging.level.org.springframework=DEBUG

Application类如下:

@SpringBootApplication
@EnableAutoConfiguration(exclude = {VelocityAutoConfiguration.class})
@ImportResource("classpath:/META-INF/cxf/cxf.xml")
public class TmrServicesApplication {
    public static void main(String[] args) {
        SpringApplication.run(TmrServicesApplication.class, args);
    }

    @Bean(name = "loggingInInterceptor")
    public LoggingInInterceptor loggingInInterceptor() {
        return new LoggingInInterceptor() {
            @Override
            public void handleMessage(Message message) throws Fault {
                super.handleMessage(message);
            }
        };
    }

    @Bean(name = "loggingOutInterceptor")
    public LoggingOutInterceptor loggingOutInterceptor() {
        return new LoggingOutInterceptor() {
            @Override
            public void handleMessage(Message message) throws Fault {
                super.handleMessage(message);
            }
        };
    }

    @Bean(name = "faultOutInterceptor")
    public FaultOutInterceptor fault() {
        return new FaultOutInterceptor() {
            @Override
            public void handleMessage(Message message) throws Fault {
                super.handleMessage(message);
            }
        };
    }
}

问题

当任何请求通过camel从队列中获取时,无法成功提交给Soap Web服务,并且驼峰路由日志如下:

Could not find endpoint/port for {urn:qss.qld.gov.au:TMR_APPL:Albert}Create_Sales_Order_OB_SIPort in wsdl. Using {urn:qss.qld.gov.au:TMR_APPL:Albert}HTTPS_Port. 

除了在我更改application.properties文件中的端点地址时,行为中没有发生任何变化。

我认为cxf.xml文件中的某些内容未正确配置但我不知道是什么。

0 个答案:

没有答案