批量安装部署web service到axis server
环境:
先取的如下软件:
1.tomcat 5.0.28
2.axis-1_2alpha.zip
将axis-1_2alpha.zip解压到d:\目录,将里面的webapps下的axis整个目录copy到tomcat的webapps下。
重起tomcat后在地址栏输入http://localhost:8080/axis/可以看到
如下画面就说明axis app 部署成功:
Hello! Welcome to Apache-Axis.
What do you want to do today?
Validate the local installation's configurationTo enable the disabled features, uncomment the appropriate declarations in WEB-INF/web.xml in the webapplication and restart it.
Validating AxisIf the "happyaxis" validation page displays an exception instead of a status page, the likely cause is that you have multiple XML parsers in your classpath. Clean up your classpath by eliminating extraneous parsers.
If you have problems getting Axis to work, consult the Axis Wiki and then try the Axis user mailing list.
然后点击
Validate,校验是否axis可以工作
如果出错的话会提示你少那些包,并提示到那里取得这些包,这些包分为两类core(核心)和option(可选)
本人少了一个和core lib和2个option
core:
activation.jar
option:
xmlsec.jar
mail.jar
上网取得这些包放到axis app的lib下或tomcat 的common\lib下重起tomcat就可以看到axis可以正常工作的提示。
设置环境变量:
做为学习,可以自己写一个setpath.bat的文件,设置好axis的axisclasspath:
本人的axis解压到d:\axis目录下,所以setpath文件如下:
setpath.bat
set AXIS_HOME=D:\axis
set AXIS_LIB=%AXIS_HOME%\lib
set AXISCLASSPATH=%AXIS_LIB%\axis.jar;%AXIS_LIB%\commons-discovery.jar;%AXIS_LIB%\commons-logging.jar;%AXIS_LIB%\jaxrpc.jar;%AXIS_LIB%\saaj.jar;%AXIS_LIB%\log4j-1.2.8.jar;%AXIS_LIB%\xml-apis.jar;%AXIS_LIB%\xercesImpl.jar
注意第一行和和第二行的后面都应该没有空格,否则会导致AXISCLASSPATH错误;执行改bat
部署webservice:
我们要部署为webservic的文件在d:\axis\samples下,现在我们部署该目录下的stock目录下面的application
在确保你的tomcat已经启动,并且你的axis app 已经在http://localhost:8080/axis/下
进到d:\axis\samples\stock目录下
执行如下代码:
java -cp %AXISCLASSPATH% org.apache.axis.client.AdminClient -lhttp://localhost:8080/axis/services/AdminService deploy.wsdd
如果期间出现classnotfind之类的错误,检查你的环境变量有没有错(通常会有一些空格,或者打错字的错误)
如果提示connect refuse,则是tomcat没启动,或http://localhost:8080/axis/services/AdminService 不能工作
部署成功的话,查看{axis app}/web-inf 下多了一个文件server-config.wsdd,这个文件是web service的deploy desciptor.
测试部署成功的web service:
回到AXIS_HOME目录下,执行:
java -cp .;%AXISCLASSPATH% samples.stock.GetQuote -lhttp://localhost:8080/axis/servlet/AxisServlet -uuser1 -wpass1 XXX
见结果如下:
D:\axis>java -cp .;%AXISCLASSPATH% samples.stock.GetQuote -lhttp://localhost:808If you are experienced in web application development, and especially if you wish to add web services to an existing or complex webapp, you can take an alternate approach to running Axis. Instead of adding your classes to the Axis webapp, you can add Axis to your application.
The core concepts are
Add axis.jar, wsdl.jar, saaj.jar, jaxrpc.jar and the other dependent libraries to your WAR file. Copy all the Axis Servlet declarations and mappings from axis/WEB-INF/web.xml and add them to your own web.xml Build and deploy your webapp. Run the Axis AdminClient against your own webapp, instead of Axis, by changing the URL you invoke it with.The process is also covered in Chapter 15 of Java Development with Ant, which can be downloaded as a PDF file.
本文地址:http://com.8s8s.com/it/it14323.htm