大家帮我看看,Axis最简单的例子,但是跑不通。服务器端程序:Test.jws
import java.util.*;public class Test
{
    private    String name="gaga";    public String getName()
{
        return name;
    }}客户端程序:TestWebService.java
import org.apache.axis.client.Call;
import org.apache.axis.client.Service;public class TestWebService
{
    public static void main(String args[])
{                                
        
         System.out.println("Start invoking....");
        
          try {
          String endpoint = "http://localhost:8080/axis/Test.jws";
          Service service = new Service();
          Call call = null;
          call = (Call) service.createCall();
          
          call.setTargetEndpointAddress(new java.net.URL(endpoint));
          call.setOperationName("getName");
          String ret = (String) call.invoke(new Object[] {});
          System.out.println("return value is " + ret);
          } 
          catch (Exception ex) {
          ex.printStackTrace();
          }
          
         System.out.println("Finished the invoking.");        
    }
}环境:tomcat5+axis1_1
问题,为什么在Eclipse运行后,报红颜色那行出错?
谢谢大家

解决方案 »

  1.   

    具体出错信息:
    AxisFault
     faultCode: {http://xml.apache.org/axis/}HTTP
     faultSubcode: 
     faultString: (404)μ????? AxisServlet L)(gM~[?
     faultActor: 
     faultNode: 
     faultDetail: 
    {}string: return code:  404
    <html><head><title>Apache Tomcat/5.0.24 - Error report</title><style><!--H1 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:22px;} H2 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:16px;} H3 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:14px;} BODY {font-family:Tahoma,Arial,sans-serif;color:black;background-color:white;} B {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;} P {font-family:Tahoma,Arial,sans-serif;background:white;color:black;font-size:12px;}A {color : black;}A.name {color : black;}HR {color : #525D76;}--></style> </head><body><h1>HTTP????? 404 - ?????? AxisServlet ????????</h1><HR size="1" noshade><p><b>type</b> ?????????</p><p><b>?????</b> <u>?????? AxisServlet ????????</u></p><p><b>??</b> <u>The requested resource (?????? AxisServlet ????????) is not available.</u></p><HR size="1" noshade><h3>Apache Tomcat/5.0.24</h3></body></html>(404)μ????? AxisServlet L)(gM~[?
    at org.apache.axis.transport.http.HTTPSender.readFromSocket(HTTPSender.java:630)
    at org.apache.axis.transport.http.HTTPSender.invoke(HTTPSender.java:128)
    at org.apache.axis.strategies.InvocationStrategy.visit(InvocationStrategy.java:71)
    at org.apache.axis.SimpleChain.doVisiting(SimpleChain.java:150)
    at org.apache.axis.SimpleChain.invoke(SimpleChain.java:120)
    at org.apache.axis.client.AxisClient.invoke(AxisClient.java:180)
    at org.apache.axis.client.Call.invokeEngine(Call.java:2564)
    at org.apache.axis.client.Call.invoke(Call.java:2553)
    at org.apache.axis.client.Call.invoke(Call.java:2248)
    at org.apache.axis.client.Call.invoke(Call.java:2171)
    at org.apache.axis.client.Call.invoke(Call.java:1691)
    at TestWebService.main(TestWebService.java:19)
      

  2.   

    404错误一般是指资源找不到,确保你的webservice是可以访问的,就可以看到wsdl描述,如果这些是正常的,检查一下你使用Call的调用过程是否正确
      

  3.   

    要编写后缀为wsdd的配置文件的,你再搜搜 看 又解决的方法的
      

  4.   

    404应该是没有找到发布出来的服务,注意检查WebService的URI,以及使用的端口号.
      

  5.   

    可以的话,给我发个例子,谢谢! 邮箱:[email protected]