我从客户端(java应用程序)调用Web服务(Web应用程序)时遇到问题,它说包[此处所述包的名称]不存在
这是客户端方法和Web服务方法
public static void main(String[] args) {
System.out.print(hello("Nati"));
}
private static String hello(java.lang.String name) {
service.Test.Test_Service service = new service.Test.Test_Service();
service.Test.Test port = service.getTestPort();
return port.hello(name);
}
并在此处说明了网络服务
@WebService(serviceName = "Test")
public class Test {
/** This is a sample web service operation */
@WebMethod(operationName = "hello")
public String hello(@WebParam(name = "name") String txt) {
return "Hello " + txt + " !";
}
}
当我运行此代码时,它会生成此错误
D:\eclipse_work_space_directory\TestClient\src\testclient\TestClient.java:22: package service.Test does not exist
service.Test.Test_Service service = new service.Test.Test_Service();
D:\eclipse_work_space_directory\TestClient\src\testclient\TestClient.java:22: package service.Test does not exist
service.Test.Test_Service service = new service.Test.Test_Service();
D:\eclipse_work_space_directory\TestClient\src\testclient\TestClient.java:23: package service.Test does not exist
service.Test.Test port = service.getTestPort();