创建项目
File→New→Other→Web Services→Web Service Client中输入从服务端得到的wsdl链接:
http://localhost:8080/WS_WebService/server/web-publish?wsdl
然后Finish
webService客户端截图,非web项目。
1 package com.client.test; 2 3 import java.net.ConnectException; 4 import java.rmi.RemoteException; 5 import javax.xml.rpc.ServiceException; 6 7 import org.junit.Test; 8 9 import com.javen.service.IUserService; 10 import com.javen.service.User; 11 import com.javen.service.impl.UserServiceImplServiceLocator; 12 13 public class UserTest { 14 @Test 15 public void seleall() throws ServiceException, ConnectException { 16 //WebService客户端测试 17 IUserService usis=new UserServiceImplServiceLocator().getUserServiceImplPort(); 18 try { 19 User[] user=usis.selectAll(); 20 for (User user2 : user) { 21 System.out.println("name:"+user2.getUserName()); 22 } 23 } catch (RemoteException e) { 24 e.printStackTrace(); 25 System.out.println("客户端远程连接失败"); 26 } 27 } 28 29 }