java开发

axis服务项目请求方式

2020-05-20  本文已影响0人  黎凡s

方式1:java请求

public static void main(String[] args) throws ServiceException, MalformedURLException, RemoteException {
//地址ip:端口/项目名/axis配置的servlet拦截路径(也可用后缀)/wsdd文件中配置的服务name
String endpoint = "http://localhost:8081/zdtis/services/ZdtisService";

    //创建一个服务(service)调用(call)
    Service service = new Service();
    Call call = (Call) service.createCall();

// call.setOperationName(new QName("http://service.cm.com", "sayHello"));
//设置service所在的url
call.setTargetEndpointAddress(new java.net.URL(endpoint));

    //方法名
    call.setOperation("alQuery6");

    //参数
    String ret = (String)call.invoke(new Object[]{"{\"type\":\"queryDh\"}"});
    System.out.println(ret);
}
上一篇下一篇

猜你喜欢

热点阅读