QName funNamespace = new QName("http://tempuri.org/ValidateLogin");这个Namespace不可能是正确的。正确的应该是"http://tempuri.org/"EndpointReference reference = new EndpointReference("http://test.com/login.asmx?WSDL"); 
看完这个我收回上面的话的后半句,是什么你自己去调试把。

解决方案 »

  1.   

    ie 里面看看 空间 和 wsdl 的具体地址
      

  2.   

    QName funNamespace = new QName("http://tempuri.org/ValidateLogin");改为:
    QName funNamespace = new QName("http://tempuri.org/",“ValidateLogin”);
      

  3.   

    地址 
    try {
          String endpoint = "http://www.webxml.com.cn/WebServices/WeatherWS.asmx";
          Service service = new Service();
          Call call;
          call = (Call) service.createCall();
          call.setTargetEndpointAddress(new java.net.URL(endpoint));
          call.setOperationName(new QName("http://WebXml.com.cn/","getWeather"));
        
          call.setReturnClass(java.lang.String[].class);
          call.addParameter(new QName("http://WebXml.com.cn/", "theCityCode"),
          org.apache.axis.encoding.XMLType.XSD_STRING,
          javax.xml.rpc.ParameterMode.IN);
          call.addParameter(new QName("http://WebXml.com.cn/", "theUserID"),
          org.apache.axis.encoding.XMLType.XSD_STRING,
          javax.xml.rpc.ParameterMode.IN);
        
          call.setUseSOAPAction(true);
          call.setSOAPActionURI("http://WebXml.com.cn/getWeather");
          String[] results = (String[]) call.invoke(new Object[] { "", "" });
          if (null != results) {
          for (int i = 0; i < results.length; i++) {
          System.out.println(results[i]);
          }
          }
        
        
          } catch (Exception e) {
          e.printStackTrace();
          }
      

  4.   

    亲,直接用Eclipse自动生成客户端代码进行测试。
      

  5.   

    上面的都试了,不起作用。亲,直接用Eclipse自动生成客户端代码进行测试。
     ???
    这个能说具体点吗?
      

  6.   

    public class AxisClient { public static void main(String[] args) throws Exception { String targetEndPoint = "http://localhost:8080/Asix2Demo/services/HelloWorld";
    Service ser = new Service();
    try {
    Call call = (Call) ser.createCall();
    call.setTargetEndpointAddress(targetEndPoint);
    call.setOperationName(new QName(targetEndPoint, "hello" ));
    call.setOperation("hello");
    String result = (String) call.invoke(new Object[] { new String("test") });
    System.out.println("result=" + result);
    //call.setOperation("add");
    //int addResult = (Integer) call.invoke(new Object[] {new Integer(1), new Integer(1) });
    //System.out.println("addResult=" + addResult);
    } catch (ServiceException e) {
    e.printStackTrace();
    } catch (RemoteException e) {
    e.printStackTrace();
    } }}
      

  7.   

    @ylovep   你代码里Service 和 Call 是哪个命名空间的啊?
    其实代码是没问题的,到别人机器就行了。但在自己机器就超时。  请教解决方法
      

  8.   

    @rui888message org.apache.axis2.AxisFault: Connection timed out: connect是啊 同样的代码在我的机器上就不行 一个简单的main方法  包用的都是同样的东西。没有任何配置
      

  9.   

    你url 能够 访问到 ..net    webservice
      

  10.   

    @rui888  恩 没问题的   IE可以访问到的 调试也正常但就是用axis2调用时就不行了
      

  11.   

    @ylovep是啊。已经确定了是代码没问题。但我自己的电脑就调试不同,两天一个人的电脑就没问题。jdk 最新的   环境变量没问题。axis2 两台电脑一个版本。防火墙关了,不涉及到tomcat。就一个main方法 没有配置。就是不通呢,控制台提示错误是 
    四月 22, 2014 3:44:07 下午 org.apache.commons.httpclient.HttpMethodDirector executeWithRetry
    信息: I/O exception (java.net.ConnectException) caught when processing request: Connection timed out: connect
    四月 22, 2014 3:44:08 下午 org.apache.commons.httpclient.HttpMethodDirector executeWithRetry
    信息: Retrying request
    四月 22, 2014 3:44:29 下午 org.apache.commons.httpclient.HttpMethodDirector executeWithRetry
    信息: I/O exception (java.net.ConnectException) caught when processing request: Connection timed out: connect
    四月 22, 2014 3:44:29 下午 org.apache.commons.httpclient.HttpMethodDirector executeWithRetry
    信息: Retrying request
    四月 22, 2014 3:44:50 下午 org.apache.commons.httpclient.HttpMethodDirector executeWithRetry
    信息: I/O exception (java.net.ConnectException) caught when processing request: Connection timed out: connect
    四月 22, 2014 3:44:50 下午 org.apache.commons.httpclient.HttpMethodDirector executeWithRetry
    信息: Retrying request
    四月 22, 2014 3:45:11 下午 org.apache.axis2.transport.http.HTTPSender sendViaPost
    信息: Unable to sendViaPost to url[http://这个是webservice地址服务业是正常的啊,本机能访问的.asmx?wsdl]
    java.net.ConnectException: Connection timed out: connect
    at java.net.DualStackPlainSocketImpl.waitForConnect(Native Method)
    at java.net.DualStackPlainSocketImpl.socketConnect(DualStackPlainSocketImpl.java:85)
    at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:339)
    at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:200)
    at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:182)
    at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:172)
    at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392)
    at java.net.Socket.connect(Socket.java:579)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:606)
    at org.apache.commons.httpclient.protocol.ReflectionSocketFactory.createSocket(ReflectionSocketFactory.java:140)
    at org.apache.commons.httpclient.protocol.DefaultProtocolSocketFactory.createSocket(DefaultProtocolSocketFactory.java:125)
    at org.apache.commons.httpclient.HttpConnection.open(HttpConnection.java:707)
    at org.apache.commons.httpclient.MultiThreadedHttpConnectionManager$HttpConnectionAdapter.open(MultiThreadedHttpConnectionManager.java:1361)
    at org.apache.commons.httpclient.HttpMethodDirector.executeWithRetry(HttpMethodDirector.java:387)
    at org.apache.commons.httpclient.HttpMethodDirector.executeMethod(HttpMethodDirector.java:171)
    at org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.java:397)
    at org.apache.axis2.transport.http.AbstractHTTPSender.executeMethod(AbstractHTTPSender.java:621)
    at org.apache.axis2.transport.http.HTTPSender.sendViaPost(HTTPSender.java:193)
    at org.apache.axis2.transport.http.HTTPSender.send(HTTPSender.java:75)
    at org.apache.axis2.transport.http.CommonsHTTPTransportSender.writeMessageWithCommons(CommonsHTTPTransportSender.java:404)
    at org.apache.axis2.transport.http.CommonsHTTPTransportSender.invoke(CommonsHTTPTransportSender.java:231)
    at org.apache.axis2.engine.AxisEngine.send(AxisEngine.java:443)
    at org.apache.axis2.description.OutInAxisOperationClient.send(OutInAxisOperation.java:406)
    at org.apache.axis2.description.OutInAxisOperationClient.executeImpl(OutInAxisOperation.java:229)
    at org.apache.axis2.client.OperationClient.execute(OperationClient.java:165)
    at org.apache.axis2.client.ServiceClient.sendReceive(ServiceClient.java:555)
    at org.apache.axis2.client.ServiceClient.sendReceive(ServiceClient.java:531)
    at org.apache.axis2.rpc.client.RPCServiceClient.invokeBlocking(RPCServiceClient.java:102)
    at saop.test.main(test.java:46)org.apache.axis2.AxisFault: Connection timed out: connect
    at org.apache.axis2.AxisFault.makeFault(AxisFault.java:430)
    at org.apache.axis2.transport.http.HTTPSender.sendViaPost(HTTPSender.java:197)
    at org.apache.axis2.transport.http.HTTPSender.send(HTTPSender.java:75)
    at org.apache.axis2.transport.http.CommonsHTTPTransportSender.writeMessageWithCommons(CommonsHTTPTransportSender.java:404)
    at org.apache.axis2.transport.http.CommonsHTTPTransportSender.invoke(CommonsHTTPTransportSender.java:231)
    at org.apache.axis2.engine.AxisEngine.send(AxisEngine.java:443)
    at org.apache.axis2.description.OutInAxisOperationClient.send(OutInAxisOperation.java:406)
    at org.apache.axis2.description.OutInAxisOperationClient.executeImpl(OutInAxisOperation.java:229)
    at org.apache.axis2.client.OperationClient.execute(OperationClient.java:165)
    at org.apache.axis2.client.ServiceClient.sendReceive(ServiceClient.java:555)
    at org.apache.axis2.client.ServiceClient.sendReceive(ServiceClient.java:531)
    at org.apache.axis2.rpc.client.RPCServiceClient.invokeBlocking(RPCServiceClient.java:102)
    at saop.test.main(test.java:46)
    Caused by: java.net.ConnectException: Connection timed out: connect
    at java.net.DualStackPlainSocketImpl.waitForConnect(Native Method)
    at java.net.DualStackPlainSocketImpl.socketConnect(DualStackPlainSocketImpl.java:85)
    at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:339)
    at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:200)
    at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:182)
    at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:172)
    at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392)
    at java.net.Socket.connect(Socket.java:579)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:606)
    at org.apache.commons.httpclient.protocol.ReflectionSocketFactory.createSocket(ReflectionSocketFactory.java:140)
    at org.apache.commons.httpclient.protocol.DefaultProtocolSocketFactory.createSocket(DefaultProtocolSocketFactory.java:125)
    at org.apache.commons.httpclient.HttpConnection.open(HttpConnection.java:707)
    at org.apache.commons.httpclient.MultiThreadedHttpConnectionManager$HttpConnectionAdapter.open(MultiThreadedHttpConnectionManager.java:1361)
    at org.apache.commons.httpclient.HttpMethodDirector.executeWithRetry(HttpMethodDirector.java:387)
    at org.apache.commons.httpclient.HttpMethodDirector.executeMethod(HttpMethodDirector.java:171)
    at org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.java:397)
    at org.apache.axis2.transport.http.AbstractHTTPSender.executeMethod(AbstractHTTPSender.java:621)
    at org.apache.axis2.transport.http.HTTPSender.sendViaPost(HTTPSender.java:193)
    ... 11 more
      

  12.   

    你用eclipse生成 axis1然后 调用看看
      

  13.   

    eclipse 资源管理器哪里 新增一个java项目 然后点击右键 添加webservice,然后选中一个*.html的wsdl文件(你IE打开net的那个webservice地址里面看wsdl文件 然后保存成一个html),之后创建好 ,然后 新建一个测试类 里面 new 出来 直接调用方法就好了。