1. Create a new Web project
2. Create a class to publish
PackageCom.linjian.webservice;ImportJavax.jws.WebMethod;ImportJavax.jws.WebParam;ImportJavax.jws.WebResult;ImportJavax.jws.WebService; @WebService (ServiceName= "Hello", targetnamespace= "http://www.joinhealth.cn") Public classHello {@WebMethod @WebResult (name= "Output") PublicString SayHello (@WebParam (name= "Input") (String name) {return"Hello" +name; }}
ServiceName specifying the service name
TargetNamespace specifying the WebService namespace
@ WEBRESULT specifies that the participating
@WebParam The specified entry
3, the Web project into a jar package, there is a Export-->jar file
4. In the Axis2\web-inf directory, create a new folder Servicejars, put the jar package generated in the previous step into this folder
Axis2.xml
<Deployerextension= ". Class"Directory= "Pojo"class= "Org.apache.axis2.deployment.POJODeployer"/><Deployerextension= ". Jar"Directory= "Servicejars"class= "Org.apache.axis2.jaxws.framework.JAXWSDeployer"/><Deployerextension= ". Jar"Directory= "Transports"class= "Org.apache.axis2.deployment.TransportDeployer"/>
5, start Tomcat, access to WSDL will be error, the solution:
Copy Tools.jar from JDK Lib to Tomcat Lib or Axis2 Lib
6. Start Tomcat
JAX-WS Writing WebService