使用Jax-WS端点发布WS [英] Publishing a WS with Jax-WS Endpoint

查看:114
本文介绍了使用Jax-WS端点发布WS的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我构建了一个最小的Web服务,并使用javax.xml.ws.Endpoint发布它。
如果我尝试在
获取WSDL http:// localhost:1234 / AddService?wsdl 它工作正常。

I built a minimal web service and published it using javax.xml.ws.Endpoint. If I try to get the WSDL at http://localhost:1234/AddService?wsdl it works fine.

试图在 http://192.168.0.133:1234/AddService?wsdl 收到它,我什么都没收到。
此地址与localhost相同。

Trying to recieve it at http://192.168.0.133:1234/AddService?wsdl, I don't receive anything. This address is the same as localhost.

是否有可能在不提供地址的情况下发布网络服务?

Is there a posibiility to publish a webservice without providing the address?

package test;

import javax.jws.WebMethod;
import javax.jws.WebService;
import javax.xml.ws.Endpoint;

@WebService
public class AddService {

    @WebMethod
    public int add(int a, int b){
        return a+b;
    }

    public static void main(String[] args ){
        Endpoint.publish("http://localhost:1234/AddService", new AddService());
    }
}

将代码更改为

Endpoint.publish("http://192.168.0.133:1234/AddService", new AddService());

获取IP地址上的wsdl但不是localhost。

gets me the wsdl on the IP address but not on localhost.

是否只能定义端口?

推荐答案

你可以尝试发布它吗? 0.0.0.0?

Could you try publishing it on 0.0.0.0?

这篇关于使用Jax-WS端点发布WS的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆