String address = BASE_URL + "/ws/userservice";
JaxWsProxyFactoryBean proxyFactory = new JaxWsProxyFactoryBean();
proxyFactory.setAddress(address);
proxyFactory.setServiceClass(UserWebService.class);
UserWebService userWebServiceCreated = (UserWebService) proxyFactory.create();
//(可选)重新设定endpoint address.
((BindingProvider) userWebServiceCreated).getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY,
address);
GetAllUserResult result = userWebServiceCreated.getAllUser();
assertTrue(result.getUserList().size() > 0);
UserDTO adminUser = result.getUserList().get(0);
assertEquals("admin", adminUser.getLoginName());
assertEquals(2, adminUser.getRoleList().size());