java cxf生成的wsdl:将soap地址位置协议更改为https
我将spring boot ws应用程序与apache cxf结合使用,以提供SOAP web服务。所有配置的URL都使用相对路径,因此应用程序可以灵活部署
在生产环境中,应用程序在负载平衡器后面运行,并强制客户端使用https。但是生成的wsdl保留其http协议,尽管wsdl本身是使用https公开的
这是spring端点配置:
@Bean
public Endpoint endpoint() {
EndpointImpl endpoint = new EndpointImpl(springBus(), requestStatusApplicationService());
RequestStatusReceiverService requestStatusReceiverService = requestStatusReceiverService();
endpoint.setServiceName(requestStatusReceiverService.getServiceName());
endpoint.setWsdlLocation(requestStatusReceiverService.getWSDLDocumentLocation().toString()); // also a relative path
endpoint.publish("/relative-path-endpoint");
return endpoint;
}
如何调整生成的wsdl,使其切换到https? 或者更好:有没有可能强制协议像公开的wsdl本身一样使用相同的wsdl
最好的, 拉尔斯
# 1 楼答案
我在项目中也遇到了类似的问题,我通过使用spring引导参数解决了这个问题。我们有一个ngnix服务器,它接收请求并转发到具有spring boot应用程序的后端机器
在ngnix配置中添加了以下参数
后来,在spring boot应用程序中添加了以下参数
此服务器开始向URL添加https后
# 2 楼答案
在spring boot应用程序中,如果您使用的是cxf框架,那么您可以添加自定义拦截器来传递自定义url
你需要在你的配置文件中这样配置这个拦截器