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,
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,
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,
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
直接呼叫介面中的方法(傳入引數)即可