package com.test.client;
import java.net.MalformedURLException;
import java.net.URL;
import org.codehaus.xfire.client.Client;
public class XFireClient {
/**
* @param args
*/
public static void main(String[] args) {
try {
Client client = new Client(new URL("http://localhost:8080/myxfire/services/CalculatorService?wsdl"));
Object[] results = client.invoke("add", new Object[] { 1,2});//add为接口中定义的方法名称,数组中为方法的参数
System.out.println(results[0]);
} catch (MalformedURLException e) {
e.printStackTrace();
} catch (Exception e) {
e.printStackTrace();
}
}
}
package com.test.client;
import java.net.MalformedURLException;
import java.net.URL;
import org.codehaus.xfire.client.Client;
public class XFireClient {
/**
* @param args
*/
public static void main(String[] args) {
try {
Client client = new Client(new URL("http://localhost:8080/myxfire/services/CalculatorService?wsdl"));
Object[] results = client.invoke("add", new Object[] { 1,2});//add为接口中定义的方法名称,数组中为方法的参数
System.out.println(results[0]);
} catch (MalformedURLException e) {
e.printStackTrace();
} catch (Exception e) {
e.printStackTrace();
}
}
}