`

Axis 客户端代码

    博客分类:
  • SOA
阅读更多

import org.apache.axis.client.Call;
import org.apache.axis.client.Service;

public class AxisClient {

    /**
     * @param args
     */
    public static void main(String[] args) {
        // TODO Auto-generated method stub

        try {
            Person person = new Person("Stephine","Yu");
            String endpoint = "http://localhost:8082/services/personService";
            String operation = "printPerson";
            Service service = new Service();

            Call call = (Call) service.createCall();
            call.setTargetEndpointAddress(new java.net.URL(endpoint));
            call.setOperationName(operation);

            // 这里的person 就是方法的参数。有几个参数,这里就写几个
            Person ps = (Person) call.invoke(new Object[] { person });

            System.out.println(ps.getName());

        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}

 

 

 

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics