Topic: wsdd发布web服务出现的异常,急需解决

  Print this page

1.wsdd发布web服务出现的异常,急需解决 Copy to clipboard
Posted by: dengjin
Posted on: 2008-12-02 00:32

编写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文件写错了,高手看一下。

2.Re:wsdd发布web服务出现的异常,急需解决 [Re: dengjin] Copy to clipboard
Posted by: dengjin
Posted on: 2008-12-02 00:36

JAR包都放进去了
异常是org.xml.saxexception: fatil error url=null line=1

3.Re:wsdd发布web服务出现的异常,急需解决 [Re: dengjin] Copy to clipboard
Posted by: dengjin
Posted on: 2008-12-02 00:41

上面异常说错了--异常为:
Processing file deploy.wsdd
Exception: AxisFault
faultCode: {http://schemas.xmlsoap.org/soap/envelope/}Server.userException
faultSubcode:
faultString: java.lang.Exception: Unable to process the message -was it a valid
WSDD descriptor?
faultActor:
faultNode:
faultDetail:
{http://xml.apache.org/axis/}hostname:ybhn-d5c60eaadf

忘各位侠友拨刀相助,感激不尽


   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