如果现在开发WebService,用的大多是axis2或者CXF。

有时候三方给的接口例子中会用到标题上面的类,这个在axis2中是不存在,这两个类属于axis1中的!!!

axis1 jar如下:

WebService - import org.apache.axis.client.Call; import org.apache.axis.client.Service;找不到_axis1


示例如下:

import java.net.URL;

import javax.xml.namespace.QName;

import org.apache.axis.client.Call;
import org.apache.axis.client.Service;

public class Client {

public static void main(String[] args) throws Exception {
// TODO Auto-generated method stub
Call call=(Call)(new Service()).createCall();
call.setTargetEndpointAddress(new URL("http://IP:端口/XXX?wsdl"));
call.setOperationName(new QName("namespace","方法名"));
call.setTimeout(30000);
String re=(String)call.invoke(new String[]{参数});
System.out.println(re);
}

}

如果服务未启,报异常信息如下:

WebService - import org.apache.axis.client.Call; import org.apache.axis.client.Service;找不到_web service_02


同样的例子,axis2报异常信息如下:

WebService - import org.apache.axis.client.Call; import org.apache.axis.client.Service;找不到_axis1_03

axis1是不是比较坑?