本工程为WebService服务器端
本工程编码方式:UTF-8
本工程开发工具:MyEclipse
创建步骤:
1、创建普通计算器接口(IComputeService)及其实现类(ComputeService);
2、为IComputeService接口添加@WebService()注释,为ComputeService接口实现类添加@WebService(endpointInterface="com.ghj.service.IComputeService");
3、创建含有main方法的StartServer类,该类用于启动Web服务器端
注意:
如果出现如下异常,则需要在IComputeService接口上添加@SOAPBinding(style=SOAPBinding.Style.RPC)注释
Exception in thread "main" com.sun.xml.internal.ws.model.RuntimeModelerException: runtime modeler error: Wrapper class com.ghj.service.jaxws.Add 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.ghj.server.StartServer.main(StartServer.java:10)