Java cxf生成的wsdl:将soap地址位置协议更改为https
我将SpringBootWS应用程序与ApacheCXF一起使用,以提供SOAPWeb服务。所有配置的URL都使用相对路径,因此应用程序可以与灵活的部署一起使用 在生产环境中,应用程序在负载平衡器后面运行,并强制客户端使用https。但是生成的wsdl保留其http协议,尽管wsdl本身是使用https公开的 这是spring端点配置:Java cxf生成的wsdl:将soap地址位置协议更改为https,java,spring,spring-boot,cxf,spring-ws,Java,Spring,Spring Boot,Cxf,Spring Ws,我将SpringBootWS应用程序与ApacheCXF一起使用,以提供SOAPWeb服务。所有配置的URL都使用相对路径,因此应用程序可以与灵活的部署一起使用 在生产环境中,应用程序在负载平衡器后面运行,并强制客户端使用https。但是生成的wsdl保留其http协议,尽管wsdl本身是使用https公开的 这是spring端点配置: @Bean public Endpoint endpoint() { EndpointImpl endpoint = new EndpointImp
@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
最好的,
Lars我在项目中也遇到了类似的问题,我通过使用spring引导参数解决了这个问题。我们有一个ngnix服务器,它接收请求并转发到具有spring引导应用程序的后端机器 在ngnix配置中添加了以下参数
proxy_set_header X-Forwarded-Proto https;
proxy_set_header X-Forwarded-Scheme https;
后来,在spring引导应用程序中添加了以下参数
server.tomcat.remote-ip-header=x-forwarded-for
server.tomcat.protocol-header=x-forwarded-proto
此服务器开始将https附加到URL后。在spring boot应用程序中,如果您使用的是cxf framework,则可以添加自定义拦截器以传递自定义URL
public class MyInInterceptor extends AbstractInDatabindingInterceptor {
private String url;
public CustomInInterceptor(String url) {
super(Phase.USER_STREAM);
this.url = url;
}
@Override
public void handleMessage(Message message) throws Fault {
message.put("org.apache.cxf.request.url", url);
}
}
您需要在配置文件中像这样配置此拦截器
EndpointImpl endpoint = new EndpointImpl(bus, communicationPortTypeImpl);
List<Interceptor<? extends Message>> interceptors = new ArrayList<>();
interceptors.add(new MyInInterceptor(endpointUrl));
endpoint.setInInterceptors(interceptors);
endpoint.publish("/myEndPoint");
EndpointImpl endpoint=新的EndpointImpl(总线、通信端口类型impl);
列表