【问题标题】:how to use a relative endoint address?如何使用相对端点地址?
【发布时间】:2015-06-18 01:52:32
【问题描述】:

使用 Spring 引导配置我有例外

Caused by: java.net.MalformedURLException: no protocol: /CustomerService

如何放置一个相对的(到已部署的 webapp)url?

@Bean 
public EndpointImpl endpoint(ICustomerService customerService) {        
        EndpointImpl endpoint = new EndpointImpl(cxfBus, new WCustomerService(customerService) );
        endpoint.publish("/CustomerService"); 
        return endpoint; 
} 

【问题讨论】:

    标签: spring spring-boot jax-ws


    【解决方案1】:

    看起来您需要将有效的 URL 作为字符串传递才能发布,正如您在下面的函数中看到的那样。它是 EndpointImpl.java 的一个 sn-p。希望这会有所帮助。

    public void More ...publish(String address) {
    127        canPublish();
    128        URL url;
    129        try {
    130            url = new URL(address);
    131        } catch (MalformedURLException ex) {
    132            throw new IllegalArgumentException("Cannot create URL for this address " + address);
    133        }
    

    【讨论】:

    • 它看起来需要一个不同的 url 和不同的端口,所以它不能与 webapp 地址相关
    • 必须是完整的URL,包含协议、域名等。
    猜你喜欢
    • 2011-12-18
    • 2013-03-18
    • 2011-10-27
    • 2011-07-14
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-02-08
    • 1970-01-01
    相关资源
    最近更新 更多