RuntimeModelerException:类上没有WebService注释:<endpointinterface>

时间:2017-01-18 08:59:07

标签: java eclipse web-services wsdl webservice-client

我有一个WSDL文件。使用它,我生成了一个Web服务。此Web服务转换为添加到客户端项目中的jar

我正在尝试从客户端项目中的main()调用web方法

    Service serv= Service.create(url, qName);
    Calculator c = serv.getPort(Calculator.class);
    int result = c.multiply(2, 3);

当我运行此应用程序时,运行为 - &gt; Java应用程序 我得到以下异常

Exception in thread "main" com.sun.xml.internal.ws.model.RuntimeModelerException: A WebService annotation is not present on class: com.test.ws.Calculator
at com.sun.xml.internal.ws.model.RuntimeModeler.getPortTypeName(Unknown Source)
at com.sun.xml.internal.ws.model.RuntimeModeler.getPortTypeName(Unknown Source)
at com.sun.xml.internal.ws.client.WSServiceDelegate.getPort(Unknown Source)
at com.sun.xml.internal.ws.client.WSServiceDelegate.getPort(Unknown Source)
at javax.xml.ws.Service.getPort(Unknown Source)
at com.test.ws.client.TestClient.main(TestClient.java:26)

根据我的理解,在Calculator.java中生成的Web服务中缺少注释 - 根据下面的代码,这是正确的 Calculator.java

 package com.test.ws;

public interface Calculator extends java.rmi.Remote {
    public int multiply(int arg0, int arg1) throws java.rmi.RemoteException;
  }

现在,因为我通过eclipse从wsdl生成了Web服务代码。如何缺少注释? 如果这是通常的情况,那么我应该在我的代码中添加其他内容吗?

寻求一些帮助。 提前谢谢!

0 个答案:

没有答案
相关问题