WebService调用方法

方法一:

String endpoint = “***Api?wsdl”;
// 直接引用远程的wsdl文件
Service service = new Service();
Call call = (Call) service.createCall();
call.setTargetEndpointAddress(endpoint);
call.setOperationName(“AddOtherSystemTopicInfo”);// WSDL里面描述的接口名称
call.addParameter(“blockID”,
org.apache.axis.encoding.XMLType.XSD_STRING,
javax.xml.rpc.ParameterMode.IN);// 接口的参数
call.addParameter(“topicTypeID”,
org.apache.axis.encoding.XMLType.XSD_STRING,
javax.xml.rpc.ParameterMode.IN);// 接口的参数
call.addParameter(“topicCreaterCD”,
org.apache.axis.encoding.XMLType.XSD_STRING,
javax.xml.rpc.ParameterMode.IN);// 接口的参数
call.addParameter(“topicTitle”,
org.apache.axis.encoding.XMLType.XSD_STRING,
javax.xml.rpc.ParameterMode.IN);// 接口的参数
call.addParameter(“topicContent”,
org.apache.axis.encoding.XMLType.XSD_STRING,
javax.xml.rpc.ParameterMode.IN);// 接口的参数
call.addParameter(“fileIDs”,
org.apache.axis.encoding.XMLType.XSD_STRING,
javax.xml.rpc.ParameterMode.IN);// 接口的参数
call.addParameter(“receivers”,
org.apache.axis.encoding.XMLType.XSD_STRING,
javax.xml.rpc.ParameterMode.IN);// 接口的参数
call.addParameter(“doEndTime”,
org.apache.axis.encoding.XMLType.XSD_STRING,
javax.xml.rpc.ParameterMode.IN);// 接口的参数
call.addParameter(“importanceID”,
org.apache.axis.encoding.XMLType.XSD_STRING,
javax.xml.rpc.ParameterMode.IN);// 接口的参数
call.addParameter(“isPush”,
org.apache.axis.encoding.XMLType.XSD_STRING,
javax.xml.rpc.ParameterMode.IN);// 接口的参数
call.addParameter(“isOnlyReceivers”,
org.apache.axis.encoding.XMLType.XSD_STRING,
javax.xml.rpc.ParameterMode.IN);// 接口的参数
call.addParameter(“tagID”,
org.apache.axis.encoding.XMLType.XSD_STRING,
javax.xml.rpc.ParameterMode.IN);// 接口的参数
call.addParameter(“tagNM”,
org.apache.axis.encoding.XMLType.XSD_STRING,
javax.xml.rpc.ParameterMode.IN);// 接口的参数
call.addParameter(“systemName”,
org.apache.axis.encoding.XMLType.XSD_STRING,
javax.xml.rpc.ParameterMode.IN);// 接口的参数
call.addParameter(“appKey”,
org.apache.axis.encoding.XMLType.XSD_STRING,
javax.xml.rpc.ParameterMode.IN);// 接口的参数
call.setReturnType(org.apache.axis.encoding.XMLType.XSD_INT);// 设置返回类型
String[] obj = new String[]{“0”,“2”,"",“test”,“お疲れ様です、テストします。”,"","","",“1”,“0”,“0”,“0”,"","",""};
Object o= call.invoke(obj);
// 给方法传递参数,并且调用方法
System.out.println("result is " + o);

方法二:

new 一个Web Service Client

在这里插入图片描述
在这里插入图片描述
直接调用接口中的方法(传入参数)即可

猜你喜欢

转载自blog.csdn.net/Bingbingv/article/details/84936233