cxf webservice不能访问

服务发布为:

 

Endpoint.publish("http://127.0.0.1:8080/ClientService", 

       new ClientServiceImpl()); 

客户端调用为:

private static JaxWsDynamicClientFactory dynamicClient = JaxWsDynamicClientFactory.newInstance();

client = dynamicClient.createClient("http://127.0.0.1:8080/ClientService?wsdl");

浏览器:

http://localhost:8080/ClientService?wsdl正常

但是

http://192.168.1.136:8080/ClientService?wsdl 报404错误

解决办法:

server和client的URL直接用对外的IP地址

Endpoint.publish("http://192.168.1.136:8080/ClientService", 

        new ClientServiceImpl()); 

client = dynamicClient.createClient("http://192.168.1.136:8080/ClientService?wsdl");

搞定!

 

 

你可能感兴趣的:(webservice,CXF)