Java开发网 Java开发网
注册 | 登录 | 帮助 | 搜索 | 排行榜 | 发帖统计  

您没有登录

» Java开发网 » WebService/XML/JSON/SOAP/SOA  

按打印兼容模式打印这个话题 打印话题    把这个话题寄给朋友 寄给朋友    该主题的所有更新都将Email到你的邮箱 订阅主题
flat modethreaded modego to previous topicgo to next topicgo to back
作者 wsdd发布web服务出现的异常,急需解决
dengjin





发贴: 15
积分: 0
于 2008-12-02 00:32 user profilesend a private message to usersend email to dengjinsearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
编写wsdd发布web服务,编写stub client访问web服务

1、编写服务端程序server,SayHello.java,编译server.SayHello.java


package server;
public class SayHello
{
public String getName(String name)
{
return "hello "+name;
}
}
2.编写LogHandler.java
import org.apache.Axis.AxisFault;
import org.apache.Axis.Handler;
import org.apache.Axis.MessageContext;
import org.apache.Axis.handlers.BasicHandler;

import java.util.Date;

public class LogHandler
extends BasicHandler
{
public void invoke
(MessageContext msgContext)
throws AxisFault
{
/** Log an access each time
we get invoked.
*/
try {
Handler serviceHandler
= msgContext.getService();

Integer numAccesses =
(Integer)serviceHandler.getOption("accesses");
if (numAccesses == null)
numAccesses = new Integer(0);
numAccesses = new Integer
(numAccesses.intValue() + 1);
Date date = new Date();
String result =
date + ": service " +
msgContext.getTargetService() +
" accessed " + numAccesses + " timeMoon.";
serviceHandler.setOption
("accesses", numAccesses);
System.out.println(result);
} catch (Exception e)
{
throw AxisFault.makeFaultEnvelope;
}
}
}

3、编写wsdd文件


deploy.wsdd
<deployment xmlns=
"http://xml.apache.org/Axis/wsdd/"
xmlns:java=
"http://xml.apache.org/Axis/wsdd/providers/java">
<handler name="print" type="java:LogHandler"/>
<service name="sayhello"
provider="java:RPC">
<requestFlow>
<handler type="print"/>
</requestFlow>
<parameter name="className"
value="server.SayHello"/>
<parameter name="allowedMethods"
value="*"/>
</service>
</deployment>

3、将编译后的文件拷贝到Axis_HOME/WEB-INF/classes下,如:D:\tomcat\webapps\Axis\WEB-INF\classes

4、发布服务:
Java -Djava.ext.dirs=%AXIS_HOME%\lib org.apache.axis.client.AdminClient –p8080 deploy.wsdd
可是就在这一步老是出问题过不去,
1,AXIS_HOME我在系统变量里面设了
2,然后我是在D:\tomcat\webapps\Axis\WEB-INF下执行的第四步
3,我的WSDD文件也是放在了WEB下
?我怀疑是WSDD文件写错了,高手看一下。




联想游戏(欢迎跟贴,哈)

话题树型展开
人气 标题 作者 字数 发贴时间
15074 wsdd发布web服务出现的异常,急需解决 dengjin 2554 2008-12-02 00:32
12469 Re:wsdd发布web服务出现的异常,急需解决 dengjin 63 2008-12-02 00:36
14866 Re:wsdd发布web服务出现的异常,急需解决 dengjin 381 2008-12-02 00:41

flat modethreaded modego to previous topicgo to next topicgo to back
  已读帖子
  新的帖子
  被删除的帖子
Jump to the top of page

   Powered by Jute Powerful Forum® Version Jute 1.5.6 Ent
Copyright © 2002-2021 Cjsdn Team. All Righits Reserved. 闽ICP备05005120号-1
客服电话 18559299278    客服信箱 714923@qq.com    客服QQ 714923