import java.net.URL; import org.apache.log4j.Logger; import org.codehaus.xfire.client.Client; public class IServiceClient { private static Logger logger = Logger.getLogger(IServiceClient.class); public static String IServiceClient(String info) { String result="false"; try { logger.debug("begin Other"); Client c1 = new Client( new URL( "http://127.0.0.1:8080/service/SendInfo?wsdl")); logger.debug("init"); Object[] results1 = c1.invoke("setInfo",new Object[] { info}); logger.debug("invoke"); logger.debug(results1[0].toString()); result=results1[0].toString(); //Thread.sleep(500); } catch (Exception e) { e.printStackTrace(); } return result; } public static void main(String[] args) { IServiceClient("1006"); } }
来源:https://www.cnblogs.com/ityouknow/archive/2012/11/26/2788772.html