After trying a variety of WebService client call methods, still think this method is reliable, this method uses the Apache CXF Framework, the tool class source code is as follows:
Import java.lang.reflect.method;import org.apache.cxf.jaxws.jaxwsproxyfactorybean;public class wsreq{ private string wsurl; private class <?> interfaceclz; pulbic wsreq (String WSURL,&NBSP;CLASS<?>&NBSP;INTERFACECLZ) { this.wsurl = wsUrl; this.interfaceClz = interfaceClz; } public string invoke (String methodname, object... params) throws Exception { object obj = getwsobject (); class<?>[] argstypes = new classs[params.length]; for&nbSP; (int i = 0; i < params.length; i ++) { if (params[i] != null) { argsTypes[i] = Params[i].getclass (); } } method method = interfaceclz.getmethod (MethodName, argsType); String result = (String) method.invoke (obj, params); return result; } private object getwsobject () { &nBsp; jaxwsproxyfactorybean factory = new jaxwsproxyfactorybean (); factory.setaddress (Wsurl); factory.setserviceclass (INTERFACECLZ); object obj = (Object) factory.create (); return obj; }}
This article is from the "Evan" blog, be sure to keep this source http://wenshengzhu.blog.51cto.com/5151285/1851102
CXF Soup WebService Dynamic Client Invoke tool class