XFire客户端

来源:互联网 发布:java server 参数 编辑:程序博客网 时间:2024/06/03 22:58
  1. import java.net.MalformedURLException;
  2. import java.net.URL;
  3. import org.codehaus.xfire.client.Client;
  4. public class XFireClient {
  5.     /**
  6.      * @param args
  7.      */
  8.     public static void main(String[] args) {
  9.         // TODO Auto-generated method stub
  10.         
  11.         
  12.         Client client;
  13.         try {
  14.             client = new Client(new
  15.                     URL("http://192.168.2.48:8080/xfire/services/BookService?wsdl"));
  16.             
  17.                Object[] results = client.invoke("getBooks"new Object[0]);
  18.                   System.out.println((String) results[0]);
  19.         } catch (MalformedURLException e) {
  20.             // TODO Auto-generated catch block
  21.             e.printStackTrace();
  22.         } catch (Exception e) {
  23.             // TODO Auto-generated catch block
  24.             e.printStackTrace();
  25.         }
  26.                        
  27.                         }
  28.     }