编程语言

img youlin

批量安装部署web service到axis server

发表于2004/10/21 16:01:00  1641人阅读

批量安装部署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 部署成功:

Apache-AXIS

Hello! Welcome to Apache-Axis.

What do you want to do today?

  • Validate the local installation's configuration
    see below if this does not work.
  • View the list of deployed Web services
  • Call a local endpoint that list's the caller's http headers (or see its WSDL).
  • Visit the Apache-Axis Home Page
  • Administer Axis
    [disabled by default for security reasons]
  • SOAPMonitor
    [disabled by default for security reasons]

To enable the disabled features, uncomment the appropriate declarations in WEB-INF/web.xml in the webapplication and restart it.

Validating Axis

If 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:808
0/axis/servlet/AxisServlet -uuser1 -wpass1 XXX
log4j:WARN No appenders could be found for logger (org.apache.axis.i18n.ProjectR
esourceBundle).
log4j:WARN Please initialize the log4j system properly.
XXX: 55.25

测试通过



下面是将axis集成到你自己的app里

  1. Advanced Installation: adding Axis to your own Webapp

    If 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

    1. Add axis.jar, wsdl.jar, saaj.jar, jaxrpc.jar and the other dependent libraries to your WAR file.
    2. Copy all the Axis Servlet declarations and mappings from axis/WEB-INF/web.xml and add them to your own web.xml
    3. Build and deploy your webapp.
    4. 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.

阅读全文
0 0

相关文章推荐

img
取 消
img