尝试下webservice的第一个例子。
一、生成wsdl
Altova XML Spy ->
(1)input and output interface seting
(2)binding attribute -> type: soap, style:rpc
ui :
input and output -> use encoded,
encoding style:http://schemas.xmlsoap.org/soap/encoding/
namespace:http://localhost:8080/axis/services/Operation Target Ns : as above namespace
(3)Services -> add ports -> binding first, then
location -> http://localhost:8080/axis/services/Operation
二、由WSDL文件发布服务并测试:
1.DOS进入WSDL所在文件
2.使用命令: >java org.apache.axis.wsdl.WSDL2Java -p filename -s *.wsdl 生成子服务端;
三、写服务
1. open eclipse -> new project -> add internal file:axis-bin-1_4\axis-1_4\lib
2. new a package -> import .java
add service code in BindingNameImpl.java
get a project
四、deploy the service in tomcat
1. copy the project folder into : \apache-tomcat-5.5.27\webapps\axis\WEB-INF\classes
2. opent tomcat. and 进入deploy.wsdd所在目录,打开tomcat,命令: java org.apache.axis.client.AdminClient deploy.wsdd // java org.apache.axis.client.AdminClient -p8080 deploy.wsdd发布服务。
(也可以不用此命令,将deploy.wsdd中的<service>....</service>的内容拷贝在 tomcat/webapps/axis/WEB-INF目录下的server-config.wsdd文件中,也相当于发布了服务)
浏览器中输入 localhost8080:\axis\ 查看List下,为发布的服务。
五、soap ui 或者 写个client 测试下。