标签:
1、新建一个web工程
2、创建要发布的类
package com.linjian.webservice; import javax.jws.WebMethod; import javax.jws.WebParam; import javax.jws.WebResult; import javax.jws.WebService; @WebService(serviceName="Hello",targetNamespace="http://www.joinhealth.cn") public class Hello { @WebMethod @WebResult(name="output") public String sayHello(@WebParam(name="input")String name) { return "Hello " + name; } }
serviceName指定服务名
targetNamespace指定webservice命名空间
@WebResult指定出參
@WebParam指定入參
3、将web工程打成jar包,有件export-->jar file
4、在axis2\WEB-INF目录下新建文件夹servicejars,将上一步生成的jar包放到这个文件夹中
axis2.xml
<deployer extension=".class" directory="pojo" class="org.apache.axis2.deployment.POJODeployer"/> <deployer extension=".jar" directory="servicejars" class="org.apache.axis2.jaxws.framework.JAXWSDeployer"/> <deployer extension=".jar" directory="transports" class="org.apache.axis2.deployment.TransportDeployer"/>
5、启动tomcat,访问wsdl会报错,解决办法:
将jdk lib中的tools.jar复制到tomcat lib或axis2 lib中
6、启动tomcat
标签:
原文地址:http://www.cnblogs.com/linjian/p/4709160.html