Topic: axis+tomcat一个简单的例子出现错误!!!!

  Print this page

1.axis+tomcat一个简单的例子出现错误!!!! Copy to clipboard
Posted by: momocha
Posted on: 2003-07-15 14:02

服务类(MyService.java)
public class MyService
{
public String serviceMethod(String arg)
{
return arg;
}
}

Client.java
import org.apache.axis.client.Call;
import org.apache.axis.client.Service;
import org.apache.axis.encoding.XMLType;
import org.apache.axis.utils.Options;
import javax.xml.namespace.QName;
import javax.xml.rpc.ParameterMode;
public class Client
{
public static void main(String [] args)
{
try {
String endpointURL ;
endpointURL="http://202.119.192.102:8080/axis/services/MyService";
Service service = new Service();
Call call = (Call) service.createCall();
call.setTargetEndpointAddress("http://202.119.192.102:8080/axis/services/MyService");
call.setOperationName( "serviceMethod" );
call.setReturnType( org.apache.axis.encoding.XMLType.XSD_STRING );
String ret = (String) call.invoke( new Object[] { "textToSend" } );
System.out.println("You typed : " + ret);
} catch (Exception e) {
System.err.println(e.toString());
}
}
}

Deploy.wsdd
<deployment xmlns="http://xml.apache.org/axis/wsdd/"
xmlns:java="http://xml.apache.org/axis/wsdd/providers/java">
<service name="MyService" provider="java:RPC">
<parameter name="className" value="MyService"/>
<parameter name="allowedMethods" value="*"/>
</service>
</deployment>

用 java org.apache.axis.client.AdminClient deploy.wsdd 服务配置成功~~~~
但是执行 java Client 时提示错误如下:
Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/axis/clien
t/Service
at Client.main(Client.java:14)
也就是client.java中的
Service service = new Service();
出错!!!请指教~~~~~

2.Re:axis+tomcat一个简单的例子出现错误!!!! [Re: momocha] Copy to clipboard
Posted by: andiyang
Posted on: 2003-07-22 09:21

这问题太菜了

3.Re:axis+tomcat一个简单的例子出现错误!!!! [Re: momocha] Copy to clipboard
Posted by: momocha
Posted on: 2003-07-22 19:35

光说不练有什么用..别又说axis.jar没有加到classpath中呀~~,我加了哟~~~
现在如下错误
No parameters specified to the Call object! You must call addParameter() for al
l parameters if you have called setReturnType().
怎么回事,老大给说说...

4.Re:axis+tomcat一个简单的例子出现错误!!!! [Re: momocha] Copy to clipboard
Posted by: wch3116
Posted on: 2003-07-23 14:05

你既然调用时 传入了参数: "textToSend"
那么就应该在前面加上这句对参数的说明:call.addParameter( "arg1", XMLType.XSD_STRING, ParameterMode.IN);


   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