import java.net.URL;
import javax.xml.namespace.QName;
import javax.xml.rpc.ParameterMode;
import net.sf.json.JSONArray;
import net.sf.json.JSONObject;
import org.apache.axis.client.Call;
import org.apache.axis.client.Service;
import org.apache.axis.encoding.XMLType;
public class CompanyCredit {
/**
* 通过参数列表信息
* @param
* @return
*/
public static JSONArray getMethod(String three){
JSONArray josnArray = null;
try {
String url = "http://***************************************************?wsdl";
String targetnamespace = "http://***************************";
String method = "*********************";
Service sv = new Service(); //new 一个服务
Call call = (Call) sv.createCall(); //创建一个call对象
call.setTargetEndpointAddress(new URL(url)); //设置要调用的接口地址以上一篇的为例子
call.setOperationName(new QName(targetnamespace,method)); //设置要调用的接口命名空间和方法
call.addParameter("customCode", XMLType.XSD_STRING,ParameterMode.IN);//设置参数名 第二个参数表示String类型,第三个参数表示入参
call.addParameter("customLisence", XMLType.XSD_STRING,ParameterMode.IN);//设置参数名 第二个参数表示String类型,第三个参数表示入参
call.addParameter("qymc", XMLType.XSD_STRING,ParameterMode.IN);//设置参数名 第二个参数表示String类型,第三个参数表示入参
call.setReturnType(XMLType.XSD_STRING);//返回参数类型
String one= "*********************"; //第一个参数
String two= "************************";//第二个参数
//开始调用方法
String result = (String) call.invoke(new Object[]{one,two,three});
System.out.println(result);//打印字符串
josnArray = JSONArray.fromObject(result);
} catch (Exception e) {
System.err.println(e.toString());
}
return josnArray;
}
}
import javax.xml.namespace.QName;
import javax.xml.rpc.ParameterMode;
import net.sf.json.JSONArray;
import net.sf.json.JSONObject;
import org.apache.axis.client.Call;
import org.apache.axis.client.Service;
import org.apache.axis.encoding.XMLType;
public class CompanyCredit {
/**
* 通过参数列表信息
* @param
* @return
*/
public static JSONArray getMethod(String three){
JSONArray josnArray = null;
try {
String url = "http://***************************************************?wsdl";
String targetnamespace = "http://***************************";
String method = "*********************";
Service sv = new Service(); //new 一个服务
Call call = (Call) sv.createCall(); //创建一个call对象
call.setTargetEndpointAddress(new URL(url)); //设置要调用的接口地址以上一篇的为例子
call.setOperationName(new QName(targetnamespace,method)); //设置要调用的接口命名空间和方法
call.addParameter("customCode", XMLType.XSD_STRING,ParameterMode.IN);//设置参数名 第二个参数表示String类型,第三个参数表示入参
call.addParameter("customLisence", XMLType.XSD_STRING,ParameterMode.IN);//设置参数名 第二个参数表示String类型,第三个参数表示入参
call.addParameter("qymc", XMLType.XSD_STRING,ParameterMode.IN);//设置参数名 第二个参数表示String类型,第三个参数表示入参
call.setReturnType(XMLType.XSD_STRING);//返回参数类型
String one= "*********************"; //第一个参数
String two= "************************";//第二个参数
//开始调用方法
String result = (String) call.invoke(new Object[]{one,two,three});
System.out.println(result);//打印字符串
josnArray = JSONArray.fromObject(result);
} catch (Exception e) {
System.err.println(e.toString());
}
return josnArray;
}
}