WsUtil public class WsUtil { public static String callService(String wsdlUrl, String actionURI, Map paramMap) { Object[] params = null; int index = actionURI.lastIndexOf("/") + 1; String action = actionURI.substring(index); String nameSpace
public class WsUtil { public static String callService(String wsdlUrl, String actionURI, MapparamMap) { Object[] params = null; int index = actionURI.lastIndexOf("/") + 1; String action = actionURI.substring(index); String nameSpaceUri = actionURI.substring(0,index); try { org.apache.axis.client.Service service = new org.apache.axis.client.Service(); Call call = (Call) service.createCall(); call.setTargetEndpointAddress(wsdlUrl); call.setSOAPActionURI(actionURI); call.setOperationName(new QName(nameSpaceUri, action)); for (String key : paramMap.keySet()) { call.addParameter(key, XMLType.XSD_STRING, ParameterMode.IN); } if (paramMap.size() > 0) { params = paramMap.values().toArray(); } call.setReturnType(XMLType.XSD_STRING);// 返回值类型:String String re = (String) call.invoke(params); return re; } catch (Exception e) { return e.toString(); } } }