package inspur.yy;
import java.rmi.RemoteException;
import org.apache.axis.client.Call;
import org.apache.axis.client.Service;
import javax.xml.namespace.QName;
import javax.xml.rpc.ServiceException;
public class wsClient {
public static void main(String[] args) throws RemoteException,
ServiceException {
String url = "http://localhost:8001/jkpt/services/YyWs?wsdl";
Service serv = new Service();
Call call = null;
call = (Call) serv.createCall();
call.setTargetEndpointAddress(url);
// QName的URL,就是要指向的命名空间的名称了,这个URL地址在你的wsdl打开后可以看到的,上面有写着targetNamespace="http://yy.inspur",这个就是你的命名空间值了;
call.setOperationName(new QName("http://yy.inspur", "getYyxxList"));// getYyxxList接口中的方法名
// 接口的参数,dtDm区分大小写,和接口中方法的参数一样
call.addParameter("dtDm", org.apache.axis.encoding.XMLType.XSD_DATE,
javax.xml.rpc.ParameterMode.IN);// 接口的参数
call.addParameter("fzdm", org.apache.axis.encoding.XMLType.XSD_DATE,
javax.xml.rpc.ParameterMode.IN);// 接口的参数
call.addParameter("rq", org.apache.axis.encoding.XMLType.XSD_DATE,
javax.xml.rpc.ParameterMode.IN);// 接口的参数
call.setSOAPActionURI(url);
String returnMess = (String) call.invoke(new Object[] {
"1430802000001", "2002", "2015-10-22" });
System.out.println("1111111111111111111111" + returnMess);
}
import java.rmi.RemoteException;
import org.apache.axis.client.Call;
import org.apache.axis.client.Service;
import javax.xml.namespace.QName;
import javax.xml.rpc.ServiceException;
public class wsClient {
public static void main(String[] args) throws RemoteException,
ServiceException {
String url = "http://localhost:8001/jkpt/services/YyWs?wsdl";
Service serv = new Service();
Call call = null;
call = (Call) serv.createCall();
call.setTargetEndpointAddress(url);
// QName的URL,就是要指向的命名空间的名称了,这个URL地址在你的wsdl打开后可以看到的,上面有写着targetNamespace="http://yy.inspur",这个就是你的命名空间值了;
call.setOperationName(new QName("http://yy.inspur", "getYyxxList"));// getYyxxList接口中的方法名
// 接口的参数,dtDm区分大小写,和接口中方法的参数一样
call.addParameter("dtDm", org.apache.axis.encoding.XMLType.XSD_DATE,
javax.xml.rpc.ParameterMode.IN);// 接口的参数
call.addParameter("fzdm", org.apache.axis.encoding.XMLType.XSD_DATE,
javax.xml.rpc.ParameterMode.IN);// 接口的参数
call.addParameter("rq", org.apache.axis.encoding.XMLType.XSD_DATE,
javax.xml.rpc.ParameterMode.IN);// 接口的参数
call.setSOAPActionURI(url);
String returnMess = (String) call.invoke(new Object[] {
"1430802000001", "2002", "2015-10-22" });
System.out.println("1111111111111111111111" + returnMess);
}
}
详情在湖南国税空间中的test类中