xFire客户端代码

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");

    }

}

 

posted @ 2012-11-26 11:45  纯洁的微笑  阅读(1445)  评论(0编辑  收藏  举报