• java 使用AXIS调用远程的web service


      1、服务

        

      2、代码

    import javax.xml.namespace.QName;
    import org.apache.axis.client.Call;
    import org.apache.axis.client.Service;
    
    /**
     * @Author:
     * @Description:
     * @Date:Created in 10:11 2018/9/7
     * @Modified by:
     **/
    public class accessWeb {
     
        public static void main(String args[]) {
            test();
        }
    
        public static void test() {
            String url = "http://15.23.25.21/spesvc/Ott/OttService.asmx";// 提供接口的地址
            String soapaction = "http://oc.ctrchina.cn/";// 域名,这是在server定义的
            String monitorDate = "2018-09-01";
            Service service = new Service();
            try {
                Call call = (Call) service.createCall();
                call.setTargetEndpointAddress(url);
                call.setOperationName(new QName(soapaction, "GetPlayListGuidWithDate")); // 设置要调用哪个方法
                call.addParameter(new QName(soapaction, "monitorDate"), // 设置要传递的参数
                        org.apache.axis.encoding.XMLType.XSD_STRING, javax.xml.rpc.ParameterMode.IN);
                call.setReturnType(org.apache.axis.encoding.XMLType.XSD_STRING);// (标准的类型)
                call.setSOAPActionURI(soapaction + "GetPlayListGuidWithDate");
                String res = String.valueOf(call.invoke(new Object[] { monitorDate }));// 调用方法并传递参数
                System.out.println(res);
    
            } catch (Exception ex) {
                ex.printStackTrace();
            }
        }
    
    
    }

      2、应用jar包

      

  • 相关阅读:
    1.Vue.js的常用指令
    爬虫
    对key中有数字的字典进行排序
    微信公众号服务器验证的坑
    Linux之正则表达式grep
    Oracle之select
    Linux之文件与目录管理
    Linux之vim、压缩与解压缩
    Linux之文件权限、用户管理
    Oracle学习入门
  • 原文地址:https://www.cnblogs.com/shaosks/p/9628518.html
Copyright © 2020-2023  润新知