com.sun.xml.internal.ws.model.RuntimeModelerException:

原网址:

http://chenbingyyent.blog.163.com/blog/static/135278835201102484716262/


一个WebService示例


import javax.jws.WebService;
import javax.xml.ws.Endpoint;

@WebService //标志这个类是一个webservice
public class HelloService {
//
public String SayHello(String name){
System.out.println("Hello " + name);
return " Hello "+name;
}

public static void main(String[] args) {
/**
* 调用静态方法endpoint.publish
*   1)address 访问地址
*   2)implementor 实现者
*  
*/

//服务地址
String address="http://localhost:9080/hello";
Endpoint.publish(address, new HelloService());
System.out.println("HelloService ready():" );
}
}


报错:

Exception in thread "main" com.sun.xml.internal.ws.model.RuntimeModelerException: runtime modeler error: Wrapper class com.fengzhengshu.test.jaxws.SayHello 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:92)
at javax.xml.ws.Endpoint.publish(Endpoint.java:170)
at com.fengzhengshu.test.HelloService.main(HelloService.java:29)


解决方法:

import javax.jws.WebService;
import javax.jws.soap.SOAPBinding;
import javax.jws.soap.SOAPBinding.Style;
import javax.xml.ws.Endpoint;

@WebService //标志这个类是一个webservice
@SOAPBinding(style = Style.RPC) //添加这一行

你可能感兴趣的:(com.sun.xml.internal.ws.model.RuntimeModelerException:)