【发布时间】:2018-02-14 00:51:10
【问题描述】:
我已经使用 Apache CXF + SpringBoot 实现了一个 SOAP Web 服务。
在我的端点配置类中,我有
@Bean
public Endpoint endpoint()
{
EndpointImpl endpoint = new EndpointImpl(cxfBus, new ServiceImpl());
endpoint.publish("/myservice");
return endpoint;
}
这会创建一个 Web 服务端点为 https://host:port/myService
对于这个服务,我需要公开多个端点——比如——
https://host:port/tenant1/myService
https://host:port/tenant2/myService
https://host:port/tenant3/myService
这是一种 REST 端点——即,我试图在服务端点中传递tenantId 变量。
这在 Apache CXF + Springboot 中可行吗?
我试过了-
@Bean
public Endpoint endpoint()
{
EndpointImpl endpoint = new EndpointImpl(cxfBus, new ServiceImpl());
String[] pathArray = {"tenant1", "tenant2", "tenant3"};
for (int i = 0; i < pathArray.length; i++)
{
endpoint.publish("/" + pathArray[i] + "/myservice");
}
return endpoint;
}
但它不起作用。
如果有任何意见/建议,我将不胜感激。谢谢!
【问题讨论】:
-
您实施了哪种解决方案?因为我必须从 url 列表中动态创建多个端点。
标签: web-services spring-boot soap cxf