CXF Web 服务和多个服务端点

发布于 2025-01-09 02:33:18 字数 914 浏览 4 评论 0原文

我对使用 Spring Boot 的 CXF 和 JAX-WS 很陌生。到目前为止,我有一个带有一个端点的服务,但接下来我想通过发布新端点来将另一个端点添加到同一服务,因为

@Configuration
public class CXFSvcConfig
{
    @Autowired
    protected Bus bus;
    
   @Bean
   @ConditionalOnMissingBean
   public Service mySvc()
   {
      return new Service();
   }


   @Bean
    @ConditionalOnMissingBean    
    public Endpoint testService1()
    {
        final EndpointImpl endpoint = new EndpointImpl(bus, mySvc());
        endpoint.publish("/Service1");
        return endpoint;
    }

   @Bean
   @ConditionalOnMissingBean
   public Endpoint testService2()
   {
      final EndpointImpl endpoint2 = new EndpointImpl(bus, mySvc());
      endpoint2.publish("/Service2");
      return endpoint2;
   }
}

/Service1 端点将正常工作(将显示 WSDL),但 /当我希望看到与 /Service1 相同的 WSDL 时,Service2 将抛出 Service not found

我做错了什么?

I'm new to the CXF and JAX-WS using with Spring Boot. So far I have a service with one endpoint but as next I want to add another endpoint to the same service by publishing new endpoint as

@Configuration
public class CXFSvcConfig
{
    @Autowired
    protected Bus bus;
    
   @Bean
   @ConditionalOnMissingBean
   public Service mySvc()
   {
      return new Service();
   }


   @Bean
    @ConditionalOnMissingBean    
    public Endpoint testService1()
    {
        final EndpointImpl endpoint = new EndpointImpl(bus, mySvc());
        endpoint.publish("/Service1");
        return endpoint;
    }

   @Bean
   @ConditionalOnMissingBean
   public Endpoint testService2()
   {
      final EndpointImpl endpoint2 = new EndpointImpl(bus, mySvc());
      endpoint2.publish("/Service2");
      return endpoint2;
   }
}

/Service1 endpoint will work fine (will display WSDL) but /Service2 will throw Service not found when I will expect to see the same WSDL as is for /Service1

What am I doing wrong?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文