首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >如何使用多个服务wsdl配置Spring配置

如何使用多个服务wsdl配置Spring配置
EN

Stack Overflow用户
提问于 2017-03-28 16:09:51
回答 1查看 1.5K关注 0票数 0

我面临的挑战是,我有一个WSDL文件,其中包含更多的服务定义。

代码语言:javascript
复制
----- Customer WSDL file, can not change it ----
  <service name="DocumentOperationService">
    <port name="DocumentOperationPort" binding="tns:DocumentOperationBinding">
      <soap:address location="REPLACE_WITH_ACTUAL_URL" />
    </port>
  </service>

  <service name="PermissionEvaluatorService">
    <port name="PermissionEvaluatorPort" binding="tns:PermissionEvaluatorBinding">
      <soap:address location="REPLACE_WITH_ACTUAL_URL" />
    </port>
  </service>

  <service name="ConfigurationResolverService">
    <port name="ConfigurationResolverPort" binding="tns:ConfigurationResolverBinding">
      <soap:address location="REPLACE_WITH_ACTUAL_URL" />
    </port>
  </service>
------

如何配置Spring配置类

代码语言:javascript
复制
import org.springframework.context.annotation.Configuration;

@Configuration
public class WebServiceConfiguration {
...
    @Bean
    public Endpoint endpoint() {
        EndpointImpl endpoint = new EndpointImpl(springBus(), dmsPortService());

        // CXF JAX-WS implementation relies on the correct ServiceName as QName-Object with
        // the name-Attribute´s text <wsdl:service name="Weather"> and the targetNamespace
        // "http://www.codecentric.de/namespace/weatherservice/"
        // Also the WSDLLocation must be set
        endpoint.setServiceName(dmsOperationService().getServiceName());
        endpoint.setWsdlLocation(dmsOperationService().getWSDLDocumentLocation().toString());
//        endpoint.setWsdlLocation("classpath:/service-api-definition/journalexportservice.wsdl");
        endpoint.publish("/DocumentOperation");
        return endpoint;
    }

    @Bean
    public DocumentOperationService dmsOperationService() {
        // Needed for correct ServiceName & WSDLLocation to publish contract first incl. original WSDL
        return new DocumentOperationService();
    }

所有3项服务都已加载。在我只能加载一个服务的时刻,我找不到如何做到这一点的任何例子。我有3个配置文件,但只有最后一个是活动的,以及如何在同一个配置文件中配置3个服务,我无法弄清楚。

EN

回答 1

Stack Overflow用户

发布于 2017-09-05 08:43:14

您可能想看看这个教程,它准确地描述了您的用例和堆栈。

简言之:

  • 您的配置Bean需要为ServletRegistrationBean提供一个cxfServlet、一个SpringBus和一个端点。(很像你发布的代码。)甚至可能是本教程中的评论)
  • 端点应该指向整个wdsl位置。
  • 然后,您需要实现一个服务,该服务包含所有预期的webservices。
  • 在此服务中,每个webservice需要一个方法。
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/43074626

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档