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

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

通过http://localhost:8080/webServices/testService?wsdl走网关访问时,返回的<soap:address location>是真实业务服务的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文件中<soap:address location>发布地址。

效果如下:

复制代码
<wsdl:service name="testService">
<wsdl:port binding="tns:testServiceSoapBinding" name="TestServiceImplPort">
<soap:address location="http://yourdomain.com/yourServicePath"/>
</wsdl:port>
</wsdl:service>
相关推荐
xcs19405几秒前
Java 上位机防空警报系统开发
java·开发语言
sR916Mecz2 分钟前
Linux 服务器磁盘扩容与目录迁移:rsync + bind mount 实现服务无感迁移(无需修改配置)
java·linux·服务器
2301_7717172112 分钟前
idea中springboot中使用junit测试报错的解决方案
spring boot·junit·intellij-idea
UAq6wn76j29 分钟前
.NET源码生成器使用SyntaxTree生成代码及简化语法
java·开发语言·.net
火飞鹰29 分钟前
封装MinIO为starter
java·数据库·spring boot
@atweiwei31 分钟前
Go语言并发编程面试题精讲(上)
java·开发语言·面试·golang·channel
_MyFavorite_36 分钟前
JAVA重点基础、进阶知识及易错点总结(36)Lombok 实战 + 阶段总结
java·开发语言
spencer_tseng1 小时前
AffineTransform cannot be resolved
java
freejackman1 小时前
Java从0到1---基础篇
java·开发语言·后端·idea