web服务Java在端点中找不到接口
我试图使用Java中的端点将设备中的方法公开为web服务。问题是,在创建端点时,我需要传入定义类的接口实现的实例,但在加载设备的计算机上找不到接口。例如:
Endpoint anEndpoint = Endpoint.publish("http://localhost:8080/HelloWorldImpl", new HelloWorldImpl());
但是没有找到HelloWorldImpl实现的接口
其他课程是
package application;
@WebService
public interface IHelloWorld{
@WebMethod
public void speak();
}
具体实施如下:
package application;
@WebService(EndpointInterface="application.IHelloWorld")
public class HelloWorldImpl extends ClassForDeviceInteraction implements IHelloWorld{
@Override
public void speak(){
//code that prints to a controller on the device
}
public void initialize(){
//code that initializes stuff for the device
Endpoint anEndpoint = Endpoint.publish("http://localhost:8080/
HelloWorldImpl", new HelloWorldImpl());
}
public static void main(String [] args){
//code to initialize the device
}
}
它在我的电脑上编译得很好,但当我把它放在设备上时,我得到了一个错误,说接口IHelloWorld
找不到。我还没有找到任何类似的堆栈溢出
错误的原因可能是什么?有没有办法在我要传递到端点的类中声明接口,然后在“EndpointInterface”字段中引用它
共 (0) 个答案