最近公司有项目要求,需要根据提供的wsdl文件,开发webservice服务端的代码,由于以前没有接触webservice,在网上收了一些资料后,有了基本的概念后,根据网上的资料在本地的tomcat下搭建了基本的axis的环境(axis1.4),但是部署服务的时候出错,导致自己走了很多弯路。其实现在看来用axis1.4开发webservice其实真的是蛮方便的,只要你有一个好的开发环境。这里我总结下自己的做法。希望能对你有帮助。
1.确认你的axis1.4环境是否安装完成:
http://127.0.0.1:8080/axis/happyaxis.jsp
只要显示下面的信息,说明环境已经好了。
Axis Happiness Page
Examining webapp configuration
Needed Components
- Found SAAJ API ( javax.xml.soap.SOAPMessage ) at D:\jakarta-tomcat-5.0.28\common\lib\saaj.jar
- Found JAX-RPC API ( javax.xml.rpc.Service ) at D:\jakarta-tomcat-5.0.28\webapps\axis\WEB-INF\lib\jaxrpc.jar
- Found Apache-Axis ( org.apache.axis.transport.http.AxisServlet ) at D:\jakarta-tomcat-5.0.28\webapps\axis\WEB-INF\lib\axis.jar
- Found Jakarta-Commons Discovery ( org.apache.commons.discovery.Resource ) at D:\jakarta-tomcat-5.0.28\webapps\axis\WEB-INF\lib\commons-discovery-0.2.jar
- Found Jakarta-Commons Logging ( org.apache.commons.logging.Log ) at D:\jakarta-tomcat-5.0.28\bin\commons-logging-api.jar
- Found Log4j ( org.apache.log4j.Layout ) at D:\jakarta-tomcat-5.0.28\webapps\axis\WEB-INF\lib\log4j-1.2.8.jar
- Found IBM's WSDL4Java ( com.ibm.wsdl.factory.WSDLFactoryImpl ) at D:\jakarta-tomcat-5.0.28\webapps\axis\WEB-INF\lib\wsdl4j-1.5.1.jar
- Found JAXP implementation ( javax.xml.parsers.SAXParserFactory ) at an unknown location
- Found Activation API ( javax.activation.DataHandler ) at D:\jakarta-tomcat-5.0.28\common\lib\activation.jar
Optional Components
- Found Mail API ( javax.mail.internet.MimeMessage ) at D:\jakarta-tomcat-5.0.28\common\lib\mail.jar
- Found XML Security API ( org.apache.xml.security.Init ) at D:\jakarta-tomcat-5.0.28\webapps\axis\WEB-INF\lib\xmlsec.jar
- Found Java Secure Socket Extension ( javax.net.ssl.SSLSocketFactory ) at an unknown location
The core axis libraries are present.The optional components are present.
- Note: Even if everything this page probes for is present, there is no guarantee your web service will work, because there are many configuration options that we do not check for. These tests are
necessary but not
sufficient
----------------------------------------------------------------------------------------------------------------------------------------
这里提示下面2个有问题,其实对你用axis开发webservice开发没有影响,这个你可以放心,我当时就是在这个问题上纠结了很久,最后还是没有搞定。
Found JAXP implementation ( javax.xml.parsers.SAXParserFactory ) at an unknown location
Found Java Secure Socket Extension ( javax.net.ssl.SSLSocketFactory ) at an unknown location
2.如果有一个好的webservice的开发环境,对于开发webservice就非常的方便和简单,下面就把我在网上找的资料共享。
使用axis1.4+ant进行部署WebService的例子(附源码)
你可以在我的网盘下载:
也可以到我找的源网站下载
转自:
http://www.4ucode.com/Study/Topic/482458
使用axis1.4+ant进行部署WebService的例子(附源码)
使用ant1.7+tomcat+axis1.4+myeclipse进行开发WebService的一个样例,由于使用了ant ,使开发都很简单。是学习好材料。
主要有3部分:java生成wsdl文件,wsdl文件生成服务端,wsdl文件生成客户端。