簡體   English   中英

在java中創建非常簡單的Web服務時運行時建模器錯誤

[英]runtime modeler error while creating very simple web service in java

我是java網絡服務的初學者。

我創建了一個簡單的Web服務,並在嘗試發布時如下所示

 Endpoint.publish("http://localhost:8080/HelloWeb", new HelloWeb());

獲得如下錯誤

Exception in thread "main" com.sun.xml.internal.ws.model.RuntimeModelerException: runtime modeler error: Wrapper class com.ravi.jaxws.SayGreeting is not found. Have you run APT to generate them?
at com.sun.xml.internal.ws.model.RuntimeModeler.getClass(RuntimeModeler.java:256)
at com.sun.xml.internal.ws.model.RuntimeModeler.processDocWrappedMethod(RuntimeModeler.java:567)
at com.sun.xml.internal.ws.model.RuntimeModeler.processMethod(RuntimeModeler.java:514)
at com.sun.xml.internal.ws.model.RuntimeModeler.processClass(RuntimeModeler.java:341)
at com.sun.xml.internal.ws.model.RuntimeModeler.buildRuntimeModel(RuntimeModeler.java:227)
at com.sun.xml.internal.ws.server.EndpointFactory.createSEIModel(EndpointFactory.java:308)
at com.sun.xml.internal.ws.server.EndpointFactory.createEndpoint(EndpointFactory.java:174)
at com.sun.xml.internal.ws.api.server.WSEndpoint.create(WSEndpoint.java:420)
at com.sun.xml.internal.ws.api.server.WSEndpoint.create(WSEndpoint.java:439)
at com.sun.xml.internal.ws.transport.http.server.EndpointImpl.createEndpoint(EndpointImpl.java:208)
at com.sun.xml.internal.ws.transport.http.server.EndpointImpl.publish(EndpointImpl.java:138)
at com.sun.xml.internal.ws.spi.ProviderImpl.createAndPublishEndpoint(ProviderImpl.java:90)
at javax.xml.ws.Endpoint.publish(Endpoint.java:170)
at com.ravi.Server.main(Server.java:9)

任何想法在這里出錯了。

我的webservice類非常簡單,這里是代碼:

    @WebService
@SOAPBinding(style = Style.DOCUMENT, use=Use.LITERAL)
public class HelloWeb {

    @WebMethod
    public String sayHello(String name){
        return "Hello "+name;
    }
}

首先調用wsgen實用程序。 此實用程序生成各種工件,即Endpoint.publish方法生成服務的WSDL所需的java類型.Here是示例在工作目錄中運行

  wsgen -keep -cp  package.HelloWeb

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM