钉钉消息发送

来源:互联网 发布:macola软件字段表 编辑:程序博客网 时间:2024/06/02 10:55
package com.lingsheng.AppServices;




import java.text.SimpleDateFormat;
import java.util.Date;


import javax.xml.namespace.QName;
import javax.xml.rpc.ParameterMode;
import javax.xml.rpc.ServiceException;
import javax.xml.rpc.encoding.XMLType;


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


import com.lingsheng.AppServices.daoImpl.DingDingUserDaoImpl;
import com.lingsheng.AppServices.daoImpl.EasPersonDaoImpl;
import com.lingsheng.AppServices.entity.DingDingUser;
import com.lingsheng.AppServices.entity.EasPerson;
/**
 * 调接口测试类
* <p>Title: DingDingPush </p>
* <p>Description: </p>
* <p>Company: </p> 
* @作者: ou.yang.ling
* @时间: 2017-6-5 上午10:33:04
 */
public class DingDingPush{


public static  String  ADVerification(String userIDS,String Content) {
     String url="http://oa.tlgchina.com:8081/Lstechservice.asmx";  //连接地址
     String obj=null;
     String method ="setDingTalk";
        Service service = new Service();
        Call call ;
 try {
     call = (Call)service.createCall();
     call.setTargetEndpointAddress(url);
     //指定接口
     call.setOperationName(new QName("http://oa.tlgchina.com:8081/",method));  
     call.addParameter(new QName("http://oa.tlgchina.com:8081/","userIDS"), XMLType.SOAP_STRING, ParameterMode.IN);// 给call对象设置方法的参数名、参数类型、参数模式
     call.addParameter(new QName("http://oa.tlgchina.com:8081/","Content"), XMLType.SOAP_STRING, ParameterMode.IN);// 给call对象设置方法的参数名、参数类型、参数模式
     call.setReturnType(XMLType.SOAP_STRING);// 设置调用方法的返回值类型 
     call.setUseSOAPAction(true);  //打开接口
     call.setSOAPActionURI("http://oa.tlgchina.com:8081/setDingTalk");
      obj =(String)call.invoke(new Object[]{userIDS,Content});
     System.out.println(obj);
 
 } catch (Exception e) {
     e.printStackTrace();
 }
return obj;
}


 
public static void main(String[] args) throws ServiceException, javax.xml.rpc.ServiceException {
         Date date = new Date();
         SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
         String createdate = sdf.format(date);
ADVerification("072603480227582790",createdate+"测试测试");
 
 }
}