锁定老帖子 主题:使用Axis开发Web Service程序
精华帖 (0) :: 良好帖 (0) :: 新手帖 (0) :: 隐藏帖 (0)
|
|
---|---|
作者 | 正文 |
发表时间:2008-05-05
一、Axis环境的安装
package server; public class SayHello { public String getName(String name) { return "hello "+name; } } <deployment xmlns="http://xml.apache.org/axis/wsdd/" xmlns:java="http://xml.apache.org/axis/wsdd/providers/java"> <service name="SayHello" provider="java:RPC"> <parameter name="className" value="server.SayHello.getName"/> <parameter name="allowedMethods" value="*"/> </service> </deployment> set Axis_Lib=D:\workspace\test\WEB-INF\lib set Java_Cmd=java -Djava.ext.dirs=%Axis_Lib% set Axis_Servlet=http://localhost:8080/test/servlet/AxisServlet %Java_Cmd% org.apache.axis.client.AdminClient -l%Axis_Servlet% deploy.wsdd set Axis_Lib=D:\workspace\test\WEB-INF\lib set Java_Cmd=java -Djava.ext.dirs=%Axis_Lib% set Output_Path=D:\workspace\test\src set Package=server.SayHello %Java_Cmd% org.apache.axis.wsdl.WSDL2Java -o%Output_Path% -p%Package% SayHello.wsdl import java.net.URL; import junit.framework.Test; import junit.framework.TestCase; import junit.framework.TestSuite; public class TestWSClient extends TestCase { public TestWSClient(String string) { super(string); } public void SayHelloClient() throws Exception { SayHelloService service = new SayHelloServiceLocator(); SayHello_PortType client = service.getSayHello() ; String retValue = client.getName("clientname"); System.out.println(retValue); } public static Test suite() { TestSuite suite = new TestSuite(); suite.addTest(new TestWSClient("SayHelloClient")); return suite; } }
声明:ITeye文章版权属于作者,受法律保护。没有作者书面许可不得转载。
推荐链接
|
|
返回顶楼 | |
发表时间:2008-08-23
2、编写wsdd文件
deploy.wsdd文件内容如下: <deployment xmlns="http://xml.apache.org/axis/wsdd/" xmlns:java="http://xml.apache.org/axis/wsdd/providers/java"> <service> name="SayHello" provider="java:RPC"> <parameter name="className" value="server.SayHello.getName"/> <parameter name="allowedMethods" value="*"/> </service> </deployment> |
|
返回顶楼 | |
发表时间:2008-09-08
我用xfire 配置很简单!客户端更简单!效率还很高!
|
|
返回顶楼 | |
发表时间:2008-09-08
axis感觉有点老了,原来用的还不错,就是配的有点繁琐
|
|
返回顶楼 | |
浏览 10705 次