参考文档 http://ws.apache.org/axis/java/user-guide.html
http://www.cnblogs.com/hoojo/archive/2010/12/20/1911349.html
http://www.ibm.com/developerworks/cn/webservices/ws-axisfaq/index.html
http://mljavalife.iteye.com/blog/1182063
http://tech.ccidnet.com/art/3737/20050612/470685_1.html
下载 axis-1.4.zip 文件并解压。设置axis的环境变量 "AXIS_HOME"
服务端
① 根据给定wsdl 生成axis1服务端命令:
java -Djava.ext.dirs=%AXIS_HOME%\lib org.apache.axis.wsdl.WSDL2Java <wsdl地址> -o <%Output_Path%> -d Session -s -S true -p <%Package%>
将java的方法,用axis1.4的命令生成WSDL文件命令java2wsdl.bat
set Axis_Lib=E:\apache-tomcat-6.0.32\webapps\axis\WEB-INF\lib
set Java_Cmd=java -Djava.ext.dirs=%Axis_Lib%
%Java_Cmd% org.apache.axis.wsdl.Java2WSDL -o HelloImpl.wsdl -l "http://localhost:8080/axis/services/HelloImpl" -n "urn:HelloImpl" -p"axis.wsdd" "urn:HelloImpl444444" axis.wsdd.HelloImpl
pause;
web.xml 加入如下代码
<servlet>
<servlet-name>AxisServlet</servlet-name>
<display-name>Apache-Axis Servlet</display-name>
<servlet-class>org.apache.axis.transport.http.AxisServlet</servlet-class>
</servlet>
<servlet>
<servlet-name>AdminServlet</servlet-name>
<display-name>Axis Admin Servlet</display-name>
<servlet-class>org.apache.axis.transport.http.AdminServlet</servlet-class>
<load-on-startup>100</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>AxisServlet</servlet-name>
<url-pattern>/servlet/AxisServlet</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>AxisServlet</servlet-name>
<url-pattern>*.jws</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>AxisServlet</servlet-name>
<url-pattern>/services/*</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>AdminServlet</servlet-name>
<url-pattern>/servlet/AdminServlet</url-pattern>
</servlet-mapping>
WebService部署 (
需要服务器上先启动WEB应用)
利用deploy.wsdd 自动部属生成 server-config.wsdd 配置文件 命令
java -Djava.ext.dirs=%AXIS_HOME%\lib org.apache.axis.client.AdminClient deploy.wsdd -l http://192.168.69.69:7001/vombsWeb/services/AdminService
把服务器上生成的
server-config.wsdd 拷贝下来
最后WEB工程(axis1服务端) 目录结构如下:
WebContent
|-- WEB-INF
|-- classes
|-- lib 添加 axis1 的jar包
|-- server-config.wsdd 描述文件 利用deploy.wsdd生成
|-- web.xml
监听WebService命令
java -Djava.ext.dirs=%AXIS_HOME%\lib org.apache.axis.utils.tcpmon
axis1.4生成客户端命令:
java -Djava.ext.dirs=%AXIS_HOME%\lib org.apache.axis.wsdl.WSDL2Java <wsdl地址> -o <%Output_Path%> -p <%Package%>
问题总结:
运行的时候,有 警告,错误 如下:
org.apache.axis.utils.JavaUtils isAttachmentSupported
- Unable to find required classes (javax.activation.DataHandler and javax.mail.i
nternet.MimeMultipart). Attachment support is disabled.
解决办法:
将“activation.jar”和“mail.jar”包拷贝到lib。