runtime modeler error while creating very simple web service in java

java, jax-ws, web-services

Solution

first invoke the wsgen utility. This utility generates the various artifacts , i.e. java types needed by the method Endpoint.publish to generate the service's WSDL.Here is the example In the working directory run

  wsgen -keep -cp  package.HelloWeb

Problem

I am beginner in java web-services. I created a simple web service and when trying to publish it as below ``` Endpoint.publish("http://localhost:8080/HelloWeb", new HelloWeb()); ``` Getting error as below ``` 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) ``` Any Idea whats going wrong here. My webservice class is very simple and here is code: ``` @WebService @SOAPBinding(style = Style.DOCUMENT, use=Use.LITERAL) public class HelloWeb { @WebMethod public String sayHello(String name){ return "Hello "+name; } } ```

Original source