springboot整合webservice修改cxf自动生成wsdl的soap:address location

近期系统中的webservice接口要上线

通过http://localhost:8080/webServices/testService?wsdl走网关访问时,返回的是真实业务服务的ip:port。因为我们只能暴露网关的ip和端口,需要将真实服务的ip和端口隐藏起来。

    @Bean
    public Endpoint messagePoint() throws IOException {
        EndpointImpl endpoint = new EndpointImpl(this.springBus(), this.testService);
        endpoint.setPublishedEndpointUrl("http://yourdomain.com/yourServicePath");
        endpoint.publish("/testService");
        return endpoint;
    }

这时候我们在创建Endpoint的时候,可以通过配置setPublishedEndpointUrl()展示wsdl文件中发布地址。

效果如下:






你可能感兴趣的:(spring,boot,后端,java)