eclipse调用webservice(axis2)

1.选择创建一个web service client

2.输入wsdl地址,选择axis2运行时,点击“下一步”

3.在下边的框选择“同步”,点击”“完成”,会生成一个代理类

调用地址会写在此类中,实际调用时也可以传入新地址

 4.写代码测试

package webservice_test;

import java.rmi.RemoteException;
import org.apache.axis2.AxisFault;

public class test1 {

    public static void main(String[] args) throws Exception {
        call1();
    }
    
    static void call1() throws RemoteException {
        TestStub test = new TestStub();
        TestStub.Add request = new TestStub.Add();    
        request.setA(10);
        request.setA(20);
        TestStub.AddResponse response = test.add(request);
        System.out.println(response.get_return());
    }
}

猜你喜欢

转载自www.cnblogs.com/sap-George/p/11988874.html