关于使用axis调用webservice接口方法

1、概述:

  我们有时候会调用webserviec接口,我们向接口发送请求参数,从接口接收返回值。

2、形式:

  

package client;  

import org.apache.axis.client.Call;
import org.apache.axis.client.Service; public class TestClient { public static void main(String[] args) throws Exception { // 指出service所在URL String endpoint = "http://xxxxxxxxxxxxxx/webservice/services/xxxxxxxxx"; // 创建一个服务(service)调用(call) Service service = new Service(); Call call = (Call) service.createCall();// 通过service创建call对象 // 设置service所在URL call.setTargetEndpointAddress(new java.net.URL(endpoint)); // 方法名(processService)与MyService.java方法名保持一致 call.setOperationName("getName"); // Object 数组封装了参数,参数为"This is Test!",调用processService(String arg) String ret = (String) call.invoke(new Object[] { "xxxxx" }); System.out.println(ret); } }
上一篇:进程管理supervisor的简单说明


下一篇:win10下安装Ubuntu16.04双系统