axis2 客户端例子

generate client

1. run command

wsdl2java -uri http://localhost:8080/axis2/services/MyService?wsdl -p client -s -o stub

2. copy it to eclipse

import javax.xml.namespace.QName;
import org.apache.axis2.addressing.EndpointReference;
import org.apache.axis2.client.Options;
import org.apache.axis2.rpc.client.RPCServiceClient;
import client.MyServiceStub;

public class Test {

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		
		try{
		MyServiceStub stub = new MyServiceStub();
		MyServiceStub.GetName gg = new MyServiceStub.GetName();
	    gg.setName("jack");
        System.out.println( stub.getName(gg).get_return());
		}catch(Exception x){
			System.out.println(x.getMessage());
		}
        

	}

}

你可能感兴趣的:(axis2)