我面临的挑战是,我有一个WSDL文件,其中包含更多的服务定义。
----- 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配置类
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个服务,我无法弄清楚。
发布于 2017-09-05 08:43:14
您可能想看看这个教程,它准确地描述了您的用例和堆栈。
简言之:
ServletRegistrationBean提供一个cxfServlet、一个SpringBus和一个端点。(很像你发布的代码。)甚至可能是本教程中的评论)https://stackoverflow.com/questions/43074626
复制相似问题