Apache Camel Spring-WS 路由未初始化
Apache Camel Spring-WS route not initializing
我正在努力处理 Spring-WS 路由,我想在我的 Spring-boot 应用程序中添加它。我在启动时不断收到以下异常:
Caused by: java.lang.IllegalArgumentException: No instance of CamelSpringWSEndpointMapping found in Spring ApplicationContext. This bean is required for Spring-WS consumer support (unless the 'spring-ws:beanname:' URI scheme is used)
at org.apache.camel.component.spring.ws.SpringWebserviceComponent.addEndpointMappingToConfiguration(SpringWebserviceComponent.java:142)
at org.apache.camel.component.spring.ws.SpringWebserviceComponent.addConsumerConfiguration(SpringWebserviceComponent.java:83)
at org.apache.camel.component.spring.ws.SpringWebserviceComponent.createEndpoint(SpringWebserviceComponent.java:67)
at org.apache.camel.impl.DefaultComponent.createEndpoint(DefaultComponent.java:114)
at org.apache.camel.impl.DefaultCamelContext.getEndpoint(DefaultCamelContext.java:568)
... 40 common frames omitted
这很奇怪,因为我在我的 Spring 配置中明确添加了 CamelEndpointMapping(从 CamelSpringWSEndpointMapping 扩展),如下所示:
@EnableWs
@SpringBootApplication
public class Application
{
public static void main(String[] args)
{
SpringApplication.run(Application.class, args);
}
@Bean
public ServletRegistrationBean messageDispatcherServlet(ApplicationContext applicationContext)
{
MessageDispatcherServlet messageDispatcherServlet = new MessageDispatcherServlet();
messageDispatcherServlet.setApplicationContext(applicationContext);
messageDispatcherServlet.setTransformWsdlLocations(true);
return new ServletRegistrationBean(messageDispatcherServlet, "/soap/*");
}
@Bean
public CamelEndpointMapping endpointMapping()
{
return new CamelEndpointMapping();
}
}
我的路线:
@Component
public class MyRoutes extends RouteBuilder
{
@Override
public void configure() throws Exception
{
from("spring-ws:soapaction:http://example.com/myservice")
.to("log:cameltest?level=DEBUG");
}
}
我在这里做错了什么?您可以在 GitHub 上找到我的示例项目的完整源代码:https://github.com/verhage/cameltest
看起来错误消息具有误导性。
您的 URL 需要如下所示:
spring-ws:soapaction:XXX?endpointMapping=endpointMapping
(通过调试SpringWebserviceComponent.addConsumerConfiguration和步进发现)
我正在努力处理 Spring-WS 路由,我想在我的 Spring-boot 应用程序中添加它。我在启动时不断收到以下异常:
Caused by: java.lang.IllegalArgumentException: No instance of CamelSpringWSEndpointMapping found in Spring ApplicationContext. This bean is required for Spring-WS consumer support (unless the 'spring-ws:beanname:' URI scheme is used)
at org.apache.camel.component.spring.ws.SpringWebserviceComponent.addEndpointMappingToConfiguration(SpringWebserviceComponent.java:142)
at org.apache.camel.component.spring.ws.SpringWebserviceComponent.addConsumerConfiguration(SpringWebserviceComponent.java:83)
at org.apache.camel.component.spring.ws.SpringWebserviceComponent.createEndpoint(SpringWebserviceComponent.java:67)
at org.apache.camel.impl.DefaultComponent.createEndpoint(DefaultComponent.java:114)
at org.apache.camel.impl.DefaultCamelContext.getEndpoint(DefaultCamelContext.java:568)
... 40 common frames omitted
这很奇怪,因为我在我的 Spring 配置中明确添加了 CamelEndpointMapping(从 CamelSpringWSEndpointMapping 扩展),如下所示:
@EnableWs
@SpringBootApplication
public class Application
{
public static void main(String[] args)
{
SpringApplication.run(Application.class, args);
}
@Bean
public ServletRegistrationBean messageDispatcherServlet(ApplicationContext applicationContext)
{
MessageDispatcherServlet messageDispatcherServlet = new MessageDispatcherServlet();
messageDispatcherServlet.setApplicationContext(applicationContext);
messageDispatcherServlet.setTransformWsdlLocations(true);
return new ServletRegistrationBean(messageDispatcherServlet, "/soap/*");
}
@Bean
public CamelEndpointMapping endpointMapping()
{
return new CamelEndpointMapping();
}
}
我的路线:
@Component
public class MyRoutes extends RouteBuilder
{
@Override
public void configure() throws Exception
{
from("spring-ws:soapaction:http://example.com/myservice")
.to("log:cameltest?level=DEBUG");
}
}
我在这里做错了什么?您可以在 GitHub 上找到我的示例项目的完整源代码:https://github.com/verhage/cameltest
看起来错误消息具有误导性。
您的 URL 需要如下所示:
spring-ws:soapaction:XXX?endpointMapping=endpointMapping
(通过调试SpringWebserviceComponent.addConsumerConfiguration和步进发现)